Move

Keybindings or short fragments I use to move around

 

 

google-groups question on forward-word

 

On Dec 30, 3:30 am, Ewan <e...@nospam.com> wrote:
> Hi,
>
> I switched to emacs a few months ago and have customized some of my key  
> sequences. I largely followed this guy’s examples:
>
> http://steve.yegge.googlepages.com/effective-emacs
>
> One thing that doesn’t address, though, is the “forward word” command  
> Alt-f. Doesn’t everyone find that very awkward? I can’t see online  
> references to a good alternative customization. Any ideas? What do you do?
>
> cheers,
> Ewan

 

I’ve left it, for the most part -- M-f is an logical extension of using C-f (forward-char) -- remember one, and you can find the other.

 

If you have access to the arrow keys (not always via terminals) you also might be interested in:

 

;; navigation tweak -- C-right/left (arrow keys) now go to START of word, not the end
;; as default forward/backword word behavior is to move "over" the work
;; http://geosoft.no/development/emacs.html
(defun geosoft-forward-word ()
   ;; Move one word forward. Leave the pointer at start of word
   ;; instead of emacs default end of word. Treat _ as part of word
   (interactive)
   (forward-char 1)
   (backward-word 1)
   (forward-word 2)
   (backward-word 1)
   (backward-char 1)
   (cond ((looking-at "_") (forward-char 1) (geosoft-forward-word))
         (t (forward-char 1))))

(defun geosoft-backward-word ()
   ;; Move one word backward. Leave the pointer at start of word
   ;; Treat _ as part of word
   (interactive)
   (backward-word 1)
   (backward-char 1)
   (cond ((looking-at "_") (geosoft-backward-word))
         (t (forward-char 1))))

Bind the functions to Ctrl-Left and Ctrl-Right with:

(global-set-key [C-right] 'geosoft-forward-word)
(global-set-key [C-left] 'geosoft-backward-word)

 

 

from http://geosoft.no/development/emacs.html(approve sites)

 

other keybindings

not sure if this really counts as navigation, but that’s the heading I use for grouping keybindings.

 

;; keybindings (unless part of a large grouping)
(define-key global-map [?\C-'] 'other-window) ;;http://www.emacswiki.org/cgi-bin/wiki/EmacsNiftyTricks near bottom
(define-key global-map [?\C-\"] 'back-window) ;; can't find a way to bind w/ arguement
(global-set-key [?\M-\"] 'xsteve-flip-windows) ;; defined above

;; note binding tips at http://tiny-tools.sourceforge.net/emacs-keys-body.html#case_study_why_cant_i
(define-key global-map "
\M-#" 'kill-start-of-line)
(define-key global-map "
\C-xw" 'fixup-whitespace)
(define-key global-map "
\C-x\C-g" 'repos) ;; defined above
(define-key global-map "
\C-x _" 'force-underscore) ;; defined above


;; [f1] 'jao-toggle-selective-display (defined below)
(define-key global-map [f1] 'delete-other-windows)
(define-key global-map [f2] 'jao-toggle-selective-display) ;; defined above
(define-key global-map [f3] 'save-buffer) ;; http://slashdot.org/comments.pl?sid=162694&cid=13599510
(define-key global-map [f4] 'kill-buffer)

(define-key global-map [f5] 'toggle-truncate-lines) ;; simple.el
(define-key global-map [f6] 'other-window)
(define-key global-map [f7] 'find-in-open) ;; defined above
(global-set-key (kbd "
<f8> t") 'planner-create-task-from-buffer) ;; uhm... don't use ?

(define-key global-map [f9] 'browse-url-at-point)
(define-key global-map [f10] 'switch-back-and-forth) ;; defined above
(define-key global-map [f11] 'ibuffer) ;; 'h' after entering for help
(define-key global-map [f12] 'open-bug-at-point) ;; dit-functions.el
(global-set-key [(meta f12)] 'recentf-open-files) ;;recentf.el

(global-set-key [S-mouse-3] 'imenu) ;;  (info "
(Emacs)Imenu")

(define-key global-map "
\C-xnb" 'tell-me-the-name) ;; defined above

(global-set-key (kbd "
M-/") 'hippie-expand)  ;; http://trey-jackson.blogspot.com/2007/12/emacs-tip-5-hippie-expand.html
(global-set-key (kbd "
M-\\") 'xsteve-exchange-slash-and-backslash)
(global-set-key "
\C-cp" 'push-line) ;; defined above

(global-set-key [C-right] 'geosoft-forward-word) ;; defined above
(global-set-key [C-left] 'geosoft-backward-word) ;; defined above

;; C-c q toggles auto-fill, also known as word wrap
(global-set-key (kbd "
C-c q") 'auto-fill-mode)

;; simple aliases (too short, but will do for now)
(defalias 'qrr 'query-replace-regexp)
(defalias 'dml 'delete-matching-lines)
(defalias 'kml 'delete-non-matching-lines)
(defalias 'eli 'elisp-index-search)
(defalias 'vbm 'visual-basic-mode)
(defalias 'bash 'cygwin-shell)
(defalias 'swap-slashes 'xsteve-exchange-slash-and-backslash) ;; defined above
(defalias 'slash-swap 'xsteve-exchange-slash-and-backslash)

 

from my Dot Emacs File

 

 

See Also

Key Binding

 

 

Tags

Emacs keybindings


 

Comments

No comments yet.

 

 

Add Comment

Heading:
 Your Message
 
 Enter value ← Have you entered the code number?
Author: