开发者

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 scro开发者_如何学编程lls 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


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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