From d09b0a40bac1a727668c00f56e228bb6ae7a454c Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 25 Jun 2019 08:53:04 -0700 Subject: [emacs] rework the configuration for navigation. mostly inspired by reading https://github.com/patrickt/emacs. i've made the configuration of counsel and ivy more explicit, by splitting the customization. i've fixed the binding for searching with a buffer to rely on rgrep instead of ag (since i've switched to rg). i'm going to try the module 'guide-key' to see if i can be better at remembering some bindings (i always forget a bunch of them). --- emacs.d/custom/fcuny-navigation.el | 66 ++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 24 deletions(-) (limited to 'emacs.d/custom/fcuny-navigation.el') diff --git a/emacs.d/custom/fcuny-navigation.el b/emacs.d/custom/fcuny-navigation.el index f0be803..93a652b 100644 --- a/emacs.d/custom/fcuny-navigation.el +++ b/emacs.d/custom/fcuny-navigation.el @@ -1,20 +1,9 @@ (require 'fcuny-vars) -(use-package ace-window +(use-package avy :ensure t - :bind (("C-x o" . ace-window))) - -(use-package ag - :ensure t - :bind (:map ag-mode-map - ("p" . compilation-previous-error) - ("n" . compilation-next-error) - ("N" . compilation-next-file) - ("P" . compilation-previous-file)) - :custom - (ag-highlight-search t) - (ag-reuse-buffers t) - (ag-reuse-window t)) + :bind + (("C-c l" . avy-goto-line))) (use-package bookmark :custom @@ -23,7 +12,8 @@ (use-package counsel :ensure t - :init (counsel-mode 1) (ivy-mode 1) + :after ivy + :init (counsel-mode 1) :bind (("M-x" . counsel-M-x) ("C-s" . counsel-grep-or-swiper) @@ -31,17 +21,11 @@ ("C-x C-r" . counsel-recentf) ("C-c f" . counsel-git) ("C-c s" . counsel-git-grep) - ("C-c /" . counsel-ag) + ("C-c /" . counsel-rg) ("C-x r l" . counsel-bookmark)) :custom (counsel-find-file-ignore-regexp "\\.DS_Store\\|\\.localized\\'") - (counsel-find-file-at-point t) - (ivy-use-virtual-buffers t) - (ivy-count-format "(%d/%d) ") - (ivy-height 10) - :config - (use-package swiper - :ensure t)) + (counsel-find-file-at-point t)) (use-package dired :defer t @@ -67,13 +51,47 @@ (setq dired-omit-files (concat dired-omit-files "\\|^.DS_Store$\\|^.localized$\\|^.projectile$\\|^.git$")))) +(use-package guide-key + :ensure t + :config + (guide-key-mode t) + :custom + (guide-key/guide-key-sequence '("C-x"))) + (use-package ibuffer :bind ("C-x C-b" . ibuffer)) +(use-package ivy + :ensure t + :init (ivy-mode 1) + :custom + (ivy-use-virtual-buffers t) + (ivy-count-format "(%d/%d) ") + (ivy-height 20) + (ivy-use-virtual-buffers t) + (ivy-use-selectable-prompt t) + :bind (("C-x b" . ivy-switch-buffer) + ("C-c C-r" . ivy-resume) + ("C-c s" . swiper-at-point) + ("C-s" . swiper))) + (use-package recentf + :init (recentf-mode 1) :config - (recentf-mode 1) + (add-to-list 'recentf-exclude "\\.emacs.d") + (add-to-list 'recentf-exclude ".+tmp......\\.org") (setq recentf-max-saved-items 500 recentf-save-file (expand-file-name "var/recentf" user-emacs-directory))) +(use-package rg + :ensure t + :custom + (rg-group-result t) + (rg-show-columns t) + (rg-align-position-numbers t) + (rg-align-line-number-field-length 3) + (rg-align-column-number-field-length 3) + (rg-align-line-column-separator "#") + (rg-align-position-content-separator "|")) + (provide 'fcuny-navigation) -- cgit 1.4.1