Given the following file
1 2 3 4 5 When I say :1m3
the file looks like this
2 3 1 4 5 But when I say :3m1 it looks like this
1 3 2 4 5 I thought the 3 should be before 1. Why is it like this?
As Stéphane Chazelas pointed out by using the vim help with :h :m it states the following:
:[range]m[ove] {address} *:m* *:mo* *:move* *E134* Move the lines given by [range] to below the line given by {address}. Therefore by moving line 1 below line 3 the result is as stated in the question. But if one wanted to move line 3 to the first line it has to be moved below line 0
Commands like :copy and :move put the target below the line given by {address}. You can use an address of 0 to move to the first line. Some commands (like :put) also support a reversal of before / after via :put!
:h :m?