From: Peng Li Date: Sat, 30 Jul 2016 19:33:20 +0000 (+0800) Subject: emacs - window buffer, jump to dired or project root X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;h=30ff0a4dc574ec95a5de5cbd96b2f290a484aff8;p=dotfiles.git emacs - window buffer, jump to dired or project root --- 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