Questions tagged [scrolling]

For questions about scrolling, and configuring the behavior of vim-scrolls

Filter by
Sorted by
Tagged with
38
votes
3answers
2k views

How to disable horizontal scrolling?

I have some concealed characters in the buffer and horizontal scrolling kills the alignment big time. Is there any way how to disable it? I could not find any relevant options. Edit: Demo added. You ...
26
votes
4answers
11k views

How do I center the current line in the screen?

Is there a way to center the line I'm editing in the screen? This is sometimes needed to see a bit more context above and below the current line.
24
votes
1answer
4k views

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

I want to open up two different parts of a document in horizontal splits (using :sp) and scroll both of them left and right together. For vertical scrolling, you would use scrollbind. However, I'm not ...
22
votes
3answers
11k views

Scroll the screen, not the cursor, when using scrollwheel

I'm using Vim in a terminal, so scrolling with the scroll wheel uses the \e[A and \e[B syntax (where \e symbolizes \x1b, or escape). However, Vim interprets this by moving the cursor up or down a ...
17
votes
4answers
7k views

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

I often find scrolling a full page too disorienting, half a page too much, but a quarter page is just right. I currently do it just by holding down the arrow keys. How do I scroll 25% of the page ...
17
votes
2answers
7k views

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

In Vim, I don't like how when you reach end of file it puts the last line at the bottom of the screen. Is there anyway to make the last line be something like 10 lines above the bottom of the screen ...
14
votes
1answer
3k views

Why are my windows scrolling together?

I have two windows open on the same buffer and I want to edit two parts of the same file at the same time. I can't because the windows are scrolling together. I have noscrollbind set so I am ...
11
votes
2answers
607 views

Scrolling issues when the `wrap` option is set

