Emacs: create DWIM function for switching buffers Uses projectile inside a project and ido outside. Bound to C-c b
Alan Pearce alan@alanpearce.co.uk
Tue, 08 Apr 2014 13:52:20 +0100
1 files changed, 9 insertions(+), 2 deletions(-)
jump to
M emacs/init.el → emacs/init.el
@@ -562,6 +562,14 @@ (interactive) (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 @@ (use-package org :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)