Skip to content

Commit 4e2680c

Browse files
committed
Do not re-indent in visual selections if chosen
If g:move_auto_indent is set to 0 we are not allowed to re-indent. This can prevent problems like #9.
1 parent 98ce670 commit 4e2680c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugin/move.vim

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ function! s:MoveBlockDown(start, end, count)
3939
endif
4040

4141
execute "silent" a:start "," a:end "m " next_line
42-
call s:ResetCursor()
42+
if (g:move_auto_indent == 1)
43+
call s:ResetCursor()
44+
else
45+
normal! gv
46+
endif
4347
endfunction
4448

4549
function! s:MoveBlockUp(start, end, count)
@@ -55,7 +59,11 @@ function! s:MoveBlockUp(start, end, count)
5559
endif
5660

5761
execute "silent" a:start "," a:end "m " prev_line
58-
call s:ResetCursor()
62+
if (g:move_auto_indent == 1)
63+
call s:ResetCursor()
64+
else
65+
normal! gv
66+
endif
5967
endfunction
6068

6169
function! s:MoveLineUp(count) range

0 commit comments

Comments
 (0)