I’ll try to keep this short. I’m using Xubuntu 8.04.1 + vim 7.1.138. (Xfce4-terminal is version 0.2.8).The problem: If you have the lines and columns options set in your .vimrc file for gvim‘s default window size upon startup, you run into a strange graphics glitch if you attempt to run simple console vim inside xfce4-terminal. What you type does not get displayed, and a new line appears after every keystroke, deleting the previous line — although the data of what you typed in is still there. It is the same problem discussed here. I encountered this problem while executing the git commit -an command from xfce4-terminal, when git resorted to vim as the default text editor. (NOTE: You might need to edit xfce4-terminal’s default window size in ~/.config/Terminal/termnalrc (the MiscDefaultGeometry option) to reproduce the glitch — I had mine set to 80×19).
The solution: Make the lines and columns options in .vimrc dependent on the “gui_running” variable, like so (copied from here):
if has("gui_running") "GUI is running or is about to start. "Maximize gvim window. set lines=69 columns=100 " if we're in console Vim, then we just want to leave the window size alone -- " let it simply be whatever the window size of the terminal is before vim is " launched "else " "This is console Vim. " if exists("+lines") " set lines=69 " endif " if exists("+columns") " set columns=100 " endif endif
This works. You do not get the strange graphical glitch behavior described above, by making vim only resize the window if it is gvim, and not console vim. I have commented out the console vim settings because, as stated above, I already have a default window size of 80×19 for xfce4-terminal.
Note: If you use xterm, it doesn’t matter — even if you don’t have the special “gui_running” option in your .vimrc, console vim will work properly. So run git commands in xterm if you don’t like xfce4-terminal.