emacs - add custom.el which store all config generated customize, do
authorPeng Li <seudut@gmail.com>
Thu, 24 Sep 2015 15:08:04 +0000 (23:08 +0800)
committerPeng Li <seudut@gmail.com>
Sat, 19 Dec 2015 14:26:34 +0000 (22:26 +0800)
not edit it.

emacs.d/config/init-colo-theme2.el [new file with mode: 0644]
emacs.d/config/init-color-theme-2.el [new file with mode: 0644]
emacs.d/config/init-eshell.el
emacs.d/config/init-font.el
emacs.d/config/init-multi-term.el
emacs.d/init.el

diff --git a/emacs.d/config/init-colo-theme2.el b/emacs.d/config/init-colo-theme2.el
new file mode 100644 (file)
index 0000000..3795b91
--- /dev/null
@@ -0,0 +1,7 @@
+(require 'color-theme)
+
+(color-theme-sanityinc-tomorrow-bright)
+
+
+
+(provide 'init-color-theme-2)
diff --git a/emacs.d/config/init-color-theme-2.el b/emacs.d/config/init-color-theme-2.el
new file mode 100644 (file)
index 0000000..ba4ca33
--- /dev/null
@@ -0,0 +1,6 @@
+(require 'color-theme)
+
+(load-theme 'sanityinc-tomorrow-bright t)
+
+
+(provide 'init-color-theme-2)
index 9beb3f8..43df27b 100644 (file)
@@ -1,8 +1,189 @@
 
+;;(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)
+
+
+
+
+
+
 
 
 
index 56cb307..4fbf0a7 100644 (file)
   (interactive) (emacs-step-font-size -1))
 
 
-(global-set-key (kbd "C-=") 'increase-emacs-font-size)
-(global-set-key (kbd "C--") 'decrease-emacs-font-size)
+;(global-set-key (kbd "C-=") 'increase-emacs-font-size)
+;(global-set-key (kbd "C--") 'decrease-emacs-font-size)
 
+(global-set-key (kbd "C-=") 'text-scale-increase)
+(global-set-key (kbd "C--") 'text-scale-decrease)
+(text-scale-adjust 2)
 
 
 
index 8fdd9e2..37dc44d 100644 (file)
@@ -9,10 +9,10 @@
 (setq multi-term-program "/bin/zsh")
 (setq system-uses-terminfo nil)
 
-(add-hook 'term-mode-hook
-          (lambda ()
-           (linum-mode -1)
-           (highlight-current-line-on nil)))
+;;(add-hook 'term-mode-hook
+;;          (lambda ()
+;;         (linum-mode -1)
+;;         (highlight-current-line-on nil)))
 
 
 (add-to-list 'term-bind-key-alist '("C-c C-n" . multi-term-next))
index 05ed804..a909f45 100644 (file)
@@ -1,4 +1,11 @@
 
+
+;; 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)