Thursday, June 14, 2007

Solaris vi Defeated: Part 1

I'm finally making some headway in my downgrade from Linux to Solaris. The biggest productivity killer has been learning to use vi. Don't get me wrong... I've been using vi for over a decade. The problem is that the version used by Solaris is so old that it is missing all but the most basic of functionality.

What has frustrated me the most is that if you strike an arrow key to navigate while in the insert mode, it spluges letters on the screen. This is terminal emulation problem. Solution:
From bash: export TERM=ansi

Next, the annoyance of not knowing whether you're in insert or command mode. This can be fixed with a set option. Solution:
From bash: alias vi='vi +"set showmode"'

(I also chose to implement ignorecase.)

These items will, of course, be lost on exit from the session. I've added these lines to my user's .profile, which gets sourced at login.

It would be nice to be able to map the , , , , , and keys, but I haven't found thier translations yet. I found the function keys:
map #1 :set nu[crtl]-[v][enter]
map #2 :set nonu[crtl]-[v][enter]

Upon pressing F1, the system displays line numbers. In order for the sequence to be automatic, we have to add an "Enter" sequence. This is done by pressing and holding the "Control" key, tapping the letter "V", followed by "Enter". It displays as ^M.

The map and set commands could also be issues on a per session basis, but would be better stored in ~/.exrc.

No comments:

Post a Comment