문제

When I'm in the visual mode and I decide to switch back to normal by pressing <esc> then I'd like to have the cursor back on the position where I entered the visual mode. How can it be achieved? E.g. something like:

vnoremap <esc> <esc>`<

but this will return always only to the beginning of the visual block.

도움이 되었습니까?

해결책

Use mark. help mark

nnoremap v m`v
nnoremap V m`V
nnoremap <C-v> m`<C-v>
vnoremap <esc> <esc>``
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top