[visual][popwin] add keybiding to resume last popwin buffer

bind it to `spc r w`
This commit is contained in:
Thanh Vuong 2020-10-26 00:42:18 -06:00 committed by Maximilian Wolff
parent 056eb6b91b
commit b4cf004319
No known key found for this signature in database
GPG Key ID: 2DD07025BFDBD89A
4 changed files with 47 additions and 1 deletions

View File

@ -143,6 +143,7 @@
- [[#frame-manipulation-key-bindings][Frame manipulation key bindings]]
- [[#emacs-and-spacemacs-files][Emacs and Spacemacs files]]
- [[#browsing-files-in-completion-buffer][Browsing files in completion buffer]]
- [[#popup-buffers][Popup buffers]]
- [[#ido][Ido]]
- [[#ido-transient-state][Ido transient state]]
- [[#bookmarks][Bookmarks]]
@ -2594,6 +2595,11 @@ In =vim= style and =hybrid= style with the variable
| ~C-k~ | go to next candidate |
| ~C-l~ | enter current directory |
**** Popup buffers
=popwin= is used to manage buffers such as ~*Help*~, ~*Completions*~,
~*compilation*~, and etc. Use =C-g= to close them or most of the time you can
close them with =q= also. Use ~SPC-r-w~ to view the last closed popup buffer.
*** Ido
Spacemacs displays the =ido= minibuffer vertically thanks to the
[[https://github.com/gempesaw/ido-vertical-mode.el][ido-vertical-mode]].

View File

@ -0,0 +1,24 @@
;;; config.el --- Spacemacs UI Visual Layer Configuration File
;;
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(defvar spacemacs-popwin-last-buffer nil
"Last popwin buffer. This is a private variable.")

View File

@ -40,6 +40,19 @@
(string-match str (car x))))
popwin:special-display-config)))
(defun spacemacs/advice-popwin (orig-fun &rest args)
"Advice to `popwin:match-config' around to save the buffer active."
(let ((result (apply orig-fun args)))
(when result
(setq spacemacs-popwin-last-buffer (car args)))
result))
(defun spacemacs/last-popwin ()
"Resume last popwin buffer."
(interactive)
(if (buffer-live-p spacemacs-popwin-last-buffer)
(select-window (display-buffer spacemacs-popwin-last-buffer))
(message "Last popwin buffer not found or killed.")))
;; zoom

View File

@ -96,6 +96,7 @@
(popwin-mode 1)
(spacemacs/set-leader-keys "wpm" 'popwin:messages)
(spacemacs/set-leader-keys "wpp" 'popwin:close-popup-window)
(spacemacs/set-leader-keys "rw" 'spacemacs/last-popwin)
;; don't use default value but manage it ourselves
(setq popwin:special-display-config nil)
@ -114,7 +115,9 @@
(push '("*grep*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config)
(push '("*nosetests*" :dedicated t :position bottom :stick t :noselect nil ) popwin:special-display-config)
(push '("^\*WoMan.+\*$" :regexp t :position bottom ) popwin:special-display-config)
(push '("*Google Translate*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config))))
(push '("*Google Translate*" :dedicated t :position bottom :stick t :noselect t :height 0.4) popwin:special-display-config)
(advice-add 'popwin:match-config :around #'spacemacs/advice-popwin))))
(defun spacemacs-visual/init-zoom-frm ()
(use-package zoom-frm