History
Article Edit this page Discussion

Change colors when switching to other directory

From Vim Tips Wiki

Jump to: navigation, search

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?


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Doctor Who
Legend of Zelda Wiki
Terminator Wiki
Everquest II Wiki
Mystery Science Theater 3000
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Change colors when switching to other directory"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation