aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-28 14:39:29 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-28 14:39:29 +1200
commit45a5a1a82fa3d8bb0c339a283a6175b05d24c496 (patch)
tree8f041751e422a50a50d2ca48f219511c8199c3d8
parentBump VERSION (diff)
downloadvim-fixed-join-45a5a1a82fa3d8bb0c339a283a6175b05d24c496.tar.gz
vim-fixed-join-45a5a1a82fa3d8bb0c339a283a6175b05d24c496.zip
Revert "Remove useless cursor restoration code"
This reverts commit 4c7a6b1e5640e8979dda8dd0553a232745501bad. :join keeps the cursor on the same line, but moves to the first non-blank column. I didn't notice this at first.
-rw-r--r--plugin/fixed_join.vim9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugin/fixed_join.vim b/plugin/fixed_join.vim
index 1610011..2abb3a0 100644
--- a/plugin/fixed_join.vim
+++ b/plugin/fixed_join.vim
@@ -31,6 +31,15 @@ function! s:FixedJoin()
let l:command = l:cursor_line . ',' . l:join_line . 'join'
execute l:command
+ " Return the cursor to the saved position (Vim 6.0 fallback)
+ if exists('*cursor')
+ call cursor(l:cursor_line, l:cursor_col)
+ else
+ execute 'normal! '
+ \ . l:cursor_line . 'G'
+ \ . l:cursor_col . '|'
+ endif
+
endfunction
" Create modeless mapping target for the function just defined