Change colors when switching to other directory
From Vim Tips Wiki
Tip 1378 Previous Next Created: November 3, 2006 Complexity: basic Author: Bertram Scharpf Version: n/a
When editing files in two different directories, for example when copying parts of code from one into the other, you may change the color scheme to quickly identify the directory of the current file:
:autocmd BufEnter * if match(@%,'/otherdir/')>=0 | colorscheme oceanblack | else | colorscheme inkpot | end
This does not work very well for split windows.
See :help registers for information on @%.
[edit] Comments
"This does not work very well for split windows." - maybe try BufWinEnter instead of BufEnter?
