summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2014-04-08 13:52:20 +0100
committerAlan Pearce2014-04-08 13:52:20 +0100
commit462a47f1846382df6e20f1dbd662c7849d4dc7d3 (patch)
tree54b96d779befccbf48be4284085732be69b52ecc
parentbb173ad85c097327de13517d84eb142b053443cf (diff)
downloadnixfiles-462a47f1846382df6e20f1dbd662c7849d4dc7d3.tar.lz
nixfiles-462a47f1846382df6e20f1dbd662c7849d4dc7d3.tar.zst
nixfiles-462a47f1846382df6e20f1dbd662c7849d4dc7d3.zip
Emacs: create DWIM function for switching buffers
Uses projectile inside a project and ido outside. Bound to C-c b
-rw-r--r--emacs/init.el11
1 files changed, 9 insertions, 2 deletions
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)