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:
Adel Qalieh 2016-12-25 01:15:35 -05:00 committed by d12frosted
parent f5957eb877
commit 8e7fe6e1f2
No known key found for this signature in database
GPG Key ID: 8F60E862D6F5CE8F
3 changed files with 12 additions and 0 deletions

View File

@ -319,6 +319,16 @@ current window."
;; `other-buffer' honors `buffer-predicate' so no need to filter
(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 ()
(interactive)
(let ((comint-buffer-maximum-size 0))

View File

@ -1876,6 +1876,7 @@ Windows manipulation commands (start with ~w~):
| 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 b~ | force the focus back to the minibuffer (useful with =helm= popups) |
| ~SPC w c~ | maximize/minimize a window and center it |

View File

@ -368,6 +368,7 @@
(golden-ratio)))
(spacemacs/set-leader-keys
"w TAB" 'spacemacs/alternate-window
"w2" 'spacemacs/layout-double-columns
"w3" 'spacemacs/layout-triple-columns
"wb" 'spacemacs/switch-to-minibuffer-window