+;;(add-hook 'eshell-mode-hook
+;; (lambda ()
+;; (linum-mode -1)
+;; (highlight-current-line-on nil)))
+
+(setenv "PATH"
+ (concat
+ "/usr/local/bin:/usr/local/sbin:"
+ (getenv "PATH")))
+
+(setq eshell-scroll-to-bottom-on-input t)
+
+
+;; copied from howardabrams's config
+(defun eshell/gst (&rest args)
+ (magit-status (pop args) nil)
+ (eshell/echo))
+
+
+
(add-hook 'eshell-mode-hook
- (lambda ()
- (linum-mode -1)
- (highlight-current-line-on nil)))
+ (lambda ()
+ (add-to-list 'eshell-visual-commands "ssh")
+ (add-to-list 'eshell-visual-commands "tail")))
+
+(defun curr-dir-git-branch-string (pwd)
+ "Returns current git branch as a string, or the empty string if
+PWD is not in a git repo (or the git command is not found)."
+ (interactive)
+ (when (and (eshell-search-path "git")
+ (locate-dominating-file pwd ".git"))
+ (let ((git-output (shell-command-to-string (concat "cd " pwd " && git branch | grep '\\*' | sed -e 's/^\\* //'"))))
+ (if (> (length git-output) 0)
+ (concat " :" (substring git-output 0 -1))
+ "(no branch)"))))
+
+
+
+
+(defun pwd-replace-home (pwd)
+ "Replace home in PWD with tilde (~) character."
+ (interactive)
+ (let* ((home (expand-file-name (getenv "HOME")))
+ (home-len (length home)))
+ (if (and
+ (>= (length pwd) home-len)
+ (equal home (substring pwd 0 home-len)))
+ (concat "~" (substring pwd home-len))
+ pwd)))
+
+
+
+
+(defun pwd-shorten-dirs (pwd)
+ "Shorten all directory names in PWD except the last two."
+ (let ((p-lst (split-string pwd "/")))
+ (if (> (length p-lst) 2)
+ (concat
+ (mapconcat (lambda (elm) (if (zerop (length elm)) ""
+ (substring elm 0 1)))
+ (butlast p-lst 2)
+ "/")
+ "/"
+ (mapconcat (lambda (elm) elm)
+ (last p-lst 2)
+ "/"))
+ pwd ;; Otherwise, we just return the PWD
+ )))
+
+;; Turn off the default prompt.
+(setq eshell-highlight-prompt nil)
+
+
+
+
+(defun split-directory-prompt (directory)
+ (if (string-match-p ".*/.*" directory)
+ (list (file-name-directory directory) (file-name-base directory))
+ (list "" directory)))
+
+
+(setq eshell-prompt-function
+ (lambda ()
+ (let* ((directory (split-directory-prompt (pwd-shorten-dirs (pwd-replace-home (eshell/pwd)))))
+ (parent (car directory))
+ (name (cadr directory))
+ (branch (or (curr-dir-git-branch-string (eshell/pwd)) "")))
+
+ (if (eq 'dark (frame-parameter nil 'background-mode))
+ (concat ;; Prompt for Dark Themes
+ (propertize parent 'face `(:foreground "#8888FF"))
+ (propertize name 'face `(:foreground "#8888FF" :weight bold))
+ (propertize branch 'face `(:foreground "green"))
+ (propertize " $" 'face `(:weight ultra-bold))
+ (propertize " " 'face `(:weight bold)))
+
+ (concat ;; Prompt for Light Themes
+ (propertize parent 'face `(:foreground "blue"))
+ (propertize name 'face `(:foreground "blue" :weight bold))
+ (propertize branch 'face `(:foreground "dark green"))
+ (propertize " $" 'face `(:weight ultra-bold))
+ (propertize " " 'face `(:weight bold)))))))
+
+
+
+(setq eshell-highlight-prompt nil)
+
+
+
+(when (require 'esh-buf-stack nil t)
+ (setup-eshell-buf-stack)
+ (add-hook 'eshell-mode-hook
+ (lambda () (local-set-key (kbd "M-q") 'eshell-push-command))))
+
+(defun eshell/x ()
+ "Closes the EShell session and gets rid of the EShell window."
+ (kill-buffer)
+ (delete-window))
+
+
+(defun eshell-here ()
+ "Opens up a new shell in the directory associated with the
+current buffer's file. The eshell is renamed to match that
+directory to make multiple eshell windows easier."
+ (interactive)
+ (let* ((parent (if (buffer-file-name)
+ (file-name-directory (buffer-file-name))
+ default-directory))
+ (height (/ (window-total-height) 3))
+ (name (car (last (split-string parent "/" t)))))
+ (split-window-vertically (- height))
+ (other-window 1)
+ (eshell "new")
+ (rename-buffer (concat "*eshell: " name "*"))
+
+ (insert (concat "ls"))
+ (eshell-send-input)))
+
+(global-set-key (kbd "C-!") 'eshell-here)
+
+
+
+(add-hook 'eshell-mode-hook
+ (lambda ()
+ (local-set-key (kbd "M-P") 'eshell-previous-prompt)
+ (local-set-key (kbd "M-N") 'eshell-next-prompt)
+ (local-set-key (kbd "M-R") 'eshell-list-history)
+ (local-set-key (kbd "M-r")
+ (lambda ()
+ (interactive)
+ (insert
+ (ido-completing-read "Eshell history: "
+ (delete-dups
+ (ring-elements eshell-history-ring))))))))
+
+
+
+
+(require 'em-smart)
+(setq eshell-where-to-jump 'begin)
+(setq eshell-review-quick-commands nil)
+(setq eshell-smart-space-goes-to-end t)
+
+
+
+(defun execute-command-on-file-buffer (cmd)
+ (interactive "sCommand to execute: ")
+ (let* ((file-name (buffer-file-name))
+ (full-cmd (concat cmd " " file-name)))
+ (shell-command full-cmd)))
+
+(defun execute-command-on-file-directory (cmd)
+ (interactive "sCommand to execute: ")
+ (let* ((dir-name (file-name-directory (buffer-file-name)))
+ (full-cmd (concat "cd " dir-name "; " cmd)))
+ (shell-command full-cmd)))
+
+(global-set-key (kbd "A-1") 'execute-command-on-file-buffer)
+(global-set-key (kbd "A-!") 'execute-command-on-file-directory)
+
+
+
+
+
+
+
+;; Added by Package.el. This must come before configurations of
+;; installed packages. Don't delete this line. If you don't want it,
+;; just comment it out by adding a semicolon to the start of the line.
+;; You may delete these explanatory comments.
+(package-initialize)
+
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))
(require 'init-base)
(require 'init-font)
-(require 'init-color-theme)
+;(require 'init-color-theme)
+(require 'init-color-theme-2)
;(require 'init-ido)
(require 'init-magit)
-(require 'init-evil)
+;(require 'init-evil)
(require 'init-project)
(require 'init-ggtags)
;;;; conflict with C-c . in org-mode, disable it temporarily
;;;;(require 'init-c-cpp)
-(require 'init-key-binding)
+;(require 'init-key-binding)
(require 'init-winner)
(require 'init-minibuffer)
(require 'init-eshell)
;;;(ac-linum-workaround)
-(require 'init-mode-line)
+;(require 'init-mode-line)
;(require 'init-workgroup2)
(require 'init-perl)
;(add-to-list 'load-path "~/.emacs.d/Emacs-PDE-0.2.16/lisp/")
;(load "pde-load") ;
-(require 'init-linum)
+;(require 'init-linum)
(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
-(require 'init-helm)
+;(require 'init-helm)
;; page break configuration
;(require 'pp-c-l)
(require 'init-multi-term)
-(require 'init-projectile)
+;(require 'init-projectile)
(require 'page-break-lines)
;(turn-on-page-break-lines-mode)
-(require 'helm-ag)
-(require 'flx)
-(flx-ido-mode t)
+;(require 'helm-ag)
+;(require 'flx)
+;(flx-ido-mode t)