Vim Tips Wiki
Advertisement
Tip 1378 Printable Monobook 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 @%.

Comments

"This does not work very well for split windows." - maybe try BufWinEnter instead of BufEnter?


Advertisement