vi colors

When I edit a text file in vi, I find it much easier to read if the syntax is color highlighted. There are 2 steps to enabling this. First, add an alias for vi (or vim) to your ~/.bashrc file as follows:

#
# Enable color support for vi
#
alias vi='TERM=xtermc vim'

You can read the gory details about why this needs to be done in bug 1641 - xterm terminfo entry doesn't support color.

You also need to tell vi to use syntax coloring. Adding the following to your ~/.vimrc file (create one if it doesn't yet exist):

syntax on

Much nicer:



Comments:

Yes, it works, but unfortunately it messes up Midnight Commander, and I have to set it up back to "xterm" any time I need to call mc.

Posted by shmerl on October 08, 2009 at 01:28 PM GMT #

OK. The updated solution using an alias should solve that problem.

Posted by Brian Leonard on October 08, 2009 at 04:51 PM GMT #

nice

Posted by guest on October 19, 2009 at 04:51 PM GMT #

Great, thanks.

Posted by Carlo Hamalainen on March 02, 2010 at 08:19 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today