dondd@hpmwtd.HP.COM (Don Dillon) (02/09/90)
This is a question concerning 'vi' Is it possible to map some keys such that they would act just like the h-j-k-l cursor movement keys, but would move the cursor while in the insert mode? Maybe its already built into the editor and I'm missing this feature in the documentation, but I'll be darned if I can find any reference to it at all. What I would like is to add into my .exrc file something like this ( where 'xxx' is what I'm looking for ) : # # map the cntl-h key to move cursor left while in insert mode # map ^H xxx # # map the cntl-j key to move cursor down while in insert mode # map ^J xxx # # map the cntl-k key to move cursor up while in insert mode # map ^K xxx # # map the cntl-l key to move cursor right while in insert mode # map ^L xxx # # I would appreciate any help at all, thanx. Don Dillon INTERNET : dondd@hpmwetg HPDESK : Don Dillon /HP5700/UX TELNET : 577-2869
maart@cs.vu.nl (Maarten Litmaath) (02/10/90)
In article <5220001@hpmwetg.HP.COM>, dondd@hpmwtd.HP.COM (Don Dillon) writes: \... Is it possible to map some keys such that they would act just \like the h-j-k-l cursor movement keys, but would move the cursor while \in the insert mode? [...] ----------8<----------8<----------8<----------8<----------8<---------- map! ^H ^[i map! ^L ^[la map! ^K ^[kli map! ^V ^[jli ----------8<----------8<----------8<----------8<----------8<---------- ...where ^X stands for control-X (^[ is escape). If you want to enter a control character literally, in vi you have to precede it with ^V. \... \# map the cntl-h key to move cursor left while in insert mode \... In a .exrc file a comment is introduced with a `"' instead of a `#'. Followups to comp.editors. -- The meek get the earth, Henry the moon, the rest of us have other plans. | Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart
dondd@hpmwtd.HP.COM (Don Dillon) (02/10/90)
Thanks to everybody that repsonded via email, everyone came up with the same answer, which is shown below. Unfortunately, it can't be entered into a file,(or at least I haven't been able to with Vi. The '^J' can't be heald in the file because it always performs a line feed when typed, even when preceeded with a '^V'. Is there any way of putting a cnt-j into a file without it being interpreted as a line feed? # # map the cntl-h key to move cursor left while in insert mode # map! ^H ^[i # # map the cntl-j key to move cursor down while in insert mode # map! ^J ^[ja # # map the cntl-k key to move cursor up while in insert mode # map! ^K ^[ka # # map the cntl-l key to move cursor right while in insert mode # map! ^L ^[i # # Don Dillon INTERNET : dondd@hpmwetg HPDESK : Don Dillon /HP5700/UX TELNET : 577-2869
maart@cs.vu.nl (Maarten Litmaath) (02/13/90)
In article <5220002@hpmwetg.HP.COM>, dondd@hpmwtd.HP.COM (Don Dillon) writes: )... Is there any way of )putting a cnt-j into a file without it being interpreted as a line feed? As I showed in my previous posting: map! ^V ^[jli Sic! -- The meek get the earth, Henry the moon, the rest of us have other plans. | Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart