Okay, get yourself a biscuit or biscuits, it's time for another SlugEssay™
The purpose of this post is to try and work out the best way to disable the
cursor keys, let me know if there is a :set (or whatever) for this ! (argh) :)
Three reasons why the HJKL movement keys are better:
1) It's faster, you keep your hands on the keyboard in the optimised hunt
and peck position ! :) You're not reaching over to the cursors. (You'd have to
be fast already to notice a differenence)
2) Some older computers dont have the cursor keys on em, this could slow cursor
key users down :) You know you will probably never have to deal with such
terminals, but point three does it for you ..
3) It makes you feel .. you know .. *blush* :)
You can also learn about key mapping if you dont yet know about em by
reading this ! This way I have an excuse for not using the
:turnofthecursorkeysplease method
Hmm .. i've had a look into this and I still don't really know how to
disable the cursor keys in Vim .. the first thing I looked for was :map ..
Firstly .. a simple example ..
Make sure you're in Command mode (the Escape key)
then type ":map q i" and hit enter. You should now be able to use the Q key to
insert text ! (Btw, Q is an unused key .. you'll find out more later !
In command line mode, CTRL-V will ready VI for you to press a non
standard key .. then you hit the key. You can try ":map [CTRL-V] [BACKSPACE] R"
to make the backspace key work as a R (replace) command ..
Then I tried ":map [CTRL-V] [LEFT CURSOR] R " which looks like this ":map ^[OD".
Works great, the left cursor key is now the replace command.
Now :unmap will unmap the key to return it to it's default value,
Try ":unmap [CTRL-V] [CTRL-BACKSPACE]", now the backspace key will backspace !
This works just fine with the left cursor key .. but then I
thought, yes, indeed :unmap will return it to it's default value (not
completely destroy and binds - how Quake binds work) - darn
I tried something else, binding the cursors to a key that doesn't do anything
(actually .. the keys that dont work are (q,K,q,V,v,^A,^K,^O,^W,^X,-,*,\,=)
unless you have already binded them before, yes .. I have the book :)
This does an okay job, but the BEST way to solve this would be to bind the
cursor keys to ESC so .. that's "[CTRL-V] [ESC]" which looks like ^[
So .. ":map ^[OD ^[" to make the left cursor key to ESC
Now any attempt to press the cursor keys will put you in escaped (command) mode,
which one should be in already, to use the HJKL movement keys ...
Anyway ! That's my solution, I couldnt find any evidence turning off the cursor
keys in the vimrc file or any VIM :sets as I stated before, but i'm sure
there's a way
vimrc is the configuration file for vim located in /usr/local/share/vim/vimrc
I tried adding the map commands: (up,down,right,left)
map ^[OA ^[
map ^[OB ^[
map ^[OC ^[
map ^[OD ^[
But it doesn't work ! :(
One example uses "map Q gq" to map its own stuff, but there is evidence of
"imap" and "nmap" usage, how are they different ?
Doesnt seems to affect vim at all ! Any suggestions ?
I think there's an option of turning cursor keys off when compiling VIM but I'm
not sure.
Well I know this was probably the long way to disable the keys but it did teach
me how to map q to insert ! :)
Regards, Matt
--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text