updated window switching

This commit is contained in:
ndwarshuis 2019-04-24 03:01:16 -04:00
parent 30dca6ce05
commit 570a5ce17b
1 changed files with 18 additions and 13 deletions

View File

@ -267,12 +267,7 @@ If FRONT is t, do to the front of current values instead of the back."
(defun nd/switch-to-last-window () (defun nd/switch-to-last-window ()
"Switch to most recently used window." "Switch to most recently used window."
(interactive) (interactive)
(let ((win (get-mru-window t t t))) (aw-switch-to-window (get-mru-window t t t)))
(unless win (error "Last window not found"))
(let ((frame (window-frame win)))
(raise-frame frame)
(select-frame frame)
(select-window win))))
(defun nd/switch-to-previous-buffer () (defun nd/switch-to-previous-buffer ()
"Switch the buffer to the last opened buffer." "Switch the buffer to the last opened buffer."
@ -3695,15 +3690,25 @@ The function keys are nice because they are almost (not always) free in every mo
(global-set-key (kbd "M-s") 'avy-goto-char) (global-set-key (kbd "M-s") 'avy-goto-char)
(global-set-key (kbd "M-x") 'helm-M-x) (global-set-key (kbd "M-x") 'helm-M-x)
;; (defhydra hydra-buffer (global-map "M-b" :exit t)
;; "buffer functions"
;; ("M-b" nd/switch-to-previous-buffer)
;; ("k" nd/kill-current-buffer)
;; ("l" helm-buffers-list))
(defhydra hydra-window (global-map "M-o") (defhydra hydra-window (global-map "M-o")
"window" "window"
;; TODO this might make more sense to switch to last window ;; TODO this might make more sense to switch to last window
("M-o" ace-window :exit t) ("M-o" #'nd/switch-to-last-window :exit t)
("s" ace-swap-window :exit t) ("o" #'ace-window :exit t)
("w" #'nd/switch-to-last-window :exit t) ("s" #'ace-swap-window :exit t)
("k" #'enlarge-window) ("k" #'windmove-up)
("j" #'shrink-window) ("j" #'windmove-down)
("h" #'enlarge-window-horizontally) ("h" #'windmove-left)
("l" #'shrink-window-horizontally) ("l" #'windmove-right)
("K" #'enlarge-window)
("K" #'shrink-window)
("H" #'enlarge-window-horizontally)
("L" #'shrink-window-horizontally)
("=" #'balance-windows :exit t)) ("=" #'balance-windows :exit t))
#+END_SRC #+END_SRC