From 30ff0a4dc574ec95a5de5cbd96b2f290a484aff8 Mon Sep 17 00:00:00 2001 From: Peng Li Date: Sun, 31 Jul 2016 03:33:20 +0800 Subject: [PATCH 1/1] emacs - window buffer, jump to dired or project root --- emacs.d/config.org | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/emacs.d/config.org b/emacs.d/config.org index d3c5db5..d6ae9a5 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -2264,7 +2264,7 @@ Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to del ;; ibuffer, dired, eshell, bookmarks ;; ("d" ace-delete-window "ace-one" :exit t) ("C-o" ido-switch-buffer nil :exit t) - ("d" projectile-dired nil :exit t) + ("d" sd/project-or-dired-jump nil :exit t) ("b" ibuffer nil n:exit t) ("e" eshell nil :exit t) ("m" bookmark-jump-other-window nil :exit t) @@ -2287,6 +2287,14 @@ Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to del (global-unset-key (kbd "C-o")) (global-set-key (kbd "C-o") 'sd/hydra-window/body) + + (defun sd/project-or-dired-jump () + "If under project, jump to the root directory, otherwise + jump to dired of current file" + (interactive) + (if (projectile-project-p) + (projectile-dired) + (dired-jump))) #+END_SRC ** Motion -- 2.11.0