Question

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.

Était-ce utile?

La solution

Use mark. help mark

nnoremap v m`v
nnoremap V m`V
nnoremap <C-v> m`<C-v>
vnoremap <esc> <esc>``
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top