Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!psuvm!blekul11!ffaac09 From: FFAAC09@cc1.kuleuven.ac.be (Nicole Delbecque & Paul Bijnens) Newsgroups: comp.editors Subject: Re: vi Alternative Required Message-ID: <90355.114904FFAAC09@cc1.kuleuven.ac.be> Date: 21 Dec 90 11:48:04 GMT References: <25267@adm.brl.mil> <111331@convex.convex.com> Organization: K.U.Leuven - Academic Computing Center Lines: 41 In article , em@dce.ie (Eamonn McManus) says: > >In comp.unix questions tchrist@convex.COM (Tom Christiansen) writes: >>:Has anyone got a set of 'map!' commands that implement arrow keys in >>:'vi' Input mode? >> >>Yes, I've mailed Richard a uuencoded copy. I posted it very recently in >>comp.editors, so don't think I should post it again here. > >As I (apparently) never tire of pointing out, it's not possible to get >arrow keys to work correctly using map! commands, though you can certainly >get better behaviour than what happens if you don't map them. :-) > >You're likely to get your novice users coming in and saying `Why does it >move diagonally when I do up-arrow at the start of a line?' You can certainly use map! commands for arrow-keys. But you need to be consistent with text-mode vs. command-mode. Do try to hide the mode oriented nature of vi. Just be consistent with your mappings. The convention is: cursor-movement is command mode. Then map cursor movement like this: map ^[[A k map! ^[[A ^[k etc... The command mode map for up-arrow is clear, I think. The input mode map takes you first to command mode, and then just moves. To go back into input mode use i or a or whatever, like you always do. The input maps for cursor movement are just another way to quickly switch to command mode. See it as: vi guesses you want command mode when you hit the cursor-keys, so it switches quickly an moves the cursor. You never "suddenly" change from insert to append mode. The only movement in input mode is backspace (and ^W, which most people use very rare). Most novices find this very consistent (so do I, you mileage may vary...) -- Polleke FFAAC09@cc1.kuleuven.ac.be