David Kincaid wrote:
> Could you share how to switch between windows with a single keystroke in
> your setup? My setup is similar a lot of the time, but I'm always doing
> C-x o, C-x o ... to get to the buffer I want.
Since the windows are always the same size, I can do the following:
(defun h-window () (window-at 1 1))
(defun j-window () (window-at 150 1))
(defun k-window () (window-at 1 50))
(defun l-window () (window-at 150 50))
And so each can have a switch function:
(defun switch-to-foo-window (window)
(select-window (funcall window)))
(defun switch-to-h-window () (interactive) (switch-to-foo-window 'h-window))
(defun switch-to-j-window () (interactive) (switch-to-foo-window 'j-window))
(defun switch-to-k-window () (interactive) (switch-to-foo-window 'k-window))
(defun switch-to-l-window () (interactive) (switch-to-foo-window 'l-window))
(global-set-key (kbd "s-h") 'switch-to-h-window)
(global-set-key (kbd "s-j") 'switch-to-j-window)
(global-set-key (kbd "s-k") 'switch-to-k-window)
(global-set-key (kbd "s-l") 'switch-to-l-window)
You can find all of this code in
https://github.com/marick/.emacs.d/blob/master/init.el Warning: a lot of
my elisp is pretty crude. I haven't kept up with all of the new stuff
("new" meaning since around 1990).
Warning: the `^x o` habit is really hard to break.