Bind ZX -> Save then kill current buffer

Since bury-buffer is already on SPC b z, and isn't a common operation in
day to day Emacs use.

Other useful keybinds:
  ZZ      -> Save then kill current window
  zx      -> kill current buffer (prompts if unsaved)
  SPC b z -> bury buffer
  zn      -> (operator) narrow buffer
  zN      -> widen narrowed buffer
This commit is contained in:
Henrik Lissner 2020-08-05 20:55:30 -04:00
parent c88eb0fff8
commit 6f2471cda7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 8 additions and 1 deletions

View file

@ -264,6 +264,13 @@ See `doom-real-buffer-p' for an explanation for real buffers."
;;
;; Interactive commands
;;;###autoload
(defun doom/save-and-kill-buffer ()
"Save the current buffer to file, then kill it."
(interactive)
(save-buffer)
(kill-current-buffer))
;;;###autoload
(defun doom/kill-this-buffer-in-all-windows (buffer &optional dont-save)
"Kill BUFFER globally and ensure all windows previously showing this buffer

View file

@ -469,7 +469,7 @@ directives. By default, this only recognizes C directives.")
:nv "zn" #'+evil:narrow-buffer
:n "zN" #'doom/widen-indirectly-narrowed-buffer
:n "zx" #'kill-current-buffer
:n "ZX" #'bury-buffer
:n "ZX" #'doom/save-and-kill-buffer
;; don't leave visual mode after shifting
:v "<" #'+evil/visual-dedent ; vnoremap < <gv
:v ">" #'+evil/visual-indent ; vnoremap > >gv