 
 ; Appearance {{{
 ; zenburn color theme
-(require 'color-theme-zenburn)
-(color-theme-zenburn)
+(require 'color-theme-zenburn-mod)
+(color-theme-zenburn-mod)
 ; highlight the current cursor line
 (global-hl-line-mode 1)
-(set-face-background 'hl-line "#434443")
+(set-face-background 'hl-line "#323332")
+; disable cursor line highlight during insert mode
+(add-hook 'evil-insert-state-entry-hook
+    (lambda ()
+        (interactive)
+        (global-hl-line-mode 0)
+    )
+)
+(add-hook 'evil-insert-state-exit-hook
+    (lambda ()
+        (interactive)
+        (global-hl-line-mode 1)
+    )
+)
+(add-hook 'evil-visual-state-entry-hook
+    (lambda ()
+        (interactive)
+        (global-hl-line-mode)
+    )
+)
+(add-hook 'evil-visual-state-exit-hook
+    (lambda ()
+        (interactive)
+        (global-hl-line-mode)
+    )
+)
+(add-hook 'evil-emacs-state-entry-hook
+    (lambda ()
+        (interactive)
+        (global-hl-line-mode 0)
+    )
+)
+(add-hook 'evil-emacs-state-exit-hook
+    (lambda ()
+        (interactive)
+        (global-hl-line-mode 1)
+    )
+)
+
+; cursor colors for the various states
+(setq evil-insert-state-cursor '("#ffffff" box))
+(setq evil-emacs-state-cursor '("#ff0000" box))
+(setq evil-normal-state-cursor '("#00ff00" box))
 ; remove splash screen
 (setq inhibit-splash-screen t)
 ; remove toolbar

(define-key evil-insert-state-map [f1] 'save-buffer) ; save
(define-key evil-normal-state-map [f1] 'save-buffer) ; save
(define-key evil-normal-state-map ",w" 'save-buffer) ; save
(define-key evil-normal-state-map ",q" ":q") ; close current window
(define-key evil-normal-state-map ",x" 'save-buffers-kill-emacs) ; save and quit
; window management and navigation
(define-key evil-normal-state-map ",h" 'split-window-vertically)
(define-key evil-normal-state-map ",v" 'split-window-horizontally)
(define-key evil-normal-state-map [tab] 'other-window) ; move to other window
; make "kj" behave as ESC key, adapted from http://article.gmane.org/gmane.emacs.vim-emulation/980
(define-key evil-insert-state-map "k" #'cofi/maybe-exit)
(evil-define-command cofi/maybe-exit ()

; green cursor
(set-cursor-color "#00ff00")
; make the color in set-cursor-color be the default color recognized by Evil
; (for the non-customized states, such as visual mode)
; (this is required because we change the color *after* enabling evil)
(setq evil-default-cursor t)
; stretch the cursor (e.g., make it bigger if hovering over a tab)
