diff --git a/doc/move.txt b/doc/move.txt index 48a557b..a031d67 100644 --- a/doc/move.txt +++ b/doc/move.txt @@ -32,6 +32,11 @@ keys. Your can specify the key modifier that uses in key bindings with > All mappings can be prefixed with a {count} and will move {count} steps instead of one. +By default the plugin indents the buffer after every move operation. Can be +disabled with > + + let g:move_auto_indent = 0 + ------------------------------------------------------------------------------- 2.1 MoveBlockDown diff --git a/plugin/move.vim b/plugin/move.vim index 150a170..2cd242e 100644 --- a/plugin/move.vim +++ b/plugin/move.vim @@ -18,6 +18,10 @@ if !exists('g:move_key_modifier') let g:move_key_modifier = 'A' endif +if !exists('g:move_auto_indent') + let g:move_auto_indent = 1 +endif + function! s:ResetCursor() normal! gv=gv^ endfunction @@ -63,13 +67,17 @@ function! s:MoveLineUp(count) range if (line('.') - distance) < 0 execute 'silent m 0' - normal! == + if (g:move_auto_indent == 1) + normal! == + endif return endif execute 'silent m-' . distance - normal! == + if (g:move_auto_indent == 1) + normal! == + endif endfunction function! s:MoveLineDown(count) range @@ -81,12 +89,16 @@ function! s:MoveLineDown(count) range if (line('.') + distance) > line('$') execute 'silent m $' - normal! == + if (g:move_auto_indent == 1) + normal! == + endif return endif execute 'silent m+' . distance - normal! == + if (g:move_auto_indent == 1) + normal! == + endif endfunction function! s:MoveBlockOneLineUp() range