54 votes
Accepted

How do I center the current line in the screen?

The z. and zz commands will recenter the line the cursor is on. z. also moves the cursor to the first non-whitespace character in the line, while zz keeps the cursor where it is. There are similar ...
  • 10.4k
30 votes
Accepted

What is the mnemonic for Ctrl-Y (in normal mode)?

Bill Joy and Mark Horton wrote in their original vi manual: If you want to see more of the file below where you are, you can hit ^E to expose one more line at the bottom of the screen, leaving the ...
30 votes
Accepted

How can I get both splits to scroll left or right at the same time?

To scroll two windows together in vim, need to run :set scrollbind in each of them. As you noted, by default, this only binds vertical scrolling. In the docs for scrollbind, it mentions: The behavior ...
  • 2,878
30 votes
Accepted

Scroll a quarter (25%) of the screen up or down

Maybe ctrld and ctrlu could be what you are looking for. By default they move half of the screen. From :h CTRL-D: Scroll window Downwards in the buffer. The number of lines comes from the '...
  • 46.8k
23 votes
Accepted

How do I make Vim always display several lines after EOF?

You can use ctrlE to scroll down your file, when you are at the end of the file it will add "virtual" line so the last line of the file is not at the bottom of the windows. Additionally you can use ...
  • 46.8k
20 votes
Accepted

Scroll the screen, not the cursor, when using scrollwheel

As @Doorknob said in his comment, :set mouse=a fixes the problem.
  • 1,037
20 votes
Accepted

Turn off synchronous scrolling not caused by either scrollbind or diff

As Christian Brabandt suggested in a comment, this can be caused by the 'cursorbind' setting. From :help 'cursorbind': When this option is set, as the cursor in the current window moves other ...
16 votes

What is the mnemonic for Ctrl-Y (in normal mode)?

I like to call <C-y> "Yester-line"™ like "Yesterday". Explaining it along with <C-e> rhymes, too. "Extra-line" and "Yester-line"™.
  • 371
13 votes

How do I center the current line in the screen?

Type zz to center the current line in the screen:
  • 2,453
9 votes
Accepted

Why are my windows scrolling together?

As suggested by Christian Brabandt in the comments, this was caused by the 'cursorbind' setting. :help 'cursorbind': When this option is set, as the cursor in the current window moves other ...
9 votes
Accepted

How can I advance a page without losing my column position?

Simply add set nostartofline to your vimrc. See :help 'startofline'.
  • 33.3k
8 votes

Scrolling issues when the `wrap` option is set

That is an issue, that has been often requested but never been implemented. So no, there is no possibility for a better and smoother scrolling, once the lines wrap.
8 votes

Scrolling down multiple lines with Ctrl+e

You can use a count before Ctrl-E − 15<C-e> moves down 15 lines. Ctrl-D moves down half a screen by default, although the amount it moves can be configured via the "scroll" option. :help motion....
8 votes
Accepted

Open file and scroll to bottom command line param?

The following works for me: vim log +$ The + bit tells vim to run a command after startup. The $ command moves to the last line in the file. Depending on your shell, you might need \ before the $ ...
  • 8,112
8 votes

keep same column when navigating by pages?

In addition to setting virtualedit=all, :set nostartofline
  • 5,964
7 votes

Scrolling down multiple lines with Ctrl+e

Ctrl+e takes count, so the quick and simple way is to create a normal mode mapping like the following: nnoremap <C-e> 10<C-e> This will simply do Ctrl+e 10 times. You can change the ...
  • 885
7 votes
Accepted

Console vim(x): Can I map the scroll wheel to undo--redo?

it works for me: set mouse=a map <ScrollWheelUp> u map <ScrollWheelDown> <C-R> But i hope this is just for fun. Must be horrible =)
7 votes
Accepted

Scrollback in Vim 8 Terminal

See the option termwinscroll as documented at :help terminal-normal and :help termwinscroll. 'termwinscroll' 'twsl' number (default 10000) local to buffer {not in Vi} {not ...
  • 12.9k
7 votes
Accepted

How to scroll in another window without switching to it?

scroll the view of the bottom window without switching to that window Something like this call win_execute(win_getid(winnr('j')), "normal! \<C-E>") winnr('j') returns Window number ...
  • 17.9k
6 votes
Accepted

How to keep the screen position from "zt" after switching buffer

TL;DR use autocommands, see the end of this post. Here's the result of the investigation I've made: Calling bn call the ex_bnext function which does two things: Go to the desired buffer via the ...
  • 15.3k
6 votes

Scroll a quarter (25%) of the screen up or down

You can use ctrle and ctrly to move the page by one line up and down. Then if you want for +/- 25% to be moved you can use 20ctrle and that will move you 20 lines down. Here is also a good explained ...
6 votes
Accepted

Can I scroll in vim with my touch screen?

Note: I have not tested this with gvim, only with normal vim This piece of code allows me to scroll instead of selecting text when I drag using my mouse. function! MouseScroll() "mark b is the ...
  • 333
6 votes

Why isn't this implemented by default in vim? (line by line Scroll)

*CTRL-D* CTRL-D Scroll window Downwards in the buffer. The number of lines comes from the 'scroll' option (default: half a screen). <b>If [count] given, first ...
  • 5,968
5 votes

Scrolling down multiple lines with Ctrl+e

As others have noted, you can prefix both <C-e> and <C-y> with counts, to "expose" that many more lines up or down. Another handy quick scrolling option lets you scroll so that the ...
  • 4,145
5 votes

How to scroll without forcing the cursor on screen (by letting the cursor off screen)?

I am used from other editors to use the cursor as a visual bookmark, so that after scrolling by letting the cursor off screen I can come back to its place later. If you're just scrolling through the ...
5 votes
Accepted

Visual scrolling/visual <C-e> and <C-y> across wrapped lines?

I've released a vim plugin that pretty closely matches this behavior. Instead of scrolling by exactly N lines, this maps <C-u>, <C-d> (half window) and <C-j>, <C-k> (quarter ...
  • 1,257
5 votes
Accepted

Can I use the mouse scroll wheel to browse the auto-completion popup menu?

Your examples work fine for me on Vim 7.4.1689 and Neovim. The following didn't work at first: set mouse=a Then I read the following in :h 'mouse' Enable the use of the mouse. Only works for ...
  • 6,420
5 votes
Accepted

Keeping context while scrolling

I would simply use :rightbelow split.
  • 2,599
5 votes

gvim Linux - GUI scroll without cursor shift

Vim doesn't remember where you've been in a file unless you made a change there (see :help changelist) or jumped there (see help jumplist). Also, Vim's cursor is always somewhere in a window, that is, ...
  • 5,964
5 votes

How to scroll in another window without switching to it?

I use the mouse for this. With set mouse=a I can scroll any open window from any mode (including normal mode). It’s not the purest solution, but it works very well for me.
  • 21.8k

Only top scored, non community-wiki answers of a minimum length are eligible