diff options
-rw-r--r-- | plugin/fixed_join.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugin/fixed_join.vim b/plugin/fixed_join.vim index ae0e086..f64b650 100644 --- a/plugin/fixed_join.vim +++ b/plugin/fixed_join.vim @@ -20,8 +20,15 @@ function! s:FixedJoin() let l:cursor_line = line('.') let l:cursor_col = col('.') + " Find last line of join; silently cap it to last buffer line + let l:join_line = l:cursor_line + v:count1 + let l:last_line = line('$') + if l:join_line > l:last_line + let l:join_line = l:last_line + endif + " Build and execute join command - let l:command = '.,+' . v:count1 . 'join' + let l:command = '.,' . l:join_line . 'join' execute l:command " Return the cursor to the saved position (Vim 6.0 fallback) |