init.el
changeset 44 6e66ab8d9185
parent 43 cfdd7b253085
child 45 12715da9a300
equal deleted inserted replaced
43:cfdd7b253085 44:6e66ab8d9185
     1 ;; ~/.emacs.d/init.el (~/.emacs)
     1 ;; ~/.emacs.d/init.el (~/.emacs)
     2 ;; Luke Hoersten <[email protected]>
     2 ;; Luke Hoersten <[email protected]>
     3 
     3 
     4 ;;;; General ;;;;
     4 ;;;; General ;;;;
     5 (add-to-list 'load-path "~/.emacs.d")            ; set default emacs load path
     5 (add-to-list 'load-path "~/.emacs.d")     ; set default emacs load path
     6 
     6 
     7 (setq-default
     7 (setq-default
     8  ediff-split-window-function
     8  ediff-split-window-function
     9   'split-window-horizontally              ; diff horizontally
     9   'split-window-horizontally              ; diff horizontally
    10  x-select-enable-clipboard t              ; paste from X buffer
    10  x-select-enable-clipboard t              ; paste from X buffer
    22 
    22 
    23 (column-number-mode t)                    ; show column numbers
    23 (column-number-mode t)                    ; show column numbers
    24 (delete-selection-mode t)                 ; replace highlighted text
    24 (delete-selection-mode t)                 ; replace highlighted text
    25 (windmove-default-keybindings)            ; move between windows with shift-arrow
    25 (windmove-default-keybindings)            ; move between windows with shift-arrow
    26 (fset 'yes-or-no-p 'y-or-n-p)             ; replace yes/no prompts
    26 (fset 'yes-or-no-p 'y-or-n-p)             ; replace yes/no prompts
       
    27 (global-hl-line-mode t)                   ; highlight current line
       
    28 
    27 
    29 
    28 ;;; coding
    30 ;;; coding
    29 (which-func-mode t)                       ; show current function
    31 (which-func-mode t)                       ; show current function
    30 (show-paren-mode t)                       ; show matching paren
    32 (show-paren-mode t)                       ; show matching paren
    31 (transient-mark-mode t)                   ; show highlighting
    33 (transient-mark-mode t)                   ; show highlighting
    37  'comment-or-uncomment-region)            ; toggle region comment
    39  'comment-or-uncomment-region)            ; toggle region comment
    38 
    40 
    39 ;;; Darwin
    41 ;;; Darwin
    40 (if (string-match "darwin" (emacs-version))
    42 (if (string-match "darwin" (emacs-version))
    41     (progn
    43     (progn
    42       (setq-default ns-command-modifier 'control)
    44       (setq-default mac-command-modifier 'meta)))
    43       (tabbar-mode nil)))
       
    44 
    45 
    45 ;;; Xorg
    46 ;;; Xorg
    46 (if window-system
    47 (if window-system
    47     (progn
    48     (progn
    48       (defun get-font ()
    49       (defun get-font ()
    49         "Get appropriate font based on system and hostname."
    50         "Get appropriate font based on system and hostname."
    50         (cond
    51         (cond
    51          ((string-match "darwin" (emacs-version)) "Menlo-12")
    52          ((string-match "darwin" (emacs-version)) "Menlo-12")
    52          ((string-match "HoldenCaulfield" (system-name)) "monospace-6")
    53          ((string-match "HoldenCaulfield" (system-name)) "Ubuntu Mono-6.5")
    53          ((string-match "lhoersten-66113" (system-name)) "monospace-8")
    54          ((string-match "lhoersten-66113" (system-name)) "Ubuntu Mono-8.5")
    54          ("monospace-10")))
    55          ("Ubuntu Mono-10")))
    55 
    56 
    56       (tool-bar-mode -1)      ; remove tool bar
    57       (tool-bar-mode -1)      ; remove tool bar
    57       (scroll-bar-mode -1)    ; remove scroll bar
    58       (scroll-bar-mode -1)    ; remove scroll bar
    58       (visual-line-mode t)    ; word wrap break on whitespace
    59       (visual-line-mode t)    ; word wrap break on whitespace
    59       (global-hl-line-mode t) ; highlight current line
    60       (set-frame-font (get-font)))
    60       (set-frame-font (get-font))))
    61   (menu-bar-mode -1))
    61 
    62 
    62 ;;; terminal
    63 ;;; terminal
    63 (global-set-key (kbd "C-c s") 'eshell) ; start shell
    64 (global-set-key (kbd "C-c s") 'eshell) ; start shell
    64 (add-hook
    65 (add-hook
    65  'eshell-mode-hook
    66  'eshell-mode-hook
   124 (add-to-list 'load-path "~/.emacs.d/thirdparty") ; set default third party path
   125 (add-to-list 'load-path "~/.emacs.d/thirdparty") ; set default third party path
   125 
   126 
   126 ;;; language init
   127 ;;; language init
   127 (require 'c-init)             ; c specific elisp
   128 (require 'c-init)             ; c specific elisp
   128 (require 'haskell-init)       ; haskell specific elisp
   129 (require 'haskell-init)       ; haskell specific elisp
       
   130 (require 'color-theme-init)   ; haskell specific elisp
   129 (require 'vala-mode)          ; vala programming language
   131 (require 'vala-mode)          ; vala programming language
       
   132 (require 'rainbow-delimiters) ; multi-colored parens
   130 
   133 
   131 ;;; function init
   134 ;;; function init
   132 (require 'align-with-spaces)  ; use only spaces for alignment
   135 (require 'align-with-spaces)  ; use only spaces for alignment
   133 (require 'pastebin-region)    ; send selected text to pastebin
   136 (require 'pastebin-region)    ; send selected text to pastebin
   134 (require 'move-line)          ; move line up or down
   137 (require 'move-line)          ; move line up or down
   135 (require 'rainbow-delimiters) ; multi-colored parens
       
   136 
       
   137 ;;; twilight theme
       
   138 (if window-system
       
   139     (progn
       
   140       (require 'color-theme)
       
   141       (load "color-theme-twilight")
       
   142       (color-theme-twilight)))
       
   143 
   138 
   144 ;;; yasnippets
   139 ;;; yasnippets
   145 (add-to-list 'load-path "~/.emacs.d/thirdparty/yasnippet")
   140 (add-to-list 'load-path "~/.emacs.d/thirdparty/yasnippet")
   146 (require 'yasnippet)
   141 (require 'yasnippet)
   147 (yas/initialize)
   142 (yas/initialize)
   148 (yas/load-directory "~/.emacs.d/thirdparty/yasnippet/snippets")
   143 (yas/load-directory "~/.emacs.d/thirdparty/yasnippet/snippets")
   149 (setq-default yas/prompt-functions '(yas/ido-prompt yas/dropdown-prompt)) ; use ido for multiple snippets
   144 (setq-default yas/prompt-functions '(yas/ido-prompt yas/dropdown-prompt)) ; use ido for multiple snippets
       
   145 
       
   146 ;;; java-mode
       
   147 (add-hook 'java-mode-hook (lambda () (setq whitespace-line-column 140)))
   150 
   148 
   151 ;;; zencoding-mode - html
   149 ;;; zencoding-mode - html
   152 (require 'zencoding-mode)
   150 (require 'zencoding-mode)
   153 (add-hook 'sgml-mode-hook 'zencoding-mode) ; Auto-start on any markup modes
   151 (add-hook 'sgml-mode-hook 'zencoding-mode) ; Auto-start on any markup modes
   154 
   152