Reset terminal after quitting VIM -- colors all messed up
Solution 1
I was having a similar problem with Vim + GNU Screen + Terminal.app. Here was my solution:
Create a script called resetcolor:
#!/bin/bash
echo -ne "\033[0m"
Put this script in your PATH.
Then within ~/.vimrc, add the following:
au VimLeave * !resetcolor
Based on this answer.
Solution 2
Since the reset
command should have reset all terminal settings, including color, I'm thinking that your terminal software is bad, and is therefore also probably responsible for the color bug in the first place.
(This, of course, assumes that your TERM environment variable is set to an appropriate type for your terminal software.)
Solution 3
Make sure your TERM environmental variable is correct for your terminal emulator software. People often set it to arbitrary values that seem to work without realizing that it can cause them problems.
Related videos on Youtube
davidu
Updated on September 17, 2022Comments
-
davidu over 1 year
Whenever I quit VIM my terminal colors are all messed up. Manually running
reset
on the command line doesn't seem to fix it either.I'm using the Mustang VIM theme. I think I basically need to tell VIM to reset all colors or something before it quits.
Any ideas?
-
Admin over 13 yearsWhat terminal software? What is your
$TERM
? -
Admin over 12 yearsIt's set to xterm-256color
-
Admin over 12 yearsA screenshot could help to better explain the problem.
-
-
davidu over 12 yearsI think a combination of this answer and @Heptite's are about right. The term software (iterm2) has had some major revisions and the issues have all seemed to go away.
-
n.st over 8 yearsYou can just add
au VimLeave * !echo -ne "\033[0m"
to yourvimrc
, without having to create an external script. -
sapht almost 7 yearsVim may have drawn over the bottom line if you use a background color, which your prompt will only replace the first part of, replace with
!echo -e "\033[0m"
to fix (prints a newline after clearing bg color)