;; ;; LOAD LIBRARIES ;; ;; ~/emacs is the default directory (add-to-list 'load-path "~/emacs/elisp") (add-to-list 'load-path "~/emacs/color-theme") ;; ;; DISPLAY ;; ;; Load theme ;; (require 'color-theme) ;; (color-theme-initialize) ;; (color-theme-clarity) ;; Invert background - foreground (set-foreground-color "lightgray") (set-background-color "black") ;; Set window at startup (setq initial-frame-alist '((left . 5) (top . 0) (width . 195) (height . 49))) ;; Automatic Display Of Matching Parentheses (show-paren-mode) ;; syntax highlightning on (global-font-lock-mode t) ;; display column numbers (column-number-mode 't) ;; ;; ENVIROMENT ;; ;; C-8 for *scratch*, C-9 for *compilation*, C-7 for *Buffer List* ;; (global-set-key [(control \8)] ;; (lambda () (interactive) (switch-to-buffer "*scratch*"))) ;; (global-set-key [(control \9)] ;; (lambda () (interactive) (switch-to-buffer "*compilation*"))) ;; (global-set-key [(control \7)] ;; (lambda () (interactive) (switch-to-buffer "*Buffer List*"))) ;; scroll with wheel-mice (mouse-wheel-mode t) ;; Changes all yes/no questions to y/n type (fset 'yes-or-no-p 'y-or-n-p) ;; make all backups in a single directory (setq backup-directory-alist `(("." . ,(expand-file-name "~/.emacs.d/backups")))) ;; hippie-expand functions (setq hippie-expand-try-functions-list '(try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs ;try-expand-list ;try-expand-line try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol)) ;; Enable the Emacs server (server-start) ;; ;; EDITING ;; ;; remove trailing whitespaces before saving (add-hook 'before-save-hook 'delete-trailing-whitespace) ;; ;; KEY BINDINGS ;; ;; Invoke M-x without the alt key (global-set-key "\C-x\C-m" 'execute-extended-command) (global-set-key "\C-c\C-m" 'execute-extended-command) ;; enter indents automatically (global-set-key (kbd "RET") 'newline-and-indent) ;; C-k is kill-whole-line ;;(global-set-key (kbd "C-k") 'kill-whole-line) ;; Use kill word instead of backspace. Remap kill region (global-set-key "\C-w" 'backward-kill-word) (global-set-key "\C-x\C-k" 'kill-region) (global-set-key "\C-c\C-k" 'kill-region) ;; make commenting/uncommenting easy (global-set-key (kbd "C-;") 'comment-region) (global-set-key (kbd "C-'") 'uncomment-region) ;; Expand with Alt-s (global-set-key (kbd "M-s") 'hippie-expand) ;; windmove: easily move between windows (global-set-key (kbd "M-") 'windmove-down) (global-set-key (kbd "M-") 'windmove-up) (global-set-key (kbd "M-") 'windmove-right) (global-set-key (kbd "M-") 'windmove-left) ;; reload changed buffer (global-set-key "\M-r" 'revert-buffer) ;; repeat commands (global-set-key "\C-x." 'repeat) ;; ;; ENCODING ;; ;; Set UTF-8 (set-default-coding-systems 'utf-8) (set-keyboard-coding-system 'utf-8) (set-clipboard-coding-system 'utf-8) (set-terminal-coding-system 'utf-8) (prefer-coding-system 'utf-8) ;; run a few shells. ;(shell "*shell5*") ;(shell "*shell6*") ;(shell "*shell7*") ;; C-5, 6, 7 to switch to shells ;(global-set-key [(control \4)] ; (lambda () (interactive) (switch-to-buffer "*shell5*"))) ;(global-set-key [(control \6)] ; (lambda () (interactive) (switch-to-buffer "*shell6*"))) ;(global-set-key [(control \7)] ; (lambda () (interactive) (switch-to-buffer "*shell7*"))) ;; ;; PROGRAMMING ;; ;; use html mode for the pyblosxom 1025px flavour files (setq auto-mode-alist (cons '("\\.1025px$" . html-mode) auto-mode-alist)) ;; python mode ;; (require 'python-mode) ;; (setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist)) ;; Add TODO keyword (font-lock-add-keywords 'python-mode '(("\\<\\(FIXME\\|HACK\\|XXX\\|TODO\\)" 1 font-lock-warning-face prepend))) ;; textile mode (require 'textile-mode) (add-to-list 'auto-mode-alist '("\\.txtl$" . textile-mode)) ;; ;; LaTeX ;; ;; enable document parsing (setq TeX-auto-save t) (setq TeX-parse-self t) ;; multi-documents ;;(setq-default TeX-master nil) ;; ;; ALIAS ;; (defalias 'qrr 'query-replace-regexp) ;; ;; CUSTOM THINGS ;; (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ;; Mac key bindings ;'(mac-command-modifier (quote alt)) ;'(mac-pass-command-to-system nil) ;'(mac-pass-control-to-system nil) ;; Remove annoying ~ files ;;'(make-backup-files nil) ) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. )