diff options
Diffstat (limited to 'tag-emacs')
-rw-r--r-- | tag-emacs/emacs.d/Cask | 1 | ||||
-rw-r--r-- | tag-emacs/emacs.d/init.org | 172 |
2 files changed, 43 insertions, 130 deletions
diff --git a/tag-emacs/emacs.d/Cask b/tag-emacs/emacs.d/Cask index 3eb510b..e7aec17 100644 --- a/tag-emacs/emacs.d/Cask +++ b/tag-emacs/emacs.d/Cask @@ -20,6 +20,7 @@ (depends-on "company") (depends-on "company-go") (depends-on "company-tern") +(depends-on "counsel") (depends-on "csv-mode") (depends-on "dash") (depends-on "dash-functional") diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index e74511a..4fe6165 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -158,7 +158,7 @@ based upon some folder conventions I use. (defun ap/add-known-subfolder-projects () (interactive) - (ap/-add-known-subfolder-projects (ido-read-directory-name "Add projects under: "))) + (ap/-add-known-subfolder-projects (read-directory-name "Add projects under: "))) (defun ap/open-subfolder-project (from-dir &optional arg) (let ((project-dir (projectile-completing-read "Open project: " @@ -176,7 +176,7 @@ based upon some folder conventions I use. (setq projectile-switch-project-action #'projectile-dired projectile-remember-window-configs t - projectile-completion-system 'helm))) + projectile-completion-system 'ivy))) #+END_SRC ** projector @@ -242,7 +242,7 @@ time. Make sure to set it up with a nice =completing-read-function= :commands (magit-status) :config (progn (rename-modeline magit-status-mode (char-to-string (-find #'char-displayable-p '(11942 5848 177)))) (setq magit-last-seen-setup-instructions "1.4.0" - magit-completing-read-function #'magit-ido-completing-read + magit-completing-read-function #'magit-builtin-completing-read magit-wip-after-save-mode t magit-wip-after-apply-mode t magit-popup-use-prefix-argument 'default) @@ -1184,7 +1184,6 @@ lots of candidates. (req-package helm-config :demand t :ensure helm - :bind (("C-x i" . helm-semantic-or-imenu)) :config (progn (setq helm-idle-delay .1 helm-input-idle-delay 0) @@ -1200,130 +1199,57 @@ lots of candidates. (define-key helm-read-file-map (kbd "C-z") #'helm-select-action))) #+END_SRC -** ido +** swiper/ivy -I really like ido. It’s part of emacs, it does flex matching nicely -and it’s pretty configurable. +Ivy is the new kid on the completion block. I wonder if it can +replace helm and ido. #+BEGIN_SRC emacs-lisp -(req-package ido - :bind (("C-x b" . ido-switch-buffer)) - :init (progn - (setq ido-save-directory-list-file (expand-file-name "ido-state" user-emacs-directory)) - (bind-key* "C-x C-f" #'ido-find-file) - (ido-mode 1) - (ido-everywhere 1)) - :config (progn - (setq ido-auto-merge-delay-time 99999 - ido-enable-flex-matching t) - - (ido-init-completion-maps) - (defadvice ido-find-file (after find-file-sudo activate) - "Find file as root if necessary." - (unless (and buffer-file-name - (file-writable-p buffer-file-name)) - (find-alternate-file (concat "/sudo::" buffer-file-name)))) - (defun ido-manual-merge () - (interactive) - (ido-initiate-auto-merge (current-buffer))) - (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) -#+END_SRC - -*** TODO Figure out whether the merge stuff is useful. - -*** ido-completing-read+ - -This is mostly a dependency of =magit=. -#+BEGIN_SRC emacs-lisp -(req-package ido-completing-read+ - :require ido - :config (progn - (setq ido-cr+-fallback-function #'helm-completing-read - ido-cr+-max-items 2000))) + (req-package swiper + :bind (("C-s" . swiper) + ("C-r" . swiper) + ("C-c C-r" . ivy-resume) + ("C-x i" . imenu) + ("C-=" . swiper)) + :config (progn + (setq ivy-use-virtual-buffers t + ivy-re-builders-alist '((internal-complete-buffer . ivy--regex-fuzzy) + (t . ivy--regex-plus)))) + :init (progn + (ivy-mode 1))) #+END_SRC -**** TODO See if I can use ido-completing-read+ in ido places -This would be good for finding files in projects. - -**** Buffer switching within projects - #+BEGIN_SRC emacs-lisp -(defun ap/ido-projectile-switch-buffer-dwim (force-ido) - (interactive "p") - (if (and (projectile-project-p) (eq force-ido 1)) - (call-interactively #'projectile-switch-to-buffer) - (call-interactively #'ido-switch-buffer))) - -(bind-key "s-x b" #'ap/ido-projectile-switch-buffer-dwim) -(bind-key "s-x s-b" #'ap/ido-projectile-switch-buffer-dwim) + (req-package counsel + :bind (("M-x" . counsel-M-x) + ("<apps>" . counsel-M-x) + ("<menu>" . counsel-M-x) + ("C-c M-x" . execute-extended-command) + ("C-x C-f" . counsel-find-file))) #+END_SRC -*** ido-vertical-mode - -I find ido’s default horizonal presentation of completion candidates -to be a little difficult to follow. Of course, there’s always a -package for that. - -#+BEGIN_SRC emacs-lisp -(req-package ido-vertical-mode - :require ido - :init (progn - (setq ido-vertical-decorations '("\n❯ " - "" - "\n " - "\n …" - "[" - "]" - " [No match]" - " [Matched]" - " [Not readable]" - " [Too big]" - " [Confirm]" - "\n❯ " - "") - ido-vertical-define-keys 'C-n-C-p-up-down-left-right)) - :config (ido-vertical-mode 1)) -#+END_SRC - -*** flx-ido - -I think ido’s flex matching could be a bit better, so I use =flx-ido= -for that. It can be slow on large collectinos, but fortunately it can -disable itself at that point - -#+BEGIN_SRC emacs-lisp -(req-package flx-ido - :require ido - :init (progn - (flx-ido-mode 1) - (setq flx-ido-threshold 1000))) -#+END_SRC ** smex -Smex is my favourite way to use =M-x=. I might try setting up =helm= -again, to see whether it’s any better or not. +Smex is my favourite way to use =M-x=. Counsel’s =counsel-M-x= +function uses it internally, so I’m keeping it around, even though I +don’t use it directly. #+BEGIN_SRC emacs-lisp -(req-package smex - :require ido - :bind (("M-x" . smex) - ("<apps>" . smex) - ("<menu>" . smex) - ("M-X" . smex-major-mode-commands) - ("C-c M-x" . execute-extended-command)) - :config (progn - (setq smex-key-advice-ignore-menu-bar t - smex-auto-update nil) - (defun smex-update-after-load (_unused) - (if (boundp 'smex-cache) - (smex-update))) - (add-hook 'after-load-functions 'smex-update-after-load)) - :init (progn - (setq smex-history-length 100 - smex-save-file (concat user-emacs-directory - "smex-items")) - (smex-initialize))) + (req-package smex + :require ido + :config (progn + (setq smex-key-advice-ignore-menu-bar t + smex-auto-update nil) + (defun smex-update-after-load (_unused) + (if (boundp 'smex-cache) + (smex-update))) + (add-hook 'after-load-functions 'smex-update-after-load)) + :init (progn + (setq smex-history-length 100 + smex-save-file (concat user-emacs-directory + "smex-items")) + (smex-initialize))) #+END_SRC * Modeline @@ -1515,7 +1441,7 @@ works really nicely. (add-hook 'ledger-mode-hook #'setup-ledger-mode) (add-to-list 'smart-tab-disabled-major-modes 'ledger-mode) (setq ledger-use-iso-dates t - ledger-post-use-completion-engine 'ido + ledger-post-use-completion-engine :built-in ledger-reconcile-default-commodity "€" ledger-clear-whole-transactions t ledger-narrow-on-reconcile t @@ -2358,20 +2284,6 @@ and doesn’t go back to the same place more than once. :bind ("C-x SPC" . goto-last-change)) #+END_SRC -** helm-swoop - -This fits somewhere between isearch and grep. For me, I didn’t -realise how useful it was until I actually tried it. - -#+BEGIN_SRC emacs-lisp -(req-package helm-swoop - :bind (("C-=" . helm-swoop) - ("C-c C-=" . helm-multi-swoop)) - :init (progn - (bind-key "C-=" #'helm-swoop isearch-mode-map) - (bind-key "C-=" #'helm-multi-swoop-all-from-helm-swoop))) -#+END_SRC - ** multiple-cursors I mentioned before that I’d used Sublime Text before. Multiple |