0

I recently moved from Ubuntu to WSL Ubuntu, and the only problem with the move seems to be how Vim displays in the terminal.

For example, I open a file in vim, and after exiting back into the command line, if I scroll up, I see the first line of the file I just exited: screenshot of problem

The problem compounds as I open and exit more files with vim. In fact, in every file I open with vim (after the first one), scrolling up also reveals the first lines of the previous vim sessions, just like in the command line: screenshot of problem

That was the result of scrolling up after opening my vimrc the second time.

The problem gets even worse if I do something like enter visual mode, select a block of text greater than the size of the terminal, and yank: screenshot of problem

In this case, the entire selection that was yanked is visible if I scroll up.

Here is a copy of my vimrc (without most of the comments, user-defined commands, and plugins) in the hopes that someone can help me fix this problem. The problem is unique to the Windows Terminal, and the terminal emulator being used is xterm-256color.

2
  • How are you scrolling - using arrow keys or ijkl? – cup Sep 7 '20 at 8:06
  • The error can not be produced by scrolling using keybindings in vim since they don't go farther up if you hit the first line of the file. But in the Windows Terminal, I am able to still use the scroll bar in vim and in the command line, and using that is how I saw all of those problems. – General Poxter Sep 8 '20 at 12:33
0

In order to disable the Windows Terminal Scrollbar

  1. Click on the ubuntu icon
  2. Select properties
  3. Select the layout tab
  4. Set the height and width of the screen buffer to the same value as the window size.

That will disable the scrollbar completely and you should be able to use normal linux command line scrolling.

Edit

Properties

Layout

In this picture, the screen buffer height and window size height are different. If they are both set to the same value (say 25) then the scrolling problem will disappear.

9
  • Can you be more specific? In the settings doc for the windows terminal, there's a profile for Ubuntu. What exact properties should I set? – General Poxter Sep 9 '20 at 15:41
  • Select the layout tab - you will see the screen buffer and window size. – cup Sep 9 '20 at 20:54
  • There is no layout tab. – General Poxter Sep 14 '20 at 14:35
  • I've added pictures to indicate where the layout tab is. – cup Sep 14 '20 at 15:53
  • Oh that's the Ubuntu App, not the Windows Terminal. – General Poxter Sep 15 '20 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.