Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Easier Window Switching in Emacs

142 views
Skip to first unread message

deech

unread,
Apr 27, 2008, 7:26:03 PM4/27/08
to
Hi all,
Has anyone else noticed that window switching in emacs is a
bit cumbersome?

About a month ago I created a new prefix key C-t and bound
h,j,k,l to move to the left, top, bottom, and right window
respectively. Here is the snippet in my .emacs file that makes this
happen. Please note that this destroys C-t which is by default bound
to transpose-char. If you use this a lot try another prefix key.

;;Make window switching a little easier. C-x-o is a pain.
;;Unbind C-t. I don't really care about transposing chars.
(global-unset-key "\C-t")
;; Turn C-t into a prefix key
(define-prefix-command 'ctrl-t-prefix)
;; And within C-t bind vi-style navigation shortcuts
;; to window switching
(define-key 'ctrl-t-prefix "j" 'windmove-down)
(define-key 'ctrl-t-prefix "k" 'windmove-up)
(define-key 'ctrl-t-prefix "h" 'windmove-left)
(define-key 'ctrl-t-prefix "l" 'windmove-right)
(global-set-key "\C-t" 'ctrl-t-prefix)

Deech

Joost Kremers

unread,
Apr 27, 2008, 7:42:20 PM4/27/08
to
deech wrote:
> Hi all,
> Has anyone else noticed that window switching in emacs is a
> bit cumbersome?

not since i discovered windmove:

(windmove-default-keybindings)

in .emacs, then switch windows using shift + arrow key.

there are other solutions to this as well, IIRC.


--
Joost Kremers joostk...@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

Ivan Kanis

unread,
Apr 29, 2008, 8:37:30 PM4/29/08
to help-gn...@gnu.org
deech <aditya...@gmail.com> writes:

> Has anyone else noticed that window switching in emacs is a
> bit cumbersome?

I used to think so till I bound C-o to other-window. Some people will
tell you it's heresy to override default emacs bindings :)
--
Ivan
http://kanis.fr

"I have never met anyone who can do Scheme, Haskell, and C pointers
who can't pick up Java in two days, and create better Java code than
people with five years of experience in Java, but try explaining that
to the average HR drone."
-- Joel Spolsky

0 new messages