From 462a47f1846382df6e20f1dbd662c7849d4dc7d3 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 8 Apr 2014 13:52:20 +0100 Subject: Emacs: create DWIM function for switching buffers Uses projectile inside a project and ido outside. Bound to C-c b --- emacs/init.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'emacs') diff --git a/emacs/init.el b/emacs/init.el index 71a64754..e724cfc4 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -562,6 +562,14 @@ Values: `desktop', `server', `laptop'") (ido-initiate-auto-merge (current-buffer))) (bind-key "C-c C-s" #'ido-manual-merge ido-file-dir-completion-map))) +(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 "C-c b" #'ap/ido-projectile-switch-buffer-dwim) + (use-package ido-vertical-mode :config (ido-vertical-mode 1)) @@ -635,8 +643,7 @@ Values: `desktop', `server', `laptop'") :bind (("C-c C-a" . org-agenda-list) ("C-c a" . org-agenda) ("C-c l" . org-store-link) - ("C-c r" . org-remember) - ("C-c b" . org-iswitchb)) + ("C-c r" . org-remember)) :config (progn (setq org-directory "~/org" org-agenda-files `(,org-directory) -- cgit 1.4.1