gvim - How to keep the cursor position fixed on the screen when vim turns pages (scrolls)?
给我你的怀抱
给我你的怀抱 2017-05-16 16:36:15
0
5
1077

When turning pages (scrolling) in vim, the default cursor moves up to the top of the screen or down to the bottom of the screen. I hope to keep the position on the screen unchanged, that is, only move the text, but not the cursor (relative to screen) position.

How to achieve this? Please advise, thanks in advance!

给我你的怀抱
给我你的怀抱

reply all(5)
漂亮男人

You mean these?

ctrl + y goes up one line
ctrl + e goes down one line
ctrl + u goes up half the screen
ctrl + d goes down half the screen
ctrl + b goes up one screen
ctrl + f goes down the screen


You can check out this stackoverflow answer

http://stackoverflow.com/questions/3458689/how-to-move-screen-without-moving-cursor-in-vim

The ToggleScrollMode function below is good, I guess it should meet your needs

Ty80

If you cannot install the plug-in, you can try to turn on the relative line number display of vim, and jump quickly based on the relative line number after turning the page.

大家讲道理

Added to

.vimrc

" 在上下移动光标时,光标的上方或下方至少会保留显示的行数
set scrolloff=7

This 7 you set yourself

淡淡烟草味

You can zz to align the line to the center after scrolling, similar to emacs' <C-l>

迷茫

ctrl-d scrolls down half the screen, the cursor will not move

ctrl-f Scroll down one screen and the monogram will move.

shift-m moves the cursor to the middle of the screen and can be used after ctrl-f to flip the screen

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!