When you use a
count to a key mapping it goes down
count number of times and resets to column 1.
Actually it already resets to col 1 when entering the function if there is a
So I can save the current line number in a script variable, but that does not work for the column because the column is 1 if there is a
Using a loop does not really help because even if I instantly return from a function the cursor will move
count number of times and set the col to 1.
Then I tried using the
range keyword with a:firstline and a:lastline but the cursor still resets to col 1.
Is there a way to prevent this behavior of a
count or a
map <unique> <Leader>c :call Commenter() <CR> function Commenter() let s:curcol=col('.') let s:curlineno=line('.') echo "the column is " . s:curcol echo "the line number is " . s:curlineno let l:curlineno=line('.') echo "the current line is " . l:curlineno let l:curcol=col('.') echo "the current col is " . l:curcol call cursor(s:curlineno,s:curcol) endfunction