Prevent the cursor from jumping around on gl*

This commit is contained in:
EinfachToll 2013-10-29 13:10:16 +01:00
parent a389d7ebd7
commit e9b1b66807
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -188,7 +188,7 @@ command! -buffer -nargs=1 VimwikiGoto call vimwiki#base#goto("<args>")
" list commands
command! -buffer -range -nargs=1 VimwikiListChangeMarker call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>)
command! -buffer -range -nargs=+ VimwikiListChangeMarker call vimwiki#lst#change_marker(<line1>, <line2>, <f-args>)
command! -buffer -nargs=1 VimwikiListChangeMarkerInList call vimwiki#lst#change_marker_in_list(<f-args>)
command! -buffer -nargs=+ VimwikiListLineBreak call <SID>CR(<f-args>)
command! -buffer -range -nargs=1 VimwikiListIncreaseLvl call vimwiki#lst#change_level(<line1>, <line2>, 'increase', <f-args>)
@ -354,8 +354,8 @@ map <silent> <buffer> gLH glH
map <silent> <buffer> gLL gLl
inoremap <buffer> <C-D> <C-O>:VimwikiListDecreaseLvl 0<CR>
inoremap <buffer> <C-T> <C-O>:VimwikiListIncreaseLvl 0<CR>
inoremap <buffer> <C-L><C-J> <C-O>:VimwikiListChangeMarker next<CR>
inoremap <buffer> <C-L><C-K> <C-O>:VimwikiListChangeMarker prev<CR>
inoremap <buffer> <C-L><C-J> <C-O>:VimwikiListChangeMarker next i<CR>
inoremap <buffer> <C-L><C-K> <C-O>:VimwikiListChangeMarker prev i<CR>
nmap <silent> <buffer> glr :call vimwiki#lst#adjust_numbered_list()<CR>
nmap <silent> <buffer> gLr :call vimwiki#lst#adjust_whole_buffer()<CR>
nmap <silent> <buffer> gLR gLr
@ -365,11 +365,11 @@ inoremap <silent> <buffer> <C-L><C-M> <Esc>:call vimwiki#lst#toggle_list_item()<
for s:k in keys(g:vimwiki_bullet_types)
let s:char = (s:k == '•' ? '.' : s:k)
exe 'noremap <silent> <buffer> gl'.s:char.' :VimwikiListChangeMarker '.s:k.'<CR>'
exe 'noremap <silent> <buffer> gl'.s:char.' :VimwikiListChangeMarker '.s:k.' n<CR>'
exe 'noremap <silent> <buffer> gL'.s:char.' :VimwikiListChangeMarkerInList '.s:k.'<CR>'
endfor
for s:k in g:vimwiki_number_types
exe 'noremap <silent> <buffer> gl'.s:k[0].' :VimwikiListChangeMarker '.s:k.'<CR>'
exe 'noremap <silent> <buffer> gl'.s:k[0].' :VimwikiListChangeMarker '.s:k.' n<CR>'
exe 'noremap <silent> <buffer> gL'.s:k[0].' :VimwikiListChangeMarkerInList '.s:k.'<CR>'
endfor