diff options
| -rw-r--r-- | hoersten-c-style.el | 6 | ||||
| -rw-r--r-- | init.el | 120 |
2 files changed, 70 insertions, 56 deletions
diff --git a/hoersten-c-style.el b/hoersten-c-style.el index a5cb090..783f45f 100644 --- a/hoersten-c-style.el +++ b/hoersten-c-style.el @@ -30,8 +30,10 @@ ;; c-like language settings (c, c++, java, etc.) ;;(require 'doxymacs) -(setq-default c-hungry-delete-key t) ; enable hungry delete -(setq-default c-default-style "hoersten") ; load c-style +(setq-default + c-hungry-delete-key t ; enable hungry delete + c-default-style "hoersten") ; load c-style + (add-hook 'c-mode-common-hook (lambda () @@ -9,11 +9,12 @@ x-select-enable-clipboard t ; paste from X buffer inhibit-splash-screen t ; disable splash screen truncate-lines t ; truncate, not wrap, lines - indent-tabs-mode nil ; mouse hover variables + indent-tabs-mode nil ; only uses spaces for indentation split-width-threshold 181) ; min width to split window horizontially (put 'set-goal-column 'disabled nil) ; enable goal column setting (put 'narrow-to-region 'disabled nil) ; enable hiding +(put 'narrow-to-page 'disabled nil) (menu-bar-mode nil) ; remove menu bar (display-time-mode t) ; show clock @@ -30,9 +31,9 @@ (add-hook 'before-save-hook 'whitespace-cleanup) ; cleanup whitespace on exit (setq-default whitespace-line-column 120 ; column width - whitespace-style ; whitespace elements to show - '(tabs tab-mark trailing lines-tail - space-before-tab indentation empty)) + whitespace-style '(trailing lines-tail empty + indentation space-before-tab + space-after-tab)) ;; coding (which-func-mode t) ; show current function @@ -45,6 +46,53 @@ (global-set-key (kbd "C-c C-c") ; comment 'comment-or-uncomment-region) +;; line numbers +;;(global-linum-mode t) +(mapc + (lambda (x) + (add-hook x 'linum-mode)) + '(text-mode-hook + c-mode-common-hook + python-mode-hook + haskell-mode-hook + emacs-lisp-mode-hook)) + +;; use only spaces for alignment +(global-set-key (kbd "C-c a") 'align-with-spaces) +(defun align-with-spaces (beg end pattern) + "Align selected using only spaces for whitespace." + (interactive "r\nsAlign by: ") + (let ((indent-tabs-mode nil)) + (align-string beg end pattern 1) + (align-entire beg end) + (untabify beg end) + (indent-region beg end) + (whitespace-cleanup-region beg end))) + +;; x stuff +(if window-system + (progn + (tool-bar-mode nil) ; remove tool bar + (scroll-bar-mode nil) ; remove scroll bar + (visual-line-mode t) ; word wrap break on whitespace + (set-default-font "Monospace-10") + + ;; twilight theme + (require 'color-theme) + (load "color-theme-twilight") + (color-theme-twilight) + (global-hl-line-mode t))) + +;; terminal and shell +(global-set-key (kbd "C-c t") '(lambda () (interactive) (ansi-term "bash" "term"))) ; start term +(global-set-key (kbd "C-c s") 'shell) ; start shell - acts like emacs buffer +(ansi-color-for-comint-mode-on) ; color in shell buffer +(setq-default + comint-scroll-to-bottom-on-input t ; only type on prompt + comint-scroll-show-maximum-output t) ; place text at bottom + +;;;;;;;;;;;;; includes & requires ;;;;;;;;;;;;; + ;; includes (require 'hoersten-pastebin-region) ; send selected text to pastebin (require 'hoersten-c-style) ; load c specific lisp @@ -75,6 +123,15 @@ (yas/initialize) (yas/load-directory "~/.emacs.d/yasnippet/snippets/") +;; python mode +(add-hook + 'python-mode-hook + (lambda () + (setq + tab-width 3 + python-indent 3 + indent-tabs-mode t))) + ;; zencoding html (require 'zencoding-mode) (add-hook 'sgml-mode-hook 'zencoding-mode) ; Auto-start on any markup modes @@ -85,56 +142,11 @@ uniquify-buffer-name-style 'post-forward uniquify-separator ":") -;; terminal and shell -(global-set-key (kbd "C-c t") '(lambda () (interactive) (ansi-term "bash" "term"))) ; start term -(global-set-key (kbd "C-c s") 'shell) ; start shell - acts like emacs buffer -(ansi-color-for-comint-mode-on) ; color in shell buffer -(setq-default - comint-scroll-to-bottom-on-input t ; only type on prompt - comint-scroll-show-maximum-output t) ; place text at bottom - ;; org mode (add-hook 'org-mode-hook - '(lambda () - (local-set-key (kbd "M-p") 'org-move-item-up) - (local-set-key (kbd "M-S-p") 'org-move-subtree-up) - (local-set-key (kbd "M-n") 'org-move-item-down) - (local-set-key (kbd "M-S-n") 'org-move-subtree-down))) - -;; line numbers -;;(global-linum-mode t) -(mapc - (lambda (x) - (add-hook x 'linum-mode)) - '(text-mode-hook - c-mode-common-hook - python-mode-hook - haskell-mode-hook - emacs-lisp-mode-hook)) - -;; use only spaces for alignment -(global-set-key (kbd "C-c a") 'align-with-spaces) -(defun align-with-spaces (beg end pattern) - "Align selected using only spaces for whitespace." - (interactive "r\nsAlign by: ") - (let ((indent-tabs-mode nil)) - (align-string beg end pattern 1) - (align-entire beg end) - (untabify beg end) - (indent-region beg end) - (whitespace-cleanup-region beg end))) - -;; x stuff -(if window-system - (progn - (tool-bar-mode nil) ; remove tool bar - (scroll-bar-mode nil) ; remove scroll bar - (visual-line-mode t) ; word wrap break on whitespace - (set-default-font "Monospace-10") - - ;; twilight theme - (require 'color-theme) - (load "color-theme-twilight") - (color-theme-twilight) - (global-hl-line-mode t))) + (lambda () + (local-set-key (kbd "M-p") 'org-move-item-up) + (local-set-key (kbd "M-S-p") 'org-move-subtree-up) + (local-set-key (kbd "M-n") 'org-move-item-down) + (local-set-key (kbd "M-S-n") 'org-move-subtree-down))) |
