Customizing vim and coloring the terminal in OpenSolaris 2009.06
I have been using Sun’s Solaris (and now OpenSolaris) for years now. In fact while some of you can probably go as far back as the SunOS days, the first Solaris operating system that I worked on was Solaris 8. The company that I was working for had some older SPARC server/client nodes. They had conformed to the mindset of, “if it isn’t broken, why fix it?”
During this time I had already grown extremely comfortable with GNU/Linux. Especially when it came to the text editor tools. I have always been a fan of vim (vi improved); but when I would hop from one platform to the other, I always found myself getting stuck with the way Solaris and now, OpenSolaris default their environment.
By stuck, I mean trying to get used to their command line interface in general. The shell used to always default to the traditional Bourne Shell (/bin/sh) and not the Bourne Again Shell (/bin/bash). While this could always be customized under the user’s profile in the /etc/passwd file, I am glad to see that at least in OpenSolaris this has been changed. Now the terminal defaults to bash. Although I do not know if this will carry over to Solaris 11.
That is why as soon as a new Solaris/OpenSolaris installation is completed, I append the following additions to my my ~/.vimrc and ~/.bashrc files:
.vimrc
syntax on |
.bashrc
export TERM=xterm-color |
Note that sometimes (if it doesn’t already exist) you may have to create the .vimrc file. What these settings do is enable the ruler and syntax highlighting while also adding some necessary color to your terminal environment. This will aid in differentiating between file types from normal listings of directory contents while also color coding scripting and other code-like syntax.
To add some more customization, I will even append certain key binding because for some odd reason Sun has never implemented them in their terminal. For example, the Delete, Page Up and Page Down keys (still working on figuring out Home and End; although same results can be obtained with CTRL+A and CTRL+E). The delete will perform a delete of the characters on the prompt while the page up/down keys will page through your recent history. You would append the following to the .bashrc file:
# delete key |
These features help me get started and as I use the system more, usually more will get added to these configuration files.
