aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-06-17 22:23:00 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-06-17 22:23:00 +1200
commitd5ea2115200c53697b51570d5b56f734ae64de21 (patch)
treecd825a65d941bf37ebe91e494cb3b4e01c00ef6a
parentAdd version guard (diff)
downloadvim-fixed-join-d5ea2115200c53697b51570d5b56f734ae64de21.tar.gz
vim-fixed-join-d5ea2115200c53697b51570d5b56f734ae64de21.zip
Add Vim-6.0 compatible cursor() fallback
-rw-r--r--plugin/fixed_join.vim10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugin/fixed_join.vim b/plugin/fixed_join.vim
index b620cc7..7d97682 100644
--- a/plugin/fixed_join.vim
+++ b/plugin/fixed_join.vim
@@ -24,8 +24,14 @@ function! s:FixedJoin()
let l:command = '.,+' . v:count1 . 'join'
execute l:command
- " Restore cursor position
- call cursor(l:lc, l:cc)
+ " 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