I have this:
pick 887b66f add 222 Dziewiecsil to flowers new title
pick dc331cb new name of beginning commit
And I want to get this:
pick dc331cb new name of beginning commit
pick 887b66f add 222 Dziewiecsil to flowers new title
Is there a way to do this in a quick way using keyboard shortcuts?
Method 1 – Using Line Numbers 1 Start by opening the file you wish to edit in Vim. 2 Next, press the ESC key to launch Vim Command Mode. 3 Enter the command: More ...
First, before you can comment on multiple lines in Vim, you need to know how to comment a single line, so let’s focus on that as our starting point. To comment out a single line in Vim, enter Visual Mode by pressing Ctrl + V. Next, navigate to the line you wish to comment out and press the C key.
To swap the current line with the next one, type ddp while in command mode. dd - delete line (actually called cut in other editors) and save it in register Move the cursor on the first line, then type ddp. If you are not in command mode yet, hit Esc to get into command mode.
This can become even handier when swiping multiple lines at the same time using the visual mode. This is great! much more versatile than the chosen answer! :) You could map this if you want.
To swap the current line with the next one, type ddp
while in command mode.
dd
deletes the current line, then you can paste the removed line using p
. There's another way though using m
. With m
you can move lines around i.e.
:m 1
will move the current line after line 1
:m 0
will move the current line to top
:m $
will move the current line to bottom
In your example, place the cursor in the first line and type :m $
More info: http://vim.wikia.com/wiki/Moving_lines_up_or_down
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With