I am writing python code so shifting/moving blocks of lines is important to avoid going through each line individually. How can I do this without an add-on? Is there a type of operation keystroke command to do this?
indent-rigidly, which is bound to
C-x TAB by default.
You can specify the number of spaces to indent by using a prefix argument, such as
C-5 C-x TAB.
Or you can invoke the command and then use the left/right arrows to interactively adjust the indent level.
string-rectangle command (
C-x r t) can be used to insert any arbitrary text (spaces included) in a selected region.
Let's say you have this block of text and you want to insert 5 spaces in front of all lines.
abc def ghi
First select a "0 column" region as shown below (the point is on the character 'a' and the mark is in the same column in the row containing 'ghi':
▮bc def ▯ ghi
string-rectangle, insert the text you want to insert in the selected region. In this example, we will be inserting 5 spaces on all the rows including and inbetween the point and the mark.
C-x r t M-5 SPC RET
That will give the below force indented text.
abc def ghi