2 (setq debug-on-error t)
7 (add-to-list 'default-frame-alist '(width . 120))
8 (add-to-list 'default-frame-alist '(height . 40))
9 ;(add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12:weight:light" ))
10 (add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-14" ))
11 (load-theme 'tango-dark)
13 (put 'set-goal-column 'disabled nil)
14 (setq vc-follow-symlinks t)
16 (setq ring-bell-function 'ignore)
17 (setq resize-mini-windows t)
18 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 ;http://y.tsutsumi.io/emacs-from-scratch-part-2-package-management.html
21 (add-to-list 'package-archives
22 '("melpa" . "http://melpa.milkbox.net/packages/") t)
25 (defvar required-packages
35 color-theme-sanityinc-tomorrow
47 color-identifiers-mode
48 ) "a list of packages to ensure are installed at launch.")
51 (defun packages-installed-p ()
52 (loop for p in required-packages
53 when (not (package-installed-p p)) do (return nil)
56 (unless (packages-installed-p)
57 (message "%s" "Emacs is now refreshing its package database...")
58 (package-refresh-contents)
59 (message "%s" " done.")
60 (dolist (p required-packages)
61 (when (not (package-installed-p p))
62 (package-install p))))
63 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
65 (setq fiplr-root-markers '(".git" ".svn" "*.DS_Store"))
66 (setq fiplr-ignored-globs '((directories (".git" ".svn"))
67 (files ("*.jpg" "*.png" "*.zip" "*~" "*.o" ".obj" "*.swp" "*.hg" ".pyc" ".*" ))))
70 ;(setq mac-right-option-modifier 'control)
72 (global-set-key (kbd "C-x f") 'fiplr-find-file)
73 ;;;; ------------------------------------ Ido ---------------------------------------------
77 (setq ido-use-faces nil)
78 (setq ido-enable-flex-matching t)
79 (require 'ido-vertical-mode)
80 (setq ido-use-faces t)
81 (set-face-attribute 'ido-vertical-first-match-face nil
82 :background "#e5b7c0")
83 (set-face-attribute 'ido-vertical-only-match-face nil
86 (set-face-attribute 'ido-vertical-match-face nil
87 :foreground "#b00000")
92 (global-set-key (kbd "M-x") 'smex)
93 (global-set-key (kbd "M-X") 'smex-major-mode-commands)
94 ;;;; ----------------------------------------------------------------------------------------
96 ;;;; ---------------------------------- evil ------------------------------------------------
97 (global-evil-leader-mode)
98 (evil-leader/set-leader ";")
99 (evil-leader/set-key "e" 'find-file)
100 (evil-leader/set-key "b" 'switch-to-buffer)
102 ;;Exit insert mode by pressing j and then j quickly
103 ;(setq key-chord-two-keys-delay 0.5)
104 ;(key-chord-define evil-normal-state-map "jj" 'evil-force-normal-state)
105 (key-chord-define evil-visual-state-map "jj" 'evil-change-to-previous-state)
106 (key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
107 (key-chord-define evil-replace-state-map "jj" 'evil-normal-state)
110 ;; change mode-line color by evil state
111 (lexical-let ((default-color (cons (face-background 'mode-line)
112 (face-foreground 'mode-line))))
113 (add-hook 'post-command-hook
115 (let ((color (cond ((minibufferp) default-color)
116 ((evil-insert-state-p) '("#e80000" . "#ffffff"))
117 ((evil-emacs-state-p) '("#444488" . "#ffffff"))
118 ((buffer-modified-p) '("#006fa0" . "#ffffff"))
120 (set-face-background 'mode-line (car color))
121 (set-face-foreground 'mode-line (cdr color))))))
123 ;;(require 'powerline-evil)
124 ;; TODO: enter emacs mode in eshll rather then evil mode
126 ;;;; ---------------------------------- evil ------------------------------------------------
128 ;;;; ------------------------------------ helm ---------------------------------------------
129 ;;;;;;;;;;; helm configuration https://github.com/emacs-helm/helm http://tuhdo.github.io/helm-intro.html
130 ;;(require 'helm-config)
131 ;;(global-set-key (kbd "M-x") 'helm-M-x)
133 ;;(setq helm-M-x-fuzzy-match t)
134 ;;(global-set-key (kbd "C-x b") 'helm-mini)
135 ;;(setq helm-buffers-fuzzy-matching t
136 ;; helm-recentf-fuzzy-match t)
137 ;;(global-set-key (kbd "C-x C-f") 'helm-find-files)
138 ;;(when (executable-find "ack-grep")
139 ;; (setq helm-grep-default-command "ack-grep -Hn --no-group --no-color %e %p %f"
140 ;; helm-grep-default-recurse-command "ack-grep -H --no-group --no-color %e %p %f"))
141 ;;(setq helm-ff-skip-boring-files t)
142 ;;;(require 'helm-config)
143 ;;;(require 'helm-themes)
144 ;;;(set-face-attribute 'helm-selection nil :background "#441100")
145 ;;;; ----------------------------------------------------------------------------------------
148 ;; will get ad-handle-definition: got redefined
150 ;(setq magit-auto-revert-mode nil)
151 (setq magit-last-seen-setup-instructions "1.4.0")
153 (require 'auto-complete)
154 (auto-complete-mode 1)
157 ;;; ---------------------------------------- el-get -----------------------------------------
159 ;(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
161 ;(el-get-bundle packages/sm-package-powerline
162 ; :url "https://github.com/laynor/emacs-conf.git"
166 ;;; -----------------------------------------------------------------------------------------
167 ;(add-to-list 'load-path "~/.emacs.d/test/powerline")
170 (add-hook 'emacs-lisp-mode-hook 'color-identifiers-mode)
171 (global-font-lock-mode 1)
172 (setq my/font-family "Source Code Pro")
173 (set-frame-font my/font-family)
174 (set-face-attribute 'default nil :font my/font-family :height 120)
175 (set-face-font 'default my/font-family)
179 ;;;;;;;;;;;;;;;; color theme
180 (require 'color-theme)
181 (defun org-src-color-blocks-light ()
182 "Colors the block headers and footers to make them stand out more for lighter themes"
185 '(org-block-begin-line
186 ((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
187 '(org-block-background
188 ((t (:background "#FFFFEA"))))
190 ((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF"))))
192 '(mode-line-buffer-id ((t (:foreground "#005000" :bold t))))
193 '(which-func ((t (:foreground "#008000")))))
195 ;; Looks like the minibuffer issues are only for v23
196 ; (set-face-foreground 'minibuffer "black")
197 ; (set-face-foreground 'minibuffer-prompt "red")
200 (defun org-src-color-blocks-dark ()
201 "Colors the block headers and footers to make them stand out more for dark themes"
204 '(org-block-begin-line
205 ((t (:foreground "#008ED1" :background "#002E41"))))
206 '(org-block-background
207 ((t (:background "#111111"))))
209 ((t (:foreground "#008ED1" :background "#002E41"))))
211 '(mode-line-buffer-id ((t (:foreground "black" :bold t))))
212 '(which-func ((t (:foreground "green")))))
214 ;; Looks like the minibuffer issues are only for v23
215 ;; (set-face-foreground 'minibuffer "white")
216 ;; (set-face-foreground 'minibuffer-prompt "white")
219 (deftheme ha/org-theme "Sub-theme to beautify org mode")
222 (defun ha/change-theme (theme org-block-style)
223 "Changes the color scheme and reset the mode line."
226 (funcall org-block-style)
228 (let* ((sans-font (cond ((x-list-fonts "Source Sans Pro") '(:font "Source Sans Pro"))
229 ((x-list-fonts "Lucida Grande") '(:font "Lucida Grande"))
230 ((x-list-fonts "Verdana") '(:font "Verdana"))
231 ((x-family-fonts "Sans Serif") '(:family "Sans Serif"))
232 (nil (warn "Cannot find a Sans Serif Font. Install Source Sans Pro."))))
233 (base-font-color (face-foreground 'default nil 'default))
234 (background-color (face-background 'default nil 'default))
235 (primary-color (face-foreground 'mode-line nil))
236 (secondary-color (face-background 'secondary-selection nil 'region))
237 (headline `(:inherit default :weight bold :foreground ,base-font-color)))
238 (custom-theme-set-faces 'ha/org-theme
239 `(org-agenda-structure ((t (:inherit default ,@sans-font :height 2.0 :underline nil))))
240 `(org-level-8 ((t (,@headline ,@sans-font))))
241 `(org-level-7 ((t (,@headline ,@sans-font))))
242 `(org-level-6 ((t (,@headline ,@sans-font))))
243 `(org-level-5 ((t (,@headline ,@sans-font))))
244 `(org-level-4 ((t (,@headline ,@sans-font :height 1.1))))
245 `(org-level-3 ((t (,@headline ,@sans-font :height 1.25))))
246 `(org-level-2 ((t (,@headline ,@sans-font :height 1.5))))
247 `(org-level-1 ((t (,@headline ,@sans-font :height 1.75))))
248 `(org-document-title ((t (,@headline ,@sans-font :height 1.5 :underline nil)))))))
251 (if (equal "howard.abrams" user-login-name)
252 ;(if (equal "peli3" user-login-name)
253 (ha/change-theme 'color-theme-sanityinc-tomorrow-day
254 'org-src-color-blocks-light)
255 (ha/change-theme 'color-theme-sanityinc-tomorrow-night
256 'org-src-color-blocks-dark))
259 ;(define-sequence 'personal-theme-map "<f9> d" 'ha/change-theme
260 ; (list (list "d" 'color-theme-sanityinc-tomorrow-day 'org-src-color-blocks-light) ; White on Black
261 ; (list "l" 'color-theme-sanityinc-tomorrow-eighties 'org-src-color-blocks-dark) ; Lt. Gray on Gray
262 ; (list "m" 'color-theme-sanityinc-tomorrow-bright 'org-src-color-blocks-dark) ; Bright on Black
263 ; (list "n" 'color-theme-sanityinc-tomorrow-night 'org-src-color-blocks-dark))) ; White on Gray
266 (setq which-func-unknown "")
267 (which-function-mode 1)
269 (setq which-func-format
271 (:propertize which-func-current local-map
274 (mouse-3 . end-of-defun)
275 (mouse-2 . narrow-to-defun)
276 (mouse-1 . beginning-of-defun)))
278 mouse-face mode-line-highlight
279 help-echo "mouse-1: go to beginning\n\
280 mouse-2: toggle rest visibility\n\
285 (defun powerline-simpler-vc-mode (s)
287 (replace-regexp-in-string "Git:" "" s)
290 (defun powerline-simpler-minor-display (s)
291 (replace-regexp-in-string
293 (mapconcat 'identity '("Undo-Tree" "GitGutter" "Projectile"
294 "Abbrev" "ColorIds" "MRev" "ElDoc" "Paredit"
295 "+1" "+2" "FlyC" "Fly" ;; ":1/0"
296 "Fill" "AC" "FIC") "\\|")) "" s))
298 (defun powerline-ha-theme ()
299 "A powerline theme that removes many minor-modes that don't serve much purpose on the mode-line."
301 (setq-default mode-line-format
306 (powerline-selected-window-active))
308 (if active 'mode-line 'mode-line-inactive))
310 (if active 'powerline-active1 'powerline-inactive1))
312 (if active 'powerline-active2 'powerline-inactive2))
315 (format "powerline-%s-%s" powerline-default-separator
316 (car powerline-default-separator-dir))))
319 (format "powerline-%s-%s" powerline-default-separator
320 (cdr powerline-default-separator-dir))))
323 (powerline-raw "%*" nil 'l)
324 ;; (powerline-buffer-size nil 'l)
325 (powerline-buffer-id nil 'l)
327 (funcall separator-left mode-line face1)
328 (powerline-narrow face1 'l)
329 (powerline-simpler-vc-mode (powerline-vc face1))))
332 (powerline-raw mode-line-misc-info face1 'r)
333 (powerline-raw global-mode-string face1 'r)
334 (powerline-raw "%4l" face1 'r)
335 (powerline-raw ":" face1)
336 (powerline-raw "%3c" face1 'r)
337 (funcall separator-right face1 mode-line)
339 (powerline-raw "%6p" nil 'r)
340 (powerline-hud face2 face1)))
343 (powerline-raw " " face1)
344 (funcall separator-left face1 face2)
346 (boundp 'erc-modified-channels-object)
347 (powerline-raw erc-modified-channels-object face2 'l))
348 (powerline-major-mode face2 'l)
349 (powerline-process face2)
350 (powerline-raw " :" face2)
352 (powerline-simpler-minor-display (powerline-minor-modes face2 'l))
354 (powerline-raw " " face2)
355 (funcall separator-right face2 face1))))
357 (powerline-render lhs)
358 (powerline-fill-center face1
360 (powerline-width center)
362 (powerline-render center)
363 (powerline-fill face1
364 (powerline-width rhs))
365 (powerline-render rhs)))))))
370 (provide 'init-mode-line)