From 38c3ef744de5d3fe0708c4489cbff1578fd32d0f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 22 Feb 2017 04:27:23 -0500 Subject: [PATCH] completion/ivy: refactor --- modules/completion/ivy/config.el | 39 +++++++++++++++------------- modules/feature/workspaces/config.el | 19 -------------- 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/modules/completion/ivy/config.el b/modules/completion/ivy/config.el index 7606e341f..34ce67918 100644 --- a/modules/completion/ivy/config.el +++ b/modules/completion/ivy/config.el @@ -23,16 +23,20 @@ ;; (@def-package ivy :demand t - :init + :config (setq ivy-height 14 ivy-do-completion-in-region nil ivy-wrap t ivy-fixed-height-minibuffer t - ivy-format-function 'ivy-format-function-line) ;; highlight til EOL + projectile-completion-system 'ivy + smex-completion-method 'ivy + ;; highlight til EOL + ivy-format-function 'ivy-format-function-line) - :config - (setq projectile-completion-system 'ivy - smex-completion-method 'ivy) + (@after magit (setq magit-completing-read-function 'ivy-completing-read)) + (@after yasnippet (push '+ivy-yas-prompt yas-prompt-functions)) + + (ivy-mode +1) (@map :map ivy-minibuffer-map [escape] 'keyboard-escape-quit @@ -43,18 +47,6 @@ "C-b" 'backward-word "C-f" 'forward-word) - ;; Occasionally, when ivy closes, it causes display artifacting - ;; between horizontal splits. This fixes it, though may cause - ;; flickering on some OSes. - (defun doom|redisplay (&rest _) (force-mode-line-update)) - (advice-add 'ivy-read :after 'doom|redisplay) - (add-hook 'projectile-find-file-hook 'doom|redisplay) - - (@after magit (setq magit-completing-read-function 'ivy-completing-read)) - (@after yasnippet (push '+ivy-yas-prompt yas-prompt-functions)) - - (ivy-mode +1) - (@map :map ivy-mode-map [remap find-file] 'counsel-find-file [remap switch-to-buffer] '+ivy/switch-buffer @@ -65,7 +57,18 @@ [remap projectile-switch-project] 'counsel-projectile-switch-project [remap projectile-find-file] 'counsel-projectile-find-file [remap imenu-anywhere] 'ivy-imenu-anywhere - [remap execute-extended-command] 'counsel-M-x)) + [remap execute-extended-command] 'counsel-M-x) + + (when (@featurep :feature workspaces) + (nconc ivy-sort-functions-alist + '((persp-kill-buffer . nil) + (persp-remove-buffer . nil) + (persp-add-buffer . nil) + (persp-switch . nil) + (persp-window-switch . nil) + (persp-frame-switch . nil) + (+workspace/switch-to . nil) + (+workspace/delete . nil))))) (@def-package swiper :commands (swiper swiper-all)) diff --git a/modules/feature/workspaces/config.el b/modules/feature/workspaces/config.el index 5882e598a..e6abac8a5 100644 --- a/modules/feature/workspaces/config.el +++ b/modules/feature/workspaces/config.el @@ -68,22 +68,3 @@ (doom-popup--init window plist)))) (add-hook '+workspaces-load-session-hook '+workspaces|restore-popups)) -(@after ivy - ;; (defun +workspaces|ivy-ignore-non-persp-buffers (b) - ;; (when persp-mode - ;; (let ((persp (get-current-persp))) - ;; (and persp (not (persp-contain-buffer-p b persp)))))) - ;; (pushnew '+workspaces|ivy-ignore-non-persp-buffers ivy-ignore-buffers) - - (setq ivy-sort-functions-alist - (append ivy-sort-functions-alist - '((persp-kill-buffer . nil) - (persp-remove-buffer . nil) - (persp-add-buffer . nil) - (persp-switch . nil) - (persp-window-switch . nil) - (persp-frame-switch . nil) - (+workspace/switch-to . nil) - (+workspace/delete . nil))))) - -