Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Aug 1996 16:25:55 -0400 (EDT)
From:      Bill/Carolyn Pechter <pechter@shell.monmouth.com>
To:        andrsn@andrsn.stanford.edu (Annelise Anderson)
Cc:        FreeBSD-questions@freebsd.org (FreeBSD-questions)
Subject:   Vi and arrow keys
Message-ID:  <199608182025.QAA08194@shell.monmouth.com>
In-Reply-To: <Pine.BSI.3.94.960818121114.1705A-100000@andrsn.stanford.edu> from "Annelise Anderson" at Aug 18, 96 12:21:02 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Actually, there's a .exrc file in Unix Power Tools that works like magic
and allows cursor use on vt100/ansi type terminals when used with vi.

The main tip looks like this... map <ESC>[A (cursor up ansi) to
<ESC> (end insert) i k (cursor up -- vi command) a (append -- vi command).
You can do this for all the possible (up, down, left, right...
as follows...)

It seems to work in command mode with all vi's.  Sometimes it seems to
have problems with some systems... I'm writing this on a BSDI box where
it doesn't seem to work in insert mode...

(You DO need to do this for YOUR Terminal type.  This should work for all
ANSI terminal types).

Here's a short piece of the .exrc I'm using which is hacked from the Unix
ower Tools book.

I recommend the book highly and think anyone working with Unix admin
keep a copy handy for tricks and pointers as to how efficiently do
neat Unix stuff...

(Unfortunatly, the CD does NOT install directly from the ibcs2 i386 SCO
compiled stuff to FreeBSD 2.2-current with ibcs2.  The perl on the disk
chokes on FreeBSD).

""
"" Map ctrl-h, ctrl-j, ctrl-k and ctrl-l to to move the cursor during
"" test-input mode, just as the commands h, j, k, and l do in command mode.
map!  i
map!  ka
map!  la
map! 
 ja
" Note: the two lines above map ^J (LINEFEED)
"
"
" For VT100 Terminals
"
set ai redraw showmode wm=1
set tabstop=4
set shiftwidth=4
"" cursor down while inserting
map! OD ha
map!  ha
"" vt100 up arrow while inserting
map! OA ka
map!  ka
"" cursor left while inserting
map! OB ja
map!  ja
"" cursor right
map! OC la
map!  la
""



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608182025.QAA08194>