Created
August 8, 2013 14:16
-
-
Save kurohuku/6184953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- coding:utf-8 mode:emacs-lisp -*- | |
;;; helm-eshell-dirstack.el | |
(eval-when-compile (require 'cl)) | |
(require 'helm) | |
(require 'eshell) | |
(defun helm-eshell-dirstack-popd (n) | |
(eshell/popd (format "+%d" n)) | |
(eshell-begin-on-new-line) | |
(eshell-emit-prompt)) | |
(defun helm-eshell-dirstack-cd (n) | |
(eshell/cd (nth (- n 1) eshell-dirstack)) | |
(eshell-begin-on-new-line) | |
(eshell-emit-prompt)) | |
(defvar helm-eshell-dirstack-cache nil) | |
(defvar helm-source-eshell-dirstack | |
`((name . "Eshell dirstack") | |
(init . (lambda () | |
(setq helm-eshell-dirstack-cache | |
(loop for i from 1 | |
for dir in eshell-dirstack | |
collect (cons dir i))))) | |
(candidates . helm-eshell-dirstack-cache) | |
(action . (("cd" . helm-eshell-dirstack-cd) | |
("popd" . helm-eshell-dirstack-popd))))) | |
(defun helm-eshell-dirstack () | |
(interactive) | |
(helm :sources '(helm-source-eshell-dirstack) | |
:buffer "*helm dirstack*")) | |
(provide 'helm-eshell-dirstack) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment