Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.
52 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 ...
user avatar
  • 10.3k
29 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 ...
user avatar
  • 2,818
28 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 '...
user avatar
  • 45.9k
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 ...
user avatar
  • 45.9k
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 ...
20 votes
Accepted

Scroll the screen, not the cursor, when using scrollwheel

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

How do I center the current line in the screen?

Type zz to center the current line in the screen:
user avatar
  • 2,433
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'.
user avatar
  • 32.6k
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.
user avatar
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....
user avatar
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 $ ...
user avatar
  • 7,992
8 votes

keep same column when navigating by pages?

In addition to setting virtualedit=all, :set nostartofline
user avatar
  • 5,854
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 =)
user avatar
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 ...
user avatar
  • 12.6k
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 ...
user avatar
  • 15.5k
6 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 ...
user avatar
  • 875
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 ...
user avatar
  • 15k
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 ...
user avatar
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 ...
user avatar
  • 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 ...
user avatar
  • 5,868
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 ...
user avatar
  • 4,005
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 ...
user avatar
  • 1,247
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 ...
user avatar
  • 6,320
5 votes
Accepted

Keeping context while scrolling

I would simply use :rightbelow split.
user avatar
  • 2,564
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, ...
user avatar
  • 5,854
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.
user avatar
  • 20.7k
5 votes
Accepted

Bottom Padding In Vim?

You may be looking for zz, zt, and zb—they center (or move to the top, or to the bottom) the current line on the screen.
user avatar
  • 20.7k
4 votes

Scrolling issues when the `wrap` option is set

I think you are looking for: set display=lastline See :help 'display'.
user avatar
  • 32.6k
4 votes
Accepted

Vim scroll window like in less pager (with single key)?

If you are not a member of the clan of arrow keys haters, and if your distribution provider didn't screw up your termcap / terminfo database, the PgUp and PgDown keys should work just fine. And so ...
user avatar
  • 3,568

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