all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Key rebindings: Turn off pgup-pgdown + move "hjkl" in Viper
@ 2009-12-19 22:30 fpereiro
  2009-12-21 16:04 ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: fpereiro @ 2009-12-19 22:30 UTC (permalink / raw)
  To: Help-gnu-emacs


Hi there! I got stuck in doing a couple of key rebindings in Emacs and Viper
- noob as I am. Here's the thing:

1) I'm trying to render useless the Page Up and Page Down keys, so I'll get
used to navigate with proper commands around the editor. I could manage to
do this for most of the keys I wanted to "shut down" (say, the arrow keys)
by associating them to mark-whole-buffer, a fairly innocuous command. For
example, for the up arrow key, I inserted the following line on my .emacs
file:

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

The problem is that 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.

2) I'm trying out Viper (heresy is not a crime, you know) and 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.

Thanks!
-- 
View this message in context: http://old.nabble.com/Key-rebindings%3A-Turn-off-pgup-pgdown-%2B-move-%22hjkl%22-in-Viper-tp26859195p26859195.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Key rebindings: Turn off pgup-pgdown + move "hjkl" in Viper
  2009-12-19 22:30 Key rebindings: Turn off pgup-pgdown + move "hjkl" in Viper fpereiro
@ 2009-12-21 16:04 ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2009-12-21 16:04 UTC (permalink / raw)
  To: 'fpereiro', Help-gnu-emacs

> 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').





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-21 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-19 22:30 Key rebindings: Turn off pgup-pgdown + move "hjkl" in Viper fpereiro
2009-12-21 16:04 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.