Fastnav

From WikEmacs
Revision as of 06:32, 6 November 2012 by Xfq (talk | contribs) (Created page with "Inspired by zap-to-char, this library defines different routines operating on the next/previous N'th occurrence of a character. When invoking one of these commands, the user ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Inspired by zap-to-char, this library defines different routines operating on the next/previous N'th occurrence of a character. When invoking one of these commands, the user is interactively queried for a character while the potential target positions are highlighted.

For example, M-s (fastnav-jump-to-char-forward) highlights the next occurrences of each character and prompts for one. Once the user picks a char, the point is moved to that position. Subsequent invocations of M-s before picking a character increases N, that is, the second, third, etc. occurrences are highlighted and targeted.

The sprint-forward/backward commands apply iterative jumping until return/C-g is hit, making it possible to reach any point of the text with just a few keystrokes.

To use it, simply install fastnav package from Marmalade repo, and add something like this to your init file:

   (require 'fastnav)
   (global-set-key "\M-z" 'fastnav-zap-up-to-char-forward)
   (global-set-key "\M-Z" 'fastnav-zap-up-to-char-backward)
   (global-set-key "\M-s" 'fastnav-jump-to-char-forward)
   (global-set-key "\M-S" 'fastnav-jump-to-char-backward)
   (global-set-key "\M-r" 'fastnav-replace-char-forward)
   (global-set-key "\M-R" 'fastnav-replace-char-backward)
   (global-set-key "\M-i" 'fastnav-insert-at-char-forward)
   (global-set-key "\M-I" 'fastnav-insert-at-char-backward)
   (global-set-key "\M-j" 'fastnav-execute-at-char-forward)
   (global-set-key "\M-J" 'fastnav-execute-at-char-backward)
   (global-set-key "\M-k" 'fastnav-delete-char-forward)
   (global-set-key "\M-K" 'fastnav-delete-char-backward)
   (global-set-key "\M-m" 'fastnav-mark-to-char-forward)
   (global-set-key "\M-M" 'fastnav-mark-to-char-backward)
   (global-set-key "\M-p" 'fastnav-sprint-forward)
   (global-set-key "\M-P" 'fastnav-sprint-backward)