On some Linux machines, when I use vim, I can use PageDown, PageUp, Home, End button nicely without any troubles. However on some other machines, these buttons give me funky characters.
Why is that, and what can I do?
Thanks!
|
|
I assume that you are running vim in a terminal rather than the GUI version, gvim. Different terminals send different characters or sequences of characters to the applications running in them when the user types a motion key such as PageDown. To determine the set of characters or character sequences that the current terminal is sending to represent those keys, Vim consults the terminfo database. It uses the TERM environment variable to determine the type of the current terminal, then accesses the terminfo definitions of those keys used by that terminal. If the key definitions for the current value of TERM match the capabilities of your current terminal, everything works fine. If the value of TERM is incorrect for your terminal, or if the terminfo database is incomplete or missing, Vim doesn't know how to interpret the characters or character sequences sent by your terminal so it just inserts the characters into your text or interprets them as Vim commands. The most likely cause of the problem is that TERM is not set correctly for the terminal you are using. The most straightforward fix is to find out what kind of terminal you are using, find the terminfo name for it in /usr/share/terminfo or /usr/lib/terminfo, and put a line like this in your ~/.bashrc:
For example,
|
|||
|
|
My first guess is that on some Linux machines, you're running in "nocompatible" mode which enables a lot of extra Vim features including the arrow keys and such, but the ones where the keys don't work you're not. Vim automatically goes into "nocompatible" mode when you have a ~/.vimrc, but some distributions install a system vimrc that sets the 'nocompatible' option, even without a ~/.vimrc. See:
(With the single quotes.) |
|||
|