summaryrefslogtreecommitdiffhomepage
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el55
1 files changed, 3 insertions, 52 deletions
diff --git a/init.el b/init.el
index d7e4d13..2e75e94 100644
--- a/init.el
+++ b/init.el
@@ -980,65 +980,16 @@
(global-set-key (kbd "C-x _") #'delete-other-windows-vertically)
;;;; window navigation (custom)
-(defun jao-nth-window (n)
- (if (zerop n)
- 'jao-first-window
- `(lambda ()
- (interactive)
- (select-window (frame-first-window))
- (dotimes (x ,n) (other-window 1)))))
-
-(defun jao-prev-window ()
- "Go to previous window."
- (interactive)
- (other-window -1))
-
-(defvar jao-prev-window-repeat-map
- (let ((map (make-sparse-keymap)))
- (define-key map "p" 'jao-prev-window)
- (define-key map "P" (lambda ()
- (interactive)
- (setq repeat-map 'jao-prev-window-repeat-map)
- (other-window 1)))
- map)
- "Keymap to repeat `prev-window' key sequences. Used in `repeat-mode'.")
-
-(put 'jao-prev-window 'repeat-map jao-prev-window-repeat-map)
-
(mapc (lambda (n)
(global-set-key (format "\C-c%s" (1+ n)) (jao-nth-window n)))
'(0 1 2 3 4 5 6 7 8))
-;;;;; last window
-(defvar jao-previous-window nil)
-
-(defun jao-save-current-window (&rest _ignore)
- (unless (active-minibuffer-window)
- (setq jao-previous-window (get-buffer-window (current-buffer)))))
-
-(defun jao-switch-goto-previous-window ()
- (interactive)
- (let ((previous-window jao-previous-window))
- (jao-save-current-window)
- (if (window-live-p previous-window)
- (select-window previous-window)
- (other-window 1))))
-
-(advice-add 'other-window :before #'jao-save-current-window)
-
(global-set-key "\C-xp" 'jao-prev-window)
-(global-set-key (kbd "M-o") #'jao-switch-goto-previous-window)
+(global-set-key (kbd "M-o") #'jao-switch-with-previous-window)
;;;;; first window
-(defun jao-first-window ()
- (interactive)
- (if (eq (selected-window) (frame-first-window))
- (jao-switch-goto-previous-window)
- (jao-save-current-window)
- (select-window (frame-first-window))))
-
-(global-set-key (kbd "s-a") #'jao-first-window)
-(global-set-key (kbd "M-a") #'jao-first-window)
+(global-set-key (kbd "s-a") #'jao-switch-with-first-window)
+(global-set-key (kbd "M-a") #'jao-switch-with-first-window)
;;;; window navigation (switch-window)
(use-package switch-window