René Nyffenegger
René Nyffenegger

Reputation: 40499

Is there something in VIM that behaves like ^E + j?

Is there a key-combination that behaves as though I'd press ctrl-E followed by a j, that is the text scrolls up a line but the cursor keeps where it is, relativ to the screen.

I am aware that I could achieve what I want with a :map but before I do I thought I'd rather want to know if there is already some "built-in" functionality

Upvotes: 1

Views: 104

Answers (2)

Hasturkun
Hasturkun

Reputation: 36402

Yes, use CTRL-D with a count of 1 (not that that saves you anything, really).

The CTRL-D command does the same as CTRL-E, but also moves the cursor down the same number of lines

Upvotes: 1

Fredrik Pihl
Fredrik Pihl

Reputation: 45644

There is the z command

z. Redraw, line [count] at center of window (default cursor line). Put cursor at first non-blank in the line.

zz Like "z.", but leave the cursor in the same column. Careful: If caps-lock is on, this commands becomes "ZZ": write buffer and exit! {not in Vi}

These mappings makes it possible to scroll up and down one line with focus on center line (hard to describe so that it sound correct, try it instead)

"scroll with line in center
map <C-Up> <ESC>0kzz
map <C-Down> <ESC>0jzz

Upvotes: 0

Related Questions