The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged


See :h getcurpos() Basically there is an example: This can be used to save and restore the cursor position: > let save_cursor = getcurpos() MoveTheCursorAround call setpos('.', save_cursor) So you can try it with smth like (untested): nnoremap <C-f> :let save_cursor=getcurpos() <bar> %!clang-...


How do I get the column of the cursor independently of how the selection was made? Let's make it clear: at this point you're already in the normal mode. All you can get is the selection range, not the cursor position at the time it was made. And so col('.') correctly returns the current cursor position, not the previous one. Your confusion is based on an ...

Only top voted, non community-wiki answers of a minimum length are eligible