I find myself dealing with this issue every time the wrap option is active (in my particular case whenever I'm working with markdown files). What happens is that, while scrolling up and down the ...
10
votes
1answer
2k views

Turn off synchronous scrolling not caused by either scrollbind or diff

I have a file that has decided to scroll synchronously when I open it in a second window and start scrolling. scrollbind and diff are set to off. (:set scrollbind? prints noscrollbind and :set diff? ...
10
votes
3answers
3k views

How can I use my trackpad for horizontal scrolling?

I just noticed that my trackpad scroll works in Vim, inertia and all. I'd like to change this to work horizontally - so I can scroll up and down to make the cursor move left-and-right instead of ...
8
votes
1answer
2k views

Open file and scroll to bottom command line param?

I'm new to vim. I want to open vim from command line and have it scroll to the bottom of a file automatically. The use case is opening logs. Typically I open vim "vim log" and then scroll down ...
8
votes
1answer
1k views

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

This has been asked on stackoverflow before, but it seems it still has no solution. Perhaps that has changed with Vim 8.0. I'd like to be able to scroll (i.e. scroll-wheel, or <C-y>/<C-e> ...
7
votes
3answers
661 views

How to make horizontal scrolling easier when the cursor is not ideally located?

For easy horizontal scrolling in long lines, I use these mappings that work well for me: map <m-[> 20zh map <m-]> 20zl Something that has always annoyed me is when the following use case ...
6
votes
3answers
982 views

align/spread file content in vertically split windows

I have a single buffer open across multiple vertically split windows and all the windows have scrollbind set. However, before setting scrollbind, I had to scroll down in second window in order to make ...
5
votes
1answer
309 views

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

I like using Ctrl-f and Ctrl-b to "page-up" and "page-down", but I was wondering if there was a way to do that without losing my current position in a row? For example, I like to work with tab-...
5
votes
1answer
1k views

Scrollback in Vim 8 Terminal

Been really loving the asynchronous terminal in Vim 8. Sometimes I have a large amount of output in the terminal, and when I enter normal mode in the terminal and use gg to go to the top, I see that ...
5
votes
2answers
144 views

Keeping context while scrolling

Suppose I have a very long file, for example: class X { // ... void foo() { // ... if (something) { a00(); a01(); a02(); // ... ...
5
votes
2answers
137 views

To pageup and pagedown without reserved lines

When I scroll a whole page up by ctrl-f, and down by ctrl-b, vim reserves 2 lines, and repeats them both in the previous GUI window and the present one. But I expect it not to repeat lines, because ...
5
votes
1answer
676 views

Can I scroll in vim with my touch screen?

I frequently use gvim on a windows 7 computer with a touch screen. If I flick up or down with the touch screen, it creates a selection (in S mode, not V mode). I'm not really a fan of this default ...
5
votes
2answers
813 views

How to prevent Vim from scrolling buffers when I open split

When I open a new split Vim is scrolling both buffers up despite having enough space. Here is an asciicast This behaviour comes out-of-the box in vim -u NONE. It is really annoying. My guess it ...
4
votes
2answers
742 views

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

Very often, my preferred way of navigating a file in vim is by "scrolling" line by line. By scrolling, I mean shifting the lines up/down while keeping the cursor on the same line and ...
4
votes
0answers
107 views

How to scroll back in the output of the last Ex command after pressing `g<`?

From :h g<: The g< command can be used to see the last page of previous command output. This is especially useful if you accidentally typed <Space> at the hit-enter prompt. You are ...
3
votes
4answers
620 views

How to scroll in another window without switching to it?

There is a keybinding in Emacs that lets you scroll in another window that you're not currently working on (C-M-v to scroll-other-window-down and C-M-V to scroll-other-window-up). For example, in a ...
3
votes
2answers
363 views

keep same column when navigating by pages?

<c-d> and <c-u> both, by default, drop you in the first non-whitespace column of the given row. This behavior is kind of distracting when quickly scanning through pages. Is there a way to ...
3
votes
3answers
513 views

How to [[ to top of function and see function name on first line of screen

This is for C coding, but would apply to editing many languages. I often use ctags or lately cscope to jump around, and find I often need to quickly check or learn what function I am in. A great tool ...
3
votes
1answer
272 views

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

It's sort-of a follow to a recent XKCD. I want to know whether it's possible to map the scroll wheel to undo and redo, possibly n undos/redos per scroll? I'm using mate-terminal in MATE 1.6.x, bash, ...
3
votes
1answer
627 views

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

Is is possible to use <ScrollWheelUp> and <ScrollWheelDown> while the auto-complete popup is open? I tried using the map inoremap <expr> <ScrollWheelUp> pumvisible() ? "<Up&...
3
votes
1answer
479 views

How to keep the screen position from “zt” after switching buffer

When I use zt to scroll the screen relative to the cursor and then switch buffers with, say, :bn followed by :bN, the screen jumps back to the position before executing zt. Using for example ctrl-d ...
3
votes
2answers
860 views

Scroll view up or down while in insert mode

I really like Ctrl-E and Ctrl-Y in normal mode, which expose additional lines at the bottom or top of the screen (respectively) without moving the cursor. I'd like to do the same thing in insert mode ...
3
votes
1answer
169 views

How to keep cursor vertically aligned to center even at the end of buffer?

I would like to keep my cursor centered vertically as I type away in insert mode even when I reach the end of the buffer I am editing (at which point I would like the virtual lines starting with ~ to ...
3
votes
2answers
100 views

How do I map H and L to scroll by one screen if the cursor in already on the top line or bottom line

Basically map H and L based on the cursor positon. If I press H the cursor should go to top of the screen and if I press H again I want to scroll up by one page.
3
votes
1answer
592 views

Show / hide horizontal scrollbar depending on “wrap” option

I'm trying to show / hide horizontal scrollbar conditionally, depending on wrap option: with wrap - show horizontal scrollbar with nowrap - hide Here is what I tried, but for some reason it doesn't ...
3
votes
2answers
1k views

Vim keep last line at bottom of buffer

I need to configure Vim in such a way that it has a normal scrolloff of 3 or 5. But in such a way that it keeps the last line at the bottom of the screen. I don't want that as I scroll, the last lines ...
3
votes
1answer
246 views

How do you page through the jump list?

With the :jumps command, you can display the list of jump locations to aid navigation. That is you can use CTRL_O and CTRL_I to jump backwards and forwards respectively. However, my jump lists appear ...
3
votes
0answers
90 views

Can I disable sidescrolling altogether? [duplicate]

If some characters are concealed in a line, so that the effectively the entire line is visible, and nowrap is set, moving to the end of the line can cause Vim to scroll if the actual line length is ...
3
votes
1answer
387 views

Stray characters when scrolling in gvim

When scrolling with the mouse wheel, characters will often duplicate themselves on subsequent lines. For instance, if I'm scrolling down, I can sometimes see an open brace on its line and on the ...
2
votes
2answers
730 views

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

I really like how the less pager uses w to scroll up and z to scroll down since they are single keys, in vim I have to use CTRL+d/CTRL+f to get the same effect. Having to hold ctrl is a bit of a ...
2
votes
1answer
211 views

Bottom Padding In Vim?

My (n)vim window looks like this: Line 91 is the end of the document, and it's flush with the document name at the bottom (essentially the bottom of the screen). How do I "move" that line ...
2
votes
2answers
57 views

View lines above and below current cursor

Is there a way to get 10 lines above and beneath the current cursor? Similar to set scrolloff=10 but I only want to do it ONCE, not change the setting... Clarification: I want at least 10 lines. If ...
2
votes
1answer
269 views

zt for horizontal scrolling

I love the keybindings zt zb and zz. They redraw the current window such that your cursor stays at the same place in the document, but it moves on your screen. The cursor will now be at the top, the ...
2
votes
1answer
429 views

Make ctrl-j and ctrl-k work like they do in less?

I would like to use ctrl-k and ctrl-j to not only move the cursor up or down (by lines), but also to scroll the portion of the document that is visible. Effectively, leave the cursor where it is and ...
2
votes
1answer
123 views

continue buffer in new window

Let's say that I have a file which contains numbers from 1 to 200. Each number is on a separate line. As I have a wide screen, then I view this file in a way that I vertically split the window(Ctrl + ...
2
votes
1answer
81 views

Can you scroll the window in interactive substitute mode?

I am using an interactive substitution that spans multiple lines. In order to determine whether each particular occurrence should be replaced, I need to see all lines that are included in the search ...
2
votes
1answer
365 views

Scroll without changing the cursor position

Frequently when using vim I will hit a case where I am looking at a function that is half off the bottom of the screen, and I would like to see the whole thing. ctrl-D will generally solve the problem ...
2
votes
1answer
147 views

Showing lines above beginning of document

Editing at the top or bottom of the screen is uncomfortable, so why use zz all the time (also scrolloff). That works fine in the middle of the document, and in the end, and I can keep the cursor ...
2
votes
1answer
357 views

How move current line to top of the window with `scrolloff` set

I want to scroll the current line to be the topmost line in the window, even with scroloff set. How do I do this? I want to use it with: com! TestColours :echo "Please wait..." | :so /usr/share/vim/...
2
votes
1answer
66 views

Keeping the window filled with the document

I would like to make Vim behave a little more like the less(1) pager: if I scroll to the bottom of the document (e.g. using Ctrl-F), I want the last line of the file to be displayed at the bottom of ...
2
votes
0answers
200 views

Flicker during scroll in single window?

If I run vim without tmux in urxvt v9.22 or xterm 330, it flicks after a full screen scroll. $ seq 1000 >test $ vim --clean test execute G or /13$ and nnnnnnn, you should see it flickers. If you ...
2
votes
0answers
27 views

Can I trigger a command when the status bar shows up or hides?

I'm using set laststatus=1 so the status bar is only visible when needed, e.g. to display file names when multiple splits are open. However, when the status bar shows up, the existing buffer seems to ...
2
votes
0answers
42 views

Remove 'jumps' when moving to last and first line in Vim [duplicate]

I have the display option set to lastline so that the last line is shown even if all it doesn't fit on the window. When moving down visual lines with gj to the last line that is only partially visible,...