Skip to content

Instantly share code, notes, and snippets.

@rlb3
Created March 28, 2013 14:26
Show Gist options
  • Select an option

  • Save rlb3/5263534 to your computer and use it in GitHub Desktop.

Select an option

Save rlb3/5263534 to your computer and use it in GitHub Desktop.
(setq eshell-prompt-function
(lambda ()
(concat
(eshell/pwd)
(let ((name (eshell/git-branch-name)))
(if name
(concat " (" name ")"))
" $ "))))
;; git symbolic-ref HEAD 2> /dev/null | cut -b 12-
(defun eshell/git-branch-name ()
(interactive)
(let* ((branch-ref (when (shell-command-to-string "git rev-parse --git-dir 2>/dev/null")
(shell-command-to-string "git symbolic-ref HEAD 2>/dev/null")))
(branch (nth 0 (reverse (split-string branch-ref "/")))))
(when (not (string= branch ""))
(substring branch 0 -1))))
(defun eshell/clear ()
(interactive)
(let ((inhibit-read-only t))
(erase-buffer)))
(defun eshell/cpanel ()
(eshell/cd "/usr/local/cpanel"))
(defun eshell/ec (file)
(find-file file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment