emacs.el
changeset 13 7dc464c4e2d3
parent 11 b2593783458d
equal deleted inserted replaced
12:272dd4613dd9 13:7dc464c4e2d3
     9 (setq-default inhibit-splash-screen t)                                ; disable splash screen
     9 (setq-default inhibit-splash-screen t)                                ; disable splash screen
    10 (setq-default truncate-lines t)
    10 (setq-default truncate-lines t)
    11 (put 'set-goal-column 'disabled nil)                                  ; enable goal column setting
    11 (put 'set-goal-column 'disabled nil)                                  ; enable goal column setting
    12 (put 'narrow-to-region 'disabled nil)                                 ; enable hiding
    12 (put 'narrow-to-region 'disabled nil)                                 ; enable hiding
    13 
    13 
    14 (menu-bar-mode nil)                                                   ; remove menu bar in no-x mode
    14 (menu-bar-mode nil)                                                   ; remove menu bar
    15 (display-time-mode t)                                                 ; show clock
    15 (display-time-mode t)                                                 ; show clock
    16 (column-number-mode t)                                                ; show column numbers
    16 (column-number-mode t)                                                ; show column numbers
    17 (delete-selection-mode t)                                             ; replace highlighted text
    17 (delete-selection-mode t)                                             ; replace highlighted text
    18 (windmove-default-keybindings)                                        ; move between windows with shift-arrow
    18 (windmove-default-keybindings)                                        ; move between windows with shift-arrow
    19 (setq-default indent-tabs-mode nil)                                   ; mouse hover variables
    19 (setq-default indent-tabs-mode nil)                                   ; mouse hover variables
       
    20 (ido-mode t)                                                          ; file/buffer selector
       
    21 (setq-default ido-enable-flex-matching t)                             ; fuzzy matching for ido mode
       
    22 (add-hook 'text-mode-hook 'flyspell-mode t)                           ; spellcheck text
    20 
    23 
    21 (ido-mode t)                                                          ; file/buffer selector
    24 ;; whitespace
    22 (setq-default ido-enable-flex-matching t)                             ; fuzzy matching is a must have
    25 (global-whitespace-mode t)                                            ; show whitespace
    23 (add-hook 'text-mode-hook 'flyspell-mode t)                           ; spellcheck text
    26 (add-hook 'before-save-hook 'whitespace-cleanup)                      ; cleanup whitespace on exit
       
    27 (setq-default whitespace-line-column 120)                             ; column width
       
    28 (setq-default whitespace-style
       
    29               '(tabs tab-mark trailing lines-tail
       
    30                      space-before-tab indentation empty))             ; what whitespace elements to show
    24 
    31 
    25 ;; coding
    32 ;; coding
    26 (which-func-mode t)                                                   ; show current function
    33 (which-func-mode t)                                                   ; show current function
    27 (show-paren-mode t)                                                   ; show matching paren
    34 (show-paren-mode t)                                                   ; show matching paren
    28 (transient-mark-mode t)                                               ; show highlighting
    35 (transient-mark-mode t)                                               ; show highlighting
    29 (global-font-lock-mode t)                                             ; syntax highlighting
    36 (global-font-lock-mode t)                                             ; syntax highlighting
    30 (global-whitespace-mode t)                                            ; show whitespace
       
    31 (global-linum-mode t)
       
    32 (add-hook 'before-save-hook 'whitespace-cleanup)                      ; cleanup whitespace on exit
       
    33 (global-set-key (kbd "C-c c") 'compile)                               ; compile
    37 (global-set-key (kbd "C-c c") 'compile)                               ; compile
    34 (global-set-key (kbd "C-c r") 'recompile)                             ; recompile
    38 (global-set-key (kbd "C-c r") 'recompile)                             ; recompile
    35 (setq-default whitespace-line-column 120)                             ; column width
       
    36 (setq-default whitespace-style
       
    37               '(tabs tab-mark trailing lines-tail
       
    38                      space-before-tab indentation empty))             ; what whitespace elements to show
       
    39 
    39 
       
    40 ;; includes
    40 (require 'hoersten-pastebin-region)                                   ; send selected text to pastebin
    41 (require 'hoersten-pastebin-region)                                   ; send selected text to pastebin
    41 (require 'mercurial)                                                  ; load mercurial mode
    42 (require 'mercurial)                                                  ; load mercurial mode
    42 (require 'nav)                                                        ; load nav bar
    43 (require 'nav)                                                        ; load nav bar
    43 (require 'hoersten-c-style)                                           ; load c specific lisp
    44 (require 'hoersten-c-style)                                           ; load c specific lisp
    44 
    45 
    45 (require 'pretty-mode)                                                ; convert characters to unicode
    46 ;; unicode
       
    47 (require 'pretty-mode)
    46 (global-pretty-mode t)
    48 (global-pretty-mode t)
    47 (setq haskell-font-lock-symbols 'unicode)
    49 (setq haskell-font-lock-symbols 'unicode)
    48 
    50 
       
    51 ;; snippets
    49 (require 'yasnippet)
    52 (require 'yasnippet)
    50 (yas/initialize)
    53 (yas/initialize)
    51 (yas/load-directory "~/.emacs.d/snippets/")
    54 (yas/load-directory "~/.emacs.d/snippets/")
    52 
    55 
    53 ;; gdb settings
    56 ;; shell
    54 (setq-default gdb-many-windows t)                                     ; gdb many windows
    57 (global-set-key (kbd "C-c s") 'shell)              ; start shell
    55 (setq-default gdb-use-separate-io-buffer t)                           ; gdb stdio output
    58 (ansi-color-for-comint-mode-on)                    ; color in shell buffer
    56 (setq-default gud-tooltip-mode t)                                     ; mouse hover variables
    59 (setq-default comint-scroll-to-bottom-on-input t)  ; only type on prompt
    57 (global-set-key (kbd "C-c g") 'gdb)                                   ; gdb
    60 (setq-default comint-scroll-show-maximum-output t) ; place text at bottom
       
    61 
       
    62 ;; org mode
       
    63 (add-hook 'org-mode-hook
       
    64           '(lambda ()
       
    65              (local-set-key (kbd "M-p") 'org-move-item-up)
       
    66              (local-set-key (kbd "M-S-p") 'org-move-subtree-up)
       
    67              (local-set-key (kbd "M-n") 'org-move-item-down)
       
    68              (local-set-key (kbd "M-S-n") 'org-move-subtree-down)))
       
    69 
       
    70 ;; unique buffer names with dirs
       
    71 (require 'uniquify)
       
    72 (setq
       
    73  uniquify-buffer-name-style 'post-forward
       
    74  uniquify-separator ":")
       
    75 
       
    76 ;; line numbers
       
    77 ;;(global-linum-mode t)
       
    78 (mapc (lambda (x)
       
    79         (add-hook x 'linum-mode))
       
    80       '(text-mode-hook
       
    81         c-mode-common-hook
       
    82         python-mode-hook
       
    83         haskell-mode-hook
       
    84         emacs-lisp-mode-hook))
    58 
    85 
    59 ;; use only spaces for alignment
    86 ;; use only spaces for alignment
    60 (global-set-key (kbd "C-c a") 'align-with-spaces) ; align
    87 (global-set-key (kbd "C-c a") 'align-with-spaces) ; align
    61 (defun align-with-spaces (beg end pattern)
    88 (defun align-with-spaces (beg end pattern)
    62   "Align selected using only spaces for whitespace."
    89   "Align selected using only spaces for whitespace."
    66     (align-entire beg end)
    93     (align-entire beg end)
    67     (untabify beg end)
    94     (untabify beg end)
    68     (indent-region beg end)
    95     (indent-region beg end)
    69     (whitespace-cleanup-region beg end)))
    96     (whitespace-cleanup-region beg end)))
    70 
    97 
    71 ;; Shell
    98 ;; x stuff
    72 (global-set-key (kbd "C-c s") 'shell)              ; start shell
    99 (if window-system
    73 (ansi-color-for-comint-mode-on)                    ; color in shell buffer
   100     (progn
    74 (setq-default comint-scroll-to-bottom-on-input t)  ; only type on prompt
   101       (tool-bar-mode nil)   ; remove tool bar
    75 (setq-default comint-scroll-show-maximum-output t) ; place text at bottom
   102       (scroll-bar-mode nil) ; remove scroll bar
       
   103       (visual-line-mode t)  ; word wrap break on whitespace
       
   104       (set-default-font "Monospace-10")
    76 
   105 
    77 ;; map file extensions to modes
   106       ;; twilight theme
    78 (setq-default auto-mode-alist
   107       (require 'color-theme)
    79               (append
   108       (load "color-theme-twilight")
    80                '(("\\.ipp$" . c++-mode)
   109       (color-theme-twilight)
    81                  ("\\.inl$" . c++-mode)
   110       (global-hl-line-mode t)))
    82                  ("SCons"   . python-mode)
       
    83                  ("\\.jj$"  . java-mode))
       
    84                auto-mode-alist))
       
    85 
       
    86 ;; x stuff
       
    87 (if (not window-system) nil
       
    88   (tool-bar-mode nil)   ; remove tool bar
       
    89   (scroll-bar-mode nil) ; remove scroll bar
       
    90   (visual-line-mode t)  ; word wrap break on whitespace
       
    91   (set-default-font "Monospace-10")
       
    92 
       
    93   ;; twilight theme
       
    94   (require 'color-theme)
       
    95   (load "color-theme-twilight")
       
    96   (color-theme-twilight)
       
    97   (global-hl-line-mode t))