From e9b1b66807d2affdbe1a12f983d2d9572ad55f79 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Tue, 29 Oct 2013 13:10:16 +0100 Subject: [PATCH] Prevent the cursor from jumping around on gl* --- autoload/vimwiki/lst.vim | 4 ++-- ftplugin/vimwiki.vim | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/autoload/vimwiki/lst.vim b/autoload/vimwiki/lst.vim index 07c757a..af01234 100644 --- a/autoload/vimwiki/lst.vim +++ b/autoload/vimwiki/lst.vim @@ -826,8 +826,8 @@ function! s:set_new_mrkr(item, new_mrkr) "{{{ endif endfunction "}}} -function! vimwiki#lst#change_marker(line1, line2, new_mrkr) "{{{ - let cur_col_from_eol = col("$") - col("'^") +function! vimwiki#lst#change_marker(line1, line2, new_mrkr, mode) "{{{ + let cur_col_from_eol = col("$") - (a:mode == "i" ? col("'^") : col('.')) let new_mrkr = a:new_mrkr let cur_ln = a:line1 while 1 diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim index 31fe160..d599ded 100644 --- a/ftplugin/vimwiki.vim +++ b/ftplugin/vimwiki.vim @@ -188,7 +188,7 @@ command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("") " list commands -command! -buffer -range -nargs=1 VimwikiListChangeMarker call vimwiki#lst#change_marker(, , ) +command! -buffer -range -nargs=+ VimwikiListChangeMarker call vimwiki#lst#change_marker(, , ) command! -buffer -nargs=1 VimwikiListChangeMarkerInList call vimwiki#lst#change_marker_in_list() command! -buffer -nargs=+ VimwikiListLineBreak call CR() command! -buffer -range -nargs=1 VimwikiListIncreaseLvl call vimwiki#lst#change_level(, , 'increase', ) @@ -354,8 +354,8 @@ map gLH glH map gLL gLl inoremap :VimwikiListDecreaseLvl 0 inoremap :VimwikiListIncreaseLvl 0 -inoremap :VimwikiListChangeMarker next -inoremap :VimwikiListChangeMarker prev +inoremap :VimwikiListChangeMarker next i +inoremap :VimwikiListChangeMarker prev i nmap glr :call vimwiki#lst#adjust_numbered_list() nmap gLr :call vimwiki#lst#adjust_whole_buffer() nmap gLR gLr @@ -365,11 +365,11 @@ inoremap :call vimwiki#lst#toggle_list_item()< for s:k in keys(g:vimwiki_bullet_types) let s:char = (s:k == '•' ? '.' : s:k) - exe 'noremap gl'.s:char.' :VimwikiListChangeMarker '.s:k.'' + exe 'noremap gl'.s:char.' :VimwikiListChangeMarker '.s:k.' n' exe 'noremap gL'.s:char.' :VimwikiListChangeMarkerInList '.s:k.'' endfor for s:k in g:vimwiki_number_types - exe 'noremap gl'.s:k[0].' :VimwikiListChangeMarker '.s:k.'' + exe 'noremap gl'.s:k[0].' :VimwikiListChangeMarker '.s:k.' n' exe 'noremap gL'.s:k[0].' :VimwikiListChangeMarkerInList '.s:k.'' endfor