Prioritize: preserve cursor position

This commit is contained in:
David Beniamine
2015-03-13 10:16:22 -03:00
parent 2efc471969
commit 3bff204d7a

View File

@@ -111,12 +111,15 @@ function! TodoTxtPrioritizeDecrease()
normal! 0f)h normal! 0f)h
endfunction endfunction
function! TodoTxtPrioritizeAdd (priority)
let oldpos=getcurpos() let oldpos=getcurpos()
let line=getline('.') let line=getline('.')
if line !~ '^([A-F])' if line !~ '^([A-F])'
:call TodoTxtPrioritizeAddAction(a:priority)
let oldpos[2]+=4 let oldpos[2]+=4
else else
exec ':s/^([A-F])/('.a:priority.')/' exec ':s/^([A-F])/('.a:priority.')/'
endif
call setpos('.',oldpos) call setpos('.',oldpos)
endfunction endfunction