From: Peng Li Date: Sat, 15 Aug 2015 13:40:31 +0000 (+0800) Subject: emacs - tidy up init.el X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;h=86480c046562f4e62078fa95d5b7fe7f8d3340fd;p=dotfiles.git emacs - tidy up init.el --- diff --git a/emacs.d/config/init-linum.el b/emacs.d/config/init-linum.el index a0f38d5..142403b 100644 --- a/emacs.d/config/init-linum.el +++ b/emacs.d/config/init-linum.el @@ -49,4 +49,18 @@ (global-linum-mode t) (add-hook 'linum-before-numbering-hook 'my-linum-get-format-string) + + + + +;; enable linum-relative in programming mode +;https://github.com/howardabrams/dot-files/blob/master/emacs.org +(add-hook 'prog-mode-hook 'linum-mode) + +;; hight current line +(require 'highlight-current-line) +(highlight-current-line-on t) + + + (provide 'init-linum) diff --git a/emacs.d/config/init-minibuffer.el b/emacs.d/config/init-minibuffer.el new file mode 100644 index 0000000..2d85b1e --- /dev/null +++ b/emacs.d/config/init-minibuffer.el @@ -0,0 +1,18 @@ + + + +;;; set font size of minibuffer +;;;; http://stackoverflow.com/questions/7869429/altering-the-font-size-for-the-emacs-minibuffer-separately-from-default-emacs +(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup) +(defun my-minibuffer-setup () + (set (make-local-variable 'face-remapping-alist) + '((default :height 120)))) + + + +(add-hook 'minibuffer-setup-hook + (lambda () + (make-local-variable 'face-remapping-alist) + (add-to-list 'face-remapping-alist '(default (:background "green"))))) + +(provide 'init-minibuffer) diff --git a/emacs.d/config/init-mode-line.el b/emacs.d/config/init-mode-line.el new file mode 100644 index 0000000..be5bef1 --- /dev/null +++ b/emacs.d/config/init-mode-line.el @@ -0,0 +1,9 @@ + +;; maybe better to fix the size of line number rather scaled 0.8 +;; https://github.com/howardabrams/dot-files/blob/master/emacs.org +(custom-set-faces + '(mode-line ((t (:foreground "#030303" :background "#bdbdbd" :box nil :family "Source Code Pro for Powerline" :height 100)))) + '(mode-line-inactive ((t (:foreground "#f9f9f9" :background "#666666" :box nil :family "Source Code Pro for Powerline" :height 100))))) + + +(provide 'init-mode-line) diff --git a/emacs.d/config/init-perl.el b/emacs.d/config/init-perl.el new file mode 100644 index 0000000..8645bce --- /dev/null +++ b/emacs.d/config/init-perl.el @@ -0,0 +1,69 @@ + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(fringe-mode (quote (4 . 0)) nil (fringe)) + '(ggtags-split-window-function (quote split-window-vertically)) + '(hes-mode-alist + (quote + ((c-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") + (cperl-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") + (c++-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") + (objc-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") + (java-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|u[[:xdigit:]]\\{4\\}\\|[\"'\\bfnrt]\\)\\)") + (js-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]\\{2\\}\\|u[[:xdigit:]]\\{4\\}\\|.\\)\\)") + (js2-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]\\{2\\}\\|u[[:xdigit:]]\\{4\\}\\|.\\)\\)") + (ruby-mode + ("\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]\\{1,2\\}\\|u\\(?:[[:xdigit:]]\\{4\\}\\|{[[:xdigit:]]\\{1,6\\}\\(?:[[:space:]]+[[:xdigit:]]\\{1,6\\}\\)*}\\)\\|.\\)\\)" + (0 + (let* + ((state + (syntax-ppss)) + (term + (nth 3 state))) + (when + (or + (and + (eq term 39) + (member + (match-string 2) + (quote + ("\\" "'")))) + (if + (fboundp + (quote ruby-syntax-expansion-allowed-p)) + (ruby-syntax-expansion-allowed-p state) + (memq term + (quote + (34 47 10 96 t))))) + (add-face-text-property + (match-beginning 1) + (match-end 1) + (quote hes-escape-backslash-face)) + (add-face-text-property + (match-beginning 2) + (match-end 2) + (quote hes-escape-sequence-face)) + nil)) + prepend)))))) + '(org-agenda-files (quote ("~/Private/org/diary.org" "~/temp/org-note.org"))) + '(powerline-text-scale-factor 0.85)) + + + +(defalias 'perl-mode 'cperl-mode) +;(setq cperl-invalid-face nil) + (setq cperl-invalid-face (quote off)) +;(add-hook 'prog-mode-hook '(lambda () +; (highlight-regexp "%[[:alpha:]]\\|\\\\[[:alpha:]]"))) + +(require 'highlight-escape-sequences) +(hes-mode) +;(setq cperl-font-lock t) +(put 'hes-escape-backslash-face 'face-alias 'font-lock-builtin-face) +(put 'hes-escape-sequence-face 'face-alias 'font-lock-builtin-face) + + +(provide 'init-perl) diff --git a/emacs.d/config/init-project.el b/emacs.d/config/init-project.el index 9d4a8d7..25d1539 100644 --- a/emacs.d/config/init-project.el +++ b/emacs.d/config/init-project.el @@ -15,5 +15,4 @@ (require 'projectile-speedbar) - (provide 'init-project) diff --git a/emacs.d/config/init-rencentf.el b/emacs.d/config/init-rencentf.el new file mode 100644 index 0000000..1d68581 --- /dev/null +++ b/emacs.d/config/init-rencentf.el @@ -0,0 +1,17 @@ + +(require 'recentf) +(recentf-mode 1) +(setq recentf-max-menu-items 100) + +;; http://www.emacswiki.org/emacs/RecentFiles +(defun recentf-ido-find-file () + "Find a recent file using Ido." + (interactive) + (let ((file (ido-completing-read "Choose recent file: " recentf-list nil t))) + (when file + (find-file file)))) + + +(require 'recentf-ext) + +(provide 'init-recentf) diff --git a/emacs.d/config/init-winner.el b/emacs.d/config/init-winner.el new file mode 100644 index 0000000..87b3fbe --- /dev/null +++ b/emacs.d/config/init-winner.el @@ -0,0 +1,8 @@ + +(winner-mode 1) + +(global-set-key (kbd "C-c C-l") 'winner-redo) +(global-set-key (kbd "C-c C-h") 'winner-undo) + +(provide 'init-winner) + diff --git a/emacs.d/config/init-workgroup2.el b/emacs.d/config/init-workgroup2.el new file mode 100644 index 0000000..8f90e07 --- /dev/null +++ b/emacs.d/config/init-workgroup2.el @@ -0,0 +1,14 @@ + +(require 'workgroups2) + + +(setq wg-prefix-key (kbd "C-c z")) +(setq wg-session-file "~/.emacs.d/.emacs_workgroups") +(setq wg-mode-line-display-on t) ; Default: (not (featurep 'powerline)) +(setq wg-flag-modified t) ; Display modified flags as well +(setq wg-mode-line-decor-left-brace "[" + wg-mode-line-decor-right-brace "]" ; how to surround it + wg-mode-line-decor-divider ":") +;(workgroups-mode 1) + +(provide 'init-workgroup2) diff --git a/emacs.d/init.el b/emacs.d/init.el index fc7fee9..6c5e788 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -17,197 +17,30 @@ (require 'my-packages) (require 'init-color-theme) - (require 'init-ido) - (require 'init-magit) - (require 'init-evil) - (require 'init-project) - -(require 'projectile-speedbar) - - (require 'init-ggtags) - (setq scroll-margin 5) (setq scroll-conservatively 10000) (show-paren-mode t) (require 'init-c-cpp) - -(require 'recentf) -(recentf-mode 1) -(setq recentf-max-menu-items 100) - - -(require 'recentf-ext) - (require 'init-key-binding) - -(winner-mode 1) - -(global-set-key (kbd "C-c C-l") 'winner-redo) -(global-set-key (kbd "C-c C-h") 'winner-undo) - - - - - - -;;; set font size of minibuffer -;;;; http://stackoverflow.com/questions/7869429/altering-the-font-size-for-the-emacs-minibuffer-separately-from-default-emacs -(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup) -(defun my-minibuffer-setup () - (set (make-local-variable 'face-remapping-alist) - '((default :height 120)))) - - - -(add-hook 'minibuffer-setup-hook - (lambda () - (make-local-variable 'face-remapping-alist) - (add-to-list 'face-remapping-alist '(default (:background "green"))))) - - - - -;;;;;(require 'escape) -;(setq-default evil-escape-delay 0.2) -;(setq evil-escape-excluded-major-modes '(dired-mode)) -;(setq-default evil-escape-key-sequence "jj") -;(evil-escape-mode 1) - - -;; --------------- -;; recent file -(require 'recentf) -(recentf-mode) -;(setq recentf-max-menu-items 100) - -;; http://www.emacswiki.org/emacs/RecentFiles -(defun recentf-ido-find-file () - "Find a recent file using Ido." - (interactive) - (let ((file (ido-completing-read "Choose recent file: " recentf-list nil t))) - (when file - (find-file file)))) - +(require 'init-winner) +(require 'init-minibuffer) ;; http://stackoverflow.com/questions/11484225/fix-an-auto-complete-mode-and-linum-mode-annoyance (ac-linum-workaround) -;; --------------------------------- -;; linum-relative - - -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(fringe-mode (quote (4 . 0)) nil (fringe)) - '(ggtags-split-window-function (quote split-window-vertically)) - '(hes-mode-alist - (quote - ((c-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") - (cperl-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") - (c++-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") - (objc-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]+\\|u[[:xdigit:]]\\{4\\}\\|U[[:xdigit:]]\\{8\\}\\|[\"'?\\abfnrtv]\\)\\)") - (java-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|u[[:xdigit:]]\\{4\\}\\|[\"'\\bfnrt]\\)\\)") - (js-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]\\{2\\}\\|u[[:xdigit:]]\\{4\\}\\|.\\)\\)") - (js2-mode . "\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]\\{2\\}\\|u[[:xdigit:]]\\{4\\}\\|.\\)\\)") - (ruby-mode - ("\\(\\\\\\([0-7]\\{1,3\\}\\|x[[:xdigit:]]\\{1,2\\}\\|u\\(?:[[:xdigit:]]\\{4\\}\\|{[[:xdigit:]]\\{1,6\\}\\(?:[[:space:]]+[[:xdigit:]]\\{1,6\\}\\)*}\\)\\|.\\)\\)" - (0 - (let* - ((state - (syntax-ppss)) - (term - (nth 3 state))) - (when - (or - (and - (eq term 39) - (member - (match-string 2) - (quote - ("\\" "'")))) - (if - (fboundp - (quote ruby-syntax-expansion-allowed-p)) - (ruby-syntax-expansion-allowed-p state) - (memq term - (quote - (34 47 10 96 t))))) - (add-face-text-property - (match-beginning 1) - (match-end 1) - (quote hes-escape-backslash-face)) - (add-face-text-property - (match-beginning 2) - (match-end 2) - (quote hes-escape-sequence-face)) - nil)) - prepend)))))) - '(org-agenda-files (quote ("~/Private/org/diary.org" "~/temp/org-note.org"))) - '(powerline-text-scale-factor 0.85)) - -;; maybe better to fix the size of line number rather scaled 0.8 -;; https://github.com/howardabrams/dot-files/blob/master/emacs.org -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(highlight-current-line-face ((t (:background "gray22")))) - '(linum ((t (:background "#000000" :foreground "gray40" :height 0.8 :slant italic :weigth light)))) - '(linum-relative-current-face ((t (:inherit linum :foreground "Yellow" :weight light :height 0.8)))) - '(mode-line ((t (:foreground "#030303" :background "#bdbdbd" :box nil :family "Source Code Pro for Powerline" :height 100)))) - '(mode-line-inactive ((t (:foreground "#f9f9f9" :background "#666666" :box nil :family "Source Code Pro for Powerline" :height 100))))) - - -;; enable linum-relative in programming mode -;https://github.com/howardabrams/dot-files/blob/master/emacs.org -(add-hook 'prog-mode-hook 'linum-mode) - - -;; hight current line -(require 'highlight-current-line) -(highlight-current-line-on t) - - - - -(require 'workgroups2) - - -(setq wg-prefix-key (kbd "C-c z")) -(setq wg-session-file "~/.emacs.d/.emacs_workgroups") -(setq wg-mode-line-display-on t) ; Default: (not (featurep 'powerline)) -(setq wg-flag-modified t) ; Display modified flags as well -(setq wg-mode-line-decor-left-brace "[" - wg-mode-line-decor-right-brace "]" ; how to surround it - wg-mode-line-decor-divider ":") -;(workgroups-mode 1) - -(defalias 'perl-mode 'cperl-mode) -;(setq cperl-invalid-face nil) - (setq cperl-invalid-face (quote off)) -;(add-hook 'prog-mode-hook '(lambda () -; (highlight-regexp "%[[:alpha:]]\\|\\\\[[:alpha:]]"))) - -(require 'highlight-escape-sequences) -(hes-mode) -;(setq cperl-font-lock t) -(put 'hes-escape-backslash-face 'face-alias 'font-lock-builtin-face) -(put 'hes-escape-sequence-face 'face-alias 'font-lock-builtin-face) - +(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") ;