function! DebugC()
let l:debugStr = "printf(\"" . s:debugPrefixStr . s:debugCounter . "\");"
if g:debugstringAlwaysIncludeHeader
let l:incStr = "#include <stdio.h>; "
let l:debugStr = l:incStr . l:debugStr
endif
:put=l:debugStr
endfunc " }}}
Method dumps the text correctly but if I use execute instead of call, it always moves the cursor to the top of the
" doesn't move to top of file
autocmd Filetype c,cpp nnoremap <buffer> <silent> <Plug>DumpDebugString :call DebugC()<CR>
" moves cursor to the top of the file
autocmd Filetype c,cpp nnoremap <buffer> <silent> <Plug>DumpDebugString :exe DebugC()<CR>
Adding getcurpos()
, setpos()
at the start and end of the function doesn't seem to solve the problem.
Any pointers?