Emacs over terminal to dreamhost, 5C and 5D instead of forward-word and backward-word

I’ve been unable to use the C-rightarrow and C-leftarrow to get forwad word and backward word behavior when using emacs within a ssh to my dreamhost host.  I finally figured out how to fix the problem.  In my .emacs file:

(global-set-key "\M-[1;5C" 'forward-word) ; Ctrl+right->forward word
(global-set-key "\M-[1;5D" 'backward-word); Ctrl+left-> backward word

You might be interested in my entire .emacs file, which adds a few niceties:

(set-background-color "light grey")
(global-font-lock-mode 1)
(transient-mark-mode 1)
(setq default-tab-width 3);
(setq standard-indent 3);
(setq inhibit-startup-message t);
(global-set-key "\M-[1;5C" 'forward-word)     ; Ctrl+right->forward word
(global-set-key "\M-[1;5D" 'backward-word) ; Ctrl+left ->backward word

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.