emacs: 1. fringe-mode disable 2. color scheme 3. emacs major-mode
[dotfiles.git] / emacs / emacs
index c945a7f..2391a1f 100644 (file)
@@ -1,10 +1,21 @@
+
+(setq debug-on-error t)
+
 (scroll-bar-mode -1)
 (tool-bar-mode -1)
+(menu-bar-mode -1)
 (add-to-list 'default-frame-alist '(width  . 120))
 (add-to-list 'default-frame-alist '(height . 40))
-(add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12:weight:light" ))
+;(add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12:weight:light" ))
+(add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12" ))
 (load-theme 'tango-dark)
 
+
+(put 'set-goal-column 'disabled nil)
+(setq vc-follow-symlinks t)
+(setq visible-bell 1)
+(setq ring-bell-function 'ignore)
+(setq resize-mini-windows t)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;http://y.tsutsumi.io/emacs-from-scratch-part-2-package-management.html
 (require 'package)
 
 (defvar required-packages
   '(
-;    magit
+    magit
     helm
     ido-ubiquitous
     yasnippet
+    evil
+    ido-vertical-mode
+    smex
+    color-theme
+    color-theme-sanityinc-tomorrow
+    key-chord
+;    powerline-evil
+    powerline
+    evil-leader
+    flx-ido
+    flx
+    auto-complete
+    fiplr
+    w3m
+    ace-jump-mode
+    el-get
+    color-identifiers-mode
   ) "a list of packages to ensure are installed at launch.")
 
-
-; my-packages.el
 (require 'cl)
-
-; method to check if all packages are installed
 (defun packages-installed-p ()
   (loop for p in required-packages
         when (not (package-installed-p p)) do (return nil)
         finally (return t)))
 
-; if not all packages are installed, check one by one and install the missing ones.
 (unless (packages-installed-p)
-  ; check for new packages (package versions)
   (message "%s" "Emacs is now refreshing its package database...")
   (package-refresh-contents)
   (message "%s" " done.")
-  ; install the missing packages
   (dolist (p required-packages)
     (when (not (package-installed-p p))
       (package-install p))))
                             (files ("*.jpg" "*.png" "*.zip" "*~" "*.o" ".obj" "*.swp" "*.hg" ".pyc" ".*" ))))
 
 
-(setq mac-right-option-modifier 'control)
+;(setq mac-right-option-modifier 'control)
 
 (global-set-key (kbd "C-x f") 'fiplr-find-file)
+;;;; ------------------------------------ Ido ---------------------------------------------
+(ido-mode 1)
+(ido-everywhere 1)
+(flx-ido-mode 1)
+(setq ido-use-faces nil)
+(setq ido-enable-flex-matching t)
+(require 'ido-vertical-mode)
+(setq ido-use-faces t)
+(set-face-attribute 'ido-vertical-first-match-face nil
+                   :background "#e5b7c0")
+(set-face-attribute 'ido-vertical-only-match-face nil
+                   :background "#e52b50"
+                   :foreground "white")
+(set-face-attribute 'ido-vertical-match-face nil
+                   :foreground "#b00000")
+(ido-vertical-mode 1)
+
+;; smex
+(require 'smex) 
+(global-set-key (kbd "M-x") 'smex)
+(global-set-key (kbd "M-X") 'smex-major-mode-commands)
+;;;; ----------------------------------------------------------------------------------------
+
+;;;; ---------------------------------- evil ------------------------------------------------
+(global-evil-leader-mode)
+(evil-leader/set-leader ";")
+(evil-leader/set-key "e" 'find-file)
+(evil-leader/set-key "b" 'switch-to-buffer)
+(require 'evil)
+;;Exit insert mode by pressing j and then j quickly
+;(setq key-chord-two-keys-delay 0.5)
+;(key-chord-define evil-normal-state-map "jj" 'evil-force-normal-state)
+(key-chord-define evil-visual-state-map "jj" 'evil-change-to-previous-state)
+(key-chord-define evil-insert-state-map "jj" 'evil-normal-state)
+(key-chord-define evil-replace-state-map "jj" 'evil-normal-state)
+(key-chord-mode 1)
+
+;; change mode-line color by evil state
+(lexical-let ((default-color (cons (face-background 'mode-line)
+                                  (face-foreground 'mode-line))))
+  (add-hook 'post-command-hook
+           (lambda ()
+             (let ((color (cond ((minibufferp) default-color)
+                                ((evil-insert-state-p) '("#e80000" . "#ffffff"))
+                                ((evil-emacs-state-p)  '("#444488" . "#ffffff"))
+                                ((buffer-modified-p)   '("#006fa0" . "#ffffff"))
+                                (t default-color))))
+               (set-face-background 'mode-line (car color))
+                          (set-face-foreground 'mode-line (cdr color))))))
+;(evil-mode 1)
+;;(require 'powerline-evil)
+;; TODO: enter emacs mode in eshll rather then evil mode
+;;
+;;;; ---------------------------------- evil ------------------------------------------------
+
+;;;; ------------------------------------ helm ---------------------------------------------
+;;;;;;;;;;; helm configuration https://github.com/emacs-helm/helm http://tuhdo.github.io/helm-intro.html
+;;(require 'helm-config)
+;;(global-set-key (kbd "M-x") 'helm-M-x)
+;;(helm-mode 1)
+;;(setq helm-M-x-fuzzy-match t)
+;;(global-set-key (kbd "C-x b") 'helm-mini)
+;;(setq helm-buffers-fuzzy-matching t
+;;      helm-recentf-fuzzy-match    t)
+;;(global-set-key (kbd "C-x C-f") 'helm-find-files)
+;;(when (executable-find "ack-grep")
+;;  (setq helm-grep-default-command "ack-grep -Hn --no-group --no-color %e %p %f"
+;;        helm-grep-default-recurse-command "ack-grep -H --no-group --no-color %e %p %f"))
+;;(setq helm-ff-skip-boring-files t)
+;;;(require 'helm-config)
+;;;(require 'helm-themes)
+;;;(set-face-attribute 'helm-selection nil :background "#441100")
+;;;; ----------------------------------------------------------------------------------------
+
+;; magit
+;; will get ad-handle-definition:  got redefined
+(require 'magit)
+;(setq magit-auto-revert-mode nil)
+(setq magit-last-seen-setup-instructions "1.4.0")
+
+(require 'auto-complete)
+(auto-complete-mode 1)
+
+
+;;; ---------------------------------------- el-get -----------------------------------------
+;(require 'el-get)
+;(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
+
+;(el-get-bundle packages/sm-package-powerline
+;  :url "https://github.com/laynor/emacs-conf.git"
+;  )
+
+
+;;; -----------------------------------------------------------------------------------------
+;(add-to-list 'load-path "~/.emacs.d/test/powerline")
+(require 'powerline)
+
+(add-to-list 'auto-mode-alist '("emacs\\'" . emacs-lisp-mode))
+
+(require 'color-theme)
+
+
+;(color-theme-sanityinc-tomorrow-bright)
+
+;(set-fringe-mode nil)
+(fringe-mode 0)
+(load-theme 'sanityinc-tomorrow-bright t)
 
-;(ido-mode 1)
-;(ido-everywhere 1)
-
-;;;;;;;;; helm configuration https://github.com/emacs-helm/helm http://tuhdo.github.io/helm-intro.html
-(require 'helm-config)
-(global-set-key (kbd "M-x") 'helm-M-x)
-(helm-mode 1)
-(setq helm-M-x-fuzzy-match t)
-(global-set-key (kbd "C-x b") 'helm-mini)
-(setq helm-buffers-fuzzy-matching t
-      helm-recentf-fuzzy-match    t)
-(global-set-key (kbd "C-x C-f") 'helm-find-files)
-(when (executable-find "ack-grep")
-  (setq helm-grep-default-command "ack-grep -Hn --no-group --no-color %e %p %f"
-        helm-grep-default-recurse-command "ack-grep -H --no-group --no-color %e %p %f"))