Vim-Airline + screen bug - vim

Sometimes, when switching between windows in screen, my vim gets messed up and e.g. my actual and shown cursor position don't match up (by 1 line), which is infuriating. I tinkered around a bit and its probably because of vim-airline being too long for the terminal. You can see the reason for my suspicion in the following image. Notice the orange rectangles in the lines below the airline. FYI, here is my minimized vimrc.
Switching tabs fixes the bug temporarily, but it's not a long-term solution.
I'd appreciate any help.

Related

Garbled text, copied lines in vim over ssh

I've had this issue often where if I compile vim myself on a server (due to lack of root permissions), at various times, I'll get garbled lines in vim when I have split windows. This is hard to describe, and thus hard to search for, as well.
Here's an image of a vim window. In each split is my .vimrc. Everything is good right now:
Now, I hit some in the right split to scroll down, and suddenly, we have garbled text and line 176 showing up everywhere:
This is not particular to any specific file. I've tried removing all my plugins, and the issue persists.
It turns out, the offending line was
set encoding=utf-8
in my .vimrc. I basically commented out my entire vimrc, and searched through until I realized this line was the issue, and I'm not entirely sure why.

Vim not updating lines in quickfix windows under under Cygwin

I have Vim 7.4 and it has a strange issue in a quickfix window when using Vim in Cygwin.
When moving downwards, everything if fine. When moving upwards, however, once my cursor is on the top of the window (not the top row), from then on every movement upward only updates the row one row below my cursor gets updated; the rest don't.
By pressing Ctrl+L and refreshing, the rest of the file gets updated properly. But the fix doesn't stay.
What is causing this and how could I fix it?
Facts:
TERM is xterm-256color
Mouse support works. This isn't quite relevant except it should demonstrate that vim, tmux and my terminal emulator are all configured fairly well in general.
This happens even with an empty .vimrc
The terminal emulator I am using is MinTTY
Trying to reproduce it doesn't work. It happens in my Tmux session with 10 tabs open. But when I try to open another MinTTY with Tmux, the issue doesn't happen
When trying to record the issue with Asciinema, the issue still comes up, but when looking at the recording, the issue is not seen there.
One of the symtoms are that while using Vim, sometimes the contents of the lowest row (tmux tabs) are copied to vim's lower statusline row until the next full redraw of the screen.

Flickering screen when scrolling in Gvim

So in vim all kinds of scrolling works perfectly, but in Gvim when scrolling screen flickers, especially noticable on faster scrolls like pgdn/pgup, Ctrl+U and Ctrl+D. Same thing when I scroll by dragging slider with mouse. I tried different background colors, but it does not make any difference.
Any ideas how to fix this?
Ask the developer(s) to make sure that a screen redraw is double-buffered.
I remember running into this years ago when I was using plain, non-antialiased X11 draw calls in Gvim (around version 6.0). In that case, the drawing speed was not-noticeable. When using anything anti-aliased, I could observe the flicker.
Obviously, the double-buffering is not necessary for the original terminal code and I'm assuming that the GUI updates are derived from the original terminal update code.
NOTE: This answer is only here for a reference for future development.
I have encountered similar problem in Gvim on windows. During scrolling bottom and top line flickers, it's even worse with e.g. 10j.
I have been able to eliminate it completely by adding lines in my .vimrc:
set lazyredraw
nnoremap <silent> j j:redraw<CR>
nnoremap <silent> k k:redraw<CR>
My current workaround is to use Vim-Qt, which is a fork of Vim with the GUI being based on Qt instead of GTK. Although it does have some shortcomings like lack of scrollbars, lack of maintenance (last commit 2 years ago), its advantage is that it doesn't flicker at all.
My fork of Vim-Qt now implements the scrollbars, so if you need them, you may want to try it instead of original Vim-Qt.

Block highlighting in vim

I tried to do syntax highlighting in vim, but I've got weird color highlighting letters on blocks. On black, it is not much of a problem, but when it's sunny blue, it's not readable, so I would prefer a light background.
~/.vimrc does not seem to respond to set background=light if there is no colorscheme.
I'm not very proficient with vim, and I think I might have turned on a function inadvertently, by accidental key strokes. Is there a way to turn off all kind of search and highlight?
I'm reading readmes, but this makes it difficult. The image below shows my screen.
I've heard about such incomplete screen updates occurring then the value of $TERM isn't right. Especially inside a screen / tmux session, be sure to have set the correct value (screen-256color in that latter case).
You could try GVIM (the non-terminal GUI version of Vim) to get moving with your work; it shouldn't have those issues.
I think I might have turned on a function inadvertently, by accidental key strokes
Fear not, any settings only persist by editing the ~/.vimrc file (or by saving a session). You'll always get a clean new instance by quitting and re-starting Vim.

Which default setting does make Vim very slow in Mac's Screen?

The problem is not solved although I accepted one answer.
Problem: Vim updates very slowly the screen in Screen in Mac, although lazyredraw and showcmd are off.
The line numbers get on the foldColumn as below, for instance, when I have line numbers
alt text http://dl.getdropbox.com/u/175564/vimScreenFold.png
When I have nothing in my .vimrc, the problem can be seen by multiplied comment lines on top of one another:
alt text http://dl.getdropbox.com/u/175564/vimScatteredBug.png
I did not type the following comment more than once on the left-hand side
"set list...
Observations
seemed to occur only in comment lines and empty lines. However, I got the evidence (2) which shows that this is not the case.
scatters occurs mostly in the left-hand-side window. They occur also with a single window. However, it is harder to detect with it.
The bug occurs slightly differently when I have nothing in .vimrc. However, the "stagnation" occurs in both situations: with empty .vimrc and with non-empty .vimrc.
Identification of Bug
Dependent variables
dependent on comment signs automatically put by Vim. I noticed disappeared pixels when Vim put Python's comment signs # automatically to my files, when it could not show the whole file.
dependent on at least OS/X Leopard.
Independent variables
file independent: occurs in all files edited by Vim
line independent: occurs in a Python code without comments and empty lines
.vimrc independent: occurs with empty .vimrc
.screenrc independent: occurs with empty .screenrc
shell independent: occurs with Bash and Zsh
Screen version independent: occurs with Leopard's default screen and with Screen 4.0.3
independent of different comment characters: occurs when scrolling down, for instance, .zshrc, .vimrc and .screenrc
How can you disable Vim's default settings?
I'm guessing that the issue might be with your termcap and terminfo settings. Try commenting those out from your screenrc, and restarting screen.
Also, what (non-virtual) terminal are you using?
Ah, it looks like you're using OSX's Terminal.app, which is exactly what I use (with screen/zsh/vim). /usr/bin/screen should work with /usr/bin/vim with an empty .screenrc and .vimrc by default.
% touch empty_screenrc
% cat empty_screerc
% /usr/bin/screen -c empty_screenrc
#...and within screen
% /usr/bin/vim -u NONE
If the problem still persists, the problem may be in your shell. But if this fixes the problem, I'd suggest posting your ~/.vimrc to aid in further diagnosis.
I think that the OS X default version of screen does not support 256 colors. You can set vim to use a lower number of colors in your .vimrc file:
set t_Co=16
On Mac OS X you can rebuild screen to use 256 colors, see here: http://pjkh.com/articles/2008/07/09/osx-iterm-screen-vim-256-colors.
Here's the short version of the instructions:
Rebuild screen making sure to include the 256 colors option:
./configure --enable-colors256
Then you will need to add the following to your ~/.screenrc:
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
attrcolor b ".I"
# tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
# erase background with current bg color
defbce "on"
Source
I have no plugins and nothing in in .vimrc and .screenrc.
The problem still persists.
Identification of bug
file independent: occurs in all files edited by Vim
The "stagnation" seems to occurs mostly in comment lines and empty lines.
However, the bug occurs also without comments and empty lines, but the impact of it seems to much smaller.
Picture for the observation 2
alt text http://dl.getdropbox.com/u/175564/cruxMoveInVimScattered.png
I had this problem (just painfully slow) and it ended up being the Consolas font I was using in Terminal.App and ITerm. In my case switching to the Monaco sped things up considerably.
Crux move: the bug seems to occur because some of Vim's default options cause the problem
I use my default configs in .vimrc and .screenrc now, since I observed that they do not cause the bug.
The bug seems to be slighly comment and empty line dependent.
I got an evidence of it.
I have no comments and no empty lines in my Python code. However, I noticed that when Vim cannot show full lines, it puts comment marks to my code. For example, notiche the three # -marks, which Vim put there.
This caused the disappeared pixel.
alt text http://dl.getdropbox.com/u/175564/pythonBug.png
The bug seems to occur in the same file when I cannot see the comment signs automatically put by Vim.
alt text http://dl.getdropbox.com/u/175564/counterExample.png
I duplicated by purpose the code for the picture such that you can see the disappered pixels clearly.
I noticed once when I was playing with the Python code that the "stagnation" occurred greatly after I put a single empty line to the code. However, I have not managed to duplicate the event.
Unsuccessful Attempts to solve the bug by .vimrc
to disable comments signs set automatically by Vim
set formatoptions-=c
It looks like there are some known issues relating to wrap mode for OS X, see number 1. here. It suggests a workaround.
I've had similar problems with irssi and bash, which were caused by colour codes not closed correctly..
Have you tried a different vim theme (specifically the default one), or running :syntax off ?
Debugging:
One suggested me to freeze my terminal from the changes of other applications by
ttyctl -f
However, it did not seem to solve the problem.
Nevertheless, it may help us to find the bug, since we do not have other apps changing the situation now.

Resources