help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Key rebindings: Turn off pgup-pgdown + move "hjkl" in Viper


From: Drew Adams
Subject: RE: Key rebindings: Turn off pgup-pgdown + move "hjkl" in Viper
Date: Mon, 21 Dec 2009 08:04:51 -0800

> I don't know how to refer to the Page Up and Page Down
> keys. I've tried [pageup], [PageUp], [page up], [Page Up], 
> and quite a few more, but none seemed to work.

Page Down is the `next' key. Page Up is the `prior' key.
Setting a key to nil removes any binding it might have had.

(global-set-key [next] nil)
(global-set-key [prior] nil)

Also, you need not quote a vector - vectors are self-evaluating:

(global-set-key [up] 'mark-whole-buffer) =
(global-set-key (quote [up]) 'mark-whole-buffer)

> want to remap the "hjkl" cursor commands to "jkl;", so that
> my fingers can stay on the initial keyboard positions.
> I could swap "hjkl" to "jkl;" by inserting the
> following on my .viper file:
> 
> (define-key viper-vi-global-user-map "j" 'viper-backward-char)
> (define-key viper-vi-global-user-map "k" 'viper-next-line)
> (define-key viper-vi-global-user-map "l" 'viper-previous-line)
> (define-key viper-vi-global-user-map ";" 'viper-forward-char)
> 
> What I'm still lacking is the command to swap the 
> functionality previously
> held by ";" to "h". Specifically, I would need to find out 
> the name of the
> viper function associated with ";". I know it's a line 
> command, but couldn't
> find the name of the function anywhere.

You can remap the commands, instead of defining the keys. That will move all
keys bound to a given command to another key, which you prefer. See the Elisp
manual, node `Remapping Commands'. As an alternative, see also function
`substitute-key-definition', in node `Changing Key Bindings'.

To get the command currently bound to a key, use function `lookup-key' (see node
`Functions for Key Lookup'). To find out the command bound to a given key
interactively, use `C-h k' (`describe-key').





reply via email to

[Prev in Thread] Current Thread [Next in Thread]