From 4f3fcb5fb8ec10f47339175a8550166e6036f00f Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 14 Nov 2016 09:59:57 +0100 Subject: Emacs: Add counsel-yank-pop binding --- tag-emacs/emacs.d/init.org | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'tag-emacs/emacs.d') diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 5e6b995..afce66b 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1242,27 +1242,29 @@ replacement for helm so far. #+BEGIN_SRC emacs-lisp (use-package counsel - :config (progn - (bind-key "M-x" #'counsel-M-x) - (bind-key "" #'counsel-M-x) - (bind-key "" #'counsel-M-x) - (bind-key "C-c M-x" #'execute-extended-command) - (bind-key "C-x C-f" #'counsel-find-file) - (bind-key "C-x b" #'counsel-switch-to-persp-buffer) - (defadvice counsel-find-file (after find-file-sudo activate) - "Find file as root if necessary." - (when (and buffer-file-name - (not (file-writable-p buffer-file-name))) - (message "File not writable %s" buffer-file-name) - (find-alternate-file (concat "/sudo::" buffer-file-name)))) - (defun counsel-switch-to-persp-buffer (arg) - "Forward to `persp-switch-to-buffer'." - (interactive "P") - (ivy-read (format "Switch to buffer [%s]: " (persp-name persp-curr)) - (remq nil (mapcar #'buffer-name (persp-buffers persp-curr))) - :preselect (buffer-name (other-buffer (current-buffer))) - :action #'ivy--switch-buffer-action - :keymap ivy-switch-buffer-map)))) + :config (progn + (bind-key "M-x" #'counsel-M-x) + (bind-key "" #'counsel-M-x) + (bind-key "" #'counsel-M-x) + (bind-key "C-c M-x" #'execute-extended-command) + (bind-key "C-x C-f" #'counsel-find-file) + (bind-key "C-x b" #'counsel-switch-to-persp-buffer) + (bind-key "M-y" #'counsel-yank-pop) + (bind-key "M-y" #'ivy-next-line ivy-minibuffer-map) + (defadvice counsel-find-file (after find-file-sudo activate) + "Find file as root if necessary." + (when (and buffer-file-name + (not (file-writable-p buffer-file-name))) + (message "File not writable %s" buffer-file-name) + (find-alternate-file (concat "/sudo::" buffer-file-name)))) + (defun counsel-switch-to-persp-buffer (arg) + "Forward to `persp-switch-to-buffer'." + (interactive "P") + (ivy-read (format "Switch to buffer [%s]: " (persp-name persp-curr)) + (remq nil (mapcar #'buffer-name (persp-buffers persp-curr))) + :preselect (buffer-name (other-buffer (current-buffer))) + :action #'ivy--switch-buffer-action + :keymap ivy-switch-buffer-map)))) #+END_SRC -- cgit 1.4.1