I am currently employed by a company that runs it’s development environments on a Solaris 10 server, and I often work on that machine’s shell over SSH. Often I want to use an editor directly on that machine (because that’s convenient), and my preferred editor is Vim. In my case the server had Vim 6 installed and I wanted to use Vim 7.3 (the latest version at the time of this writing), because some of my favorite Vim extensions require Vim 7.
Assuming that you have access to gcc and gmake it’s easy to install Vim in your home directory. For this article I’ll provide examples using bash, if you’re using another shell your command syntax and the preference files you need to edit will likely be a little different. To get started simply download the source from vim.org, uncompress it and go into the resulting directory and use the following commands:
- ./configure –prefix=/path/where/you/want/vim
- gmake install
Once that is done simply modify $HOME/.profile to include /path/where/you/want/vim at the start of your $PATH so that your local install of Vim is used before the system version (if there is one). To immediately be able to use Vim (without having to do a fresh login to get your $PATH setup) you can enter the command “export PATH=/path/where/you/want/vim:$PATH” after which you can enter “vim” to start Vim :)
The main application that we develop on has shell components and web components, and the shell components require us to use xterm emulation. The xterm emulation on Solaris doesn’t provide colour support however, and when you start using Vim you’ll notice that you have grey tones only. If you don’t require xterm you can use sun-color instead (setting the $TERM to sun-color will enable that). If you do require xterm then the simplest way to resolve this is by taking the xterm definition from another machine that does support colours (per example from a Linux box), you can do so with the following steps:
- On the source machine for the terminal definition use the command “infocmp > xterm_def”.
- Save the file xterm_def on the Solaris machine and continue from there
- Create a directory in your home directory to hold the terminal definition: mkdir -p $HOME/local/lib/terminfo
- Edit your $HOME/.profile and add “TERMINFO=$HOME/local/lib/terminfo”, to continue without reloading your profile enter “export TERMINFO=$HOME/local/lib/terminfo”
- Use the command “tic xterm_def” in the directory where you saved xterm_def to import the terminal definition
Start Vim and should see colors :)