Merge pull request #1199 from flatwhatson/ivy-other-window

Improved switch-to-buffer-other-window for ivy
This commit is contained in:
Henrik Lissner 2019-02-25 12:23:49 -05:00 committed by GitHub
commit e19b6050ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View file

@ -34,7 +34,9 @@ temporary/special buffers in `font-lock-comment-face'."
If ARG (universal argument), open selection in other-window." If ARG (universal argument), open selection in other-window."
(interactive "P") (interactive "P")
(ivy-read "Switch to workspace buffer: " (ivy-read (if arg
"Switch to workspace buffer in other window: "
"Switch to workspace buffer: ")
'internal-complete-buffer 'internal-complete-buffer
:predicate #'+ivy--is-workspace-or-other-buffer-p :predicate #'+ivy--is-workspace-or-other-buffer-p
:action (if arg :action (if arg
@ -44,6 +46,12 @@ If ARG (universal argument), open selection in other-window."
:keymap ivy-switch-buffer-map :keymap ivy-switch-buffer-map
:caller #'+ivy/switch-workspace-buffer)) :caller #'+ivy/switch-workspace-buffer))
;;;###autoload
(defun +ivy/switch-workspace-buffer-other-window (&optional arg)
"Switch the other window to a buffer within the current workspace."
(interactive)
(+ivy/switch-workspace-buffer t))
(defun +ivy--tasks-candidates (tasks) (defun +ivy--tasks-candidates (tasks)
"Generate a list of task tags (specified by `+ivy-task-tags') for "Generate a list of task tags (specified by `+ivy-task-tags') for
`+ivy/tasks'." `+ivy/tasks'."

View file

@ -76,7 +76,9 @@ immediately runs it on the current candidate (ending the ivy session)."
:hook (ivy-mode . ivy-rich-mode) :hook (ivy-mode . ivy-rich-mode)
:config :config
;; Show more buffer information in other switch-buffer commands too ;; Show more buffer information in other switch-buffer commands too
(dolist (cmd '(+ivy/switch-workspace-buffer (dolist (cmd '(ivy-switch-buffer-other-window
+ivy/switch-workspace-buffer
+ivy/switch-workspace-buffer-other-window
counsel-projectile-switch-to-buffer)) counsel-projectile-switch-to-buffer))
(ivy-set-display-transformer cmd 'ivy-rich--ivy-switch-buffer-transformer)) (ivy-set-display-transformer cmd 'ivy-rich--ivy-switch-buffer-transformer))
;; Use `+ivy-rich-buffer-name' to display buffer names ;; Use `+ivy-rich-buffer-name' to display buffer names

View file

@ -34,8 +34,11 @@
"C-S-r" #'helm-resume) "C-S-r" #'helm-resume)
;; Buffer related bindings ;; Buffer related bindings
"C-x b" #'persp-switch-to-buffer "C-x b" #'persp-switch-to-buffer
(:when (featurep! :completion ivy)
"C-x 4 b" #'+ivy/switch-workspace-buffer-other-window)
"C-x C-b" #'ibuffer-list-buffers "C-x C-b" #'ibuffer-list-buffers
"C-x B" #'switch-to-buffer "C-x B" #'switch-to-buffer
"C-x 4 B" #'switch-to-buffer-other-window
"C-x k" #'doom/kill-this-buffer-in-all-windows "C-x k" #'doom/kill-this-buffer-in-all-windows
;; Popup bindigns ;; Popup bindigns
"C-x p" #'+popup/other "C-x p" #'+popup/other