Add keybinding for spacemacs/alternate-window
spacemacs/alternate-window was suggested to switch between the last selected window, or the window-analog of SPC TAB (spacemacs/alternate-buffer). This is part of a larger family of functions, such as spacemacs/jump-to-last-layout on SPC l TAB and eyebrowse-last-window-config on SPC l w TAB. Resolves #7845
This commit is contained in:
parent
f5957eb877
commit
8e7fe6e1f2
|
@ -319,6 +319,16 @@ current window."
|
||||||
;; `other-buffer' honors `buffer-predicate' so no need to filter
|
;; `other-buffer' honors `buffer-predicate' so no need to filter
|
||||||
(other-buffer current-buffer t)))))
|
(other-buffer current-buffer t)))))
|
||||||
|
|
||||||
|
(defun spacemacs/alternate-window ()
|
||||||
|
"Switch back and forth between current and last window in the
|
||||||
|
current frame."
|
||||||
|
(interactive)
|
||||||
|
(let (;; switch to first window previously shown in this frame
|
||||||
|
(prev-window (get-mru-window nil t t)))
|
||||||
|
;; Check window was not found successfully
|
||||||
|
(unless prev-window (user-error "Last window not found."))
|
||||||
|
(select-window prev-window)))
|
||||||
|
|
||||||
(defun spacemacs/comint-clear-buffer ()
|
(defun spacemacs/comint-clear-buffer ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((comint-buffer-maximum-size 0))
|
(let ((comint-buffer-maximum-size 0))
|
||||||
|
|
|
@ -1876,6 +1876,7 @@ Windows manipulation commands (start with ~w~):
|
||||||
|
|
||||||
| Key Binding | Description |
|
| Key Binding | Description |
|
||||||
|------------------------+-----------------------------------------------------------------------------|
|
|------------------------+-----------------------------------------------------------------------------|
|
||||||
|
| ~SPC w TAB~ | switch to alternate window in the current frame (switch back and forth) |
|
||||||
| ~SPC w =~ | balance split windows |
|
| ~SPC w =~ | balance split windows |
|
||||||
| ~SPC w b~ | force the focus back to the minibuffer (useful with =helm= popups) |
|
| ~SPC w b~ | force the focus back to the minibuffer (useful with =helm= popups) |
|
||||||
| ~SPC w c~ | maximize/minimize a window and center it |
|
| ~SPC w c~ | maximize/minimize a window and center it |
|
||||||
|
|
|
@ -368,6 +368,7 @@
|
||||||
(golden-ratio)))
|
(golden-ratio)))
|
||||||
|
|
||||||
(spacemacs/set-leader-keys
|
(spacemacs/set-leader-keys
|
||||||
|
"w TAB" 'spacemacs/alternate-window
|
||||||
"w2" 'spacemacs/layout-double-columns
|
"w2" 'spacemacs/layout-double-columns
|
||||||
"w3" 'spacemacs/layout-triple-columns
|
"w3" 'spacemacs/layout-triple-columns
|
||||||
"wb" 'spacemacs/switch-to-minibuffer-window
|
"wb" 'spacemacs/switch-to-minibuffer-window
|
||||||
|
|
Loading…
Reference in New Issue