From 6737c8c8e5d6657379390e1b7e7ffb0443724cf7 Mon Sep 17 00:00:00 2001 From: yuhan0 Date: Sat, 27 Oct 2018 20:22:32 +0800 Subject: [PATCH] Add ivy option to buffer transient state --- CHANGELOG.develop | 1 + doc/DOCUMENTATION.org | 20 ++++++++++++------- .../spacemacs-defaults/keybindings.el | 5 ++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.develop b/CHANGELOG.develop index 760fe0e6a..f174ef7a2 100644 --- a/CHANGELOG.develop +++ b/CHANGELOG.develop @@ -773,6 +773,7 @@ Benner and Paweł Siudak): - Better delete file messages (thanks to duianto) - Replace centered-buffer-mode with writeroom-mode (thanks to Eugene Yaremenko) + - Add ivy option to buffer transient state (thanks to yuhan0) - Enable =evil-search= search module in evil state. - Improve function =spacemacs/sort-lines-by-column= to work on rectangular/block selection and warn the user about its requirements (thanks to duianto) diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index b65ad6678..5438ef94f 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -2337,13 +2337,19 @@ Buffer manipulation commands (start with ~b~): A convenient buffer manipulation transient state allows to quickly cycles through the opened buffer and kill them. -| Key binding | Description | -|-------------+-----------------------------------------------------------------------------------| -| ~SPC b .~ | initiate transient state | -| ~K~ | kill current buffer | -| ~n~ | go to next buffer (avoid buffers matching =spacemacs-useless-buffers-regexp=) | -| ~N~ | go to previous buffer (avoid buffers matching =spacemacs-useless-buffers-regexp=) | -| ~z~ | recenter buffer in window | +| Key binding | Description | +|------------------------+--------------------------------------------------------------------------------------------| +| ~SPC b .~ | initiate transient state | +| ~[1..9]~ | move current buffer to nth window | +| ~[C-1..C-9]~ | switch focus to nth window | +| ~[M-1..M-9]~ | swap current buffer with nth window | +| ~b~ | list all buffers with helm/ivy (avoid buffers matching =spacemacs-useless-buffers-regexp=) | +| ~d~ | kill current buffer | +| ~C-d~ | bury current buffer | +| ~n~ or ~~ | go to next buffer (avoid buffers matching =spacemacs-useless-buffers-regexp=) | +| ~N~ or ~p~ or ~~ | go to previous buffer (avoid buffers matching =spacemacs-useless-buffers-regexp=) | +| ~o~ | switch focus to other window | +| ~z~ | recenter buffer in window | Unlike vim, emacs creates many buffers that most people do not need to see. Some examples are the =*Messages*= and =*Compile-Log*= buffers. Spacemacs tries to diff --git a/layers/+spacemacs/spacemacs-defaults/keybindings.el b/layers/+spacemacs/spacemacs-defaults/keybindings.el index 6057c1888..457aec836 100644 --- a/layers/+spacemacs/spacemacs-defaults/keybindings.el +++ b/layers/+spacemacs/spacemacs-defaults/keybindings.el @@ -565,7 +565,10 @@ respond to this toggle." ("N" previous-buffer) ("o" other-window) ("" previous-buffer) - ("b" helm-buffers-list) + ("b" (cond ((configuration-layer/layer-used-p 'helm) + (helm-buffers-list)) + ((configuration-layer/layer-used-p 'ivy) + (ivy-switch-buffer)))) ("d" spacemacs/kill-this-buffer) ("C-d" bury-buffer) ("z" recenter-top-bottom)