Vim keeps cursor position while scrolling

Is there a way to keep cusror location off screen in Vim / gVim while scrolling? Like many Windows editors.
I know about signs and use them. I also know "." mark (last edit), but looking for other ideas. I ask about this because sometimes I want to hold the cursor in a certain place, scroll to another place with the mouse wheel, and then just press the throw key or something to return me to this place.

+47
vim
Mar 25 '09 at 6:41
source share
6 answers

No. vim is a console application, so it really doesn't make sense to have the cursor overs (perhaps, but just messed up).

An alternative solution is to rephrase messages from this thread from comp.editors :

Ctrl+o goes to the previous cursor location, Ctrl+i goes to the next (for example, cancel / redo for movements)

Signs seem like a different solution.

Also use tags. Signs are called letters. For example, typing ma remembers the current location under the brand name a. To go to the line containing label a, enter. For exact location use `a.

Lower case marks for each file. Uppercase characters are global; `A will switch to the file containing the label A, to the exact location.

Mostly ma , move around, then `a to go back.

Another option proposed by Paul,

gi command switches Vim to Insert mode and places the cursor at the same position as when the insert mode was last stopped.

+33
Mar 25 '09 at 7:40
source share

Why don't you break the window, see what you want to see, and then close the split?

 :split 

or

 :vsplit (if you want to split vertically) 
+17
Mar 25 '09 at 6:48
source share

Sometimes you can avoid jumping with marks before entering text - the gi command switches Vim to Insert mode and places the cursor at the same position as when the insert mode was last stopped.

+11
Mar 25 '09 at 10:20
source share

The only similar behavior I found in Vim:

z t "Scroll down the screen as far as possible without moving the cursor"

z b "scroll as far as possible".

Ctrl + E "scroll one line down if possible"

Ctrl + Y "scroll one line up if possible"

+7
Jan 08 '15 at 19:03
source share

Google says that the cursor (and therefore the current line) should be visible in Vi, so you have to use labels.

+3
Mar 25 '09 at 6:45
source share

Also very useful are '' (2x single quotes) and `` (2x back quotes). The first jumps back to the line that you were before the last jump (for example, page down). The latter returns to the row and column that you were before the last jump.

+3
Mar 28 '09 at 9:30 a.m.
source share



All Articles