/ .emacs
.emacs
1 ;; Set up the keyboard so the delete key on both the regular keyboard 2 ;; and the keypad delete the character under the cursor and to the right 3 ;; under X, instead of the default, backspace behavior. 4 5 ;; Added by Package.el. This must come before configurations of 6 ;; installed packages. Don't delete this line. If you don't want it, 7 ;; just comment it out by adding a semicolon to the start of the line. 8 ;; You may delete these explanatory comments. 9 ;;(package-initialize) 10 11 (global-set-key [delete] 'delete-char) 12 (global-set-key [kp-delete] 'delete-char) 13 14 (global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally) 15 (global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally) 16 17 ;; My own key bindings ;; 18 ;;(global-set-key [f1] 'compile) 19 20 ;; Turn on font-lock mode for Emacs 21 (global-font-lock-mode t) 22 23 ;; custom-set-faces was added by Custom. 24 ;; If you edit it by hand, you could mess it up, so be careful. 25 ;; Your init file should contain only one such instance. 26 ;; If there is more than one, they won't work right. 27 (custom-set-faces 28 ;; custom-set-faces was added by Custom. 29 ;; If you edit it by hand, you could mess it up, so be careful. 30 ;; Your init file should contain only one such instance. 31 ;; If there is more than one, they won't work right. 32 '(error ((nil (:foreground "Red1")))) 33 '(font-lock-builtin-face ((nil (:foreground "dark slate blue")))) 34 '(font-lock-comment-face ((nil (:foreground "Firebrick")))) 35 '(font-lock-comment-face ((nil (:foreground "red")))) 36 '(font-lock-constant-face ((nil (:foreground "dark cyan")))) 37 '(font-lock-function-name-face ((nil (:foreground "Blue1")))) 38 '(font-lock-keyword-face ((nil (:foreground "Purple")))) 39 '(font-lock-string-face ((nil (:foreground "VioletRed4")))) 40 '(font-lock-type-face ((nil (:foreground "ForestGreen")))) 41 '(font-lock-variable-name-face ((nil (:foreground "sienna")))) 42 '(font-lock-warning-face ((nil (:foreground "Red1")))) 43 '(warning ((nil (:foreground "DarkOrange")))) 44 ) 45 46 ;;(setq require-final-newline t) 47 (setq require-final-newline nil) 48 ;; Stop at the end of the file, not just add lines 49 (setq next-line-add-newlines nil) 50 51 ;; Display columns 52 (setq column-number-mode t) 53 (setq inhibit-splash-screen t) 54 55 ;; vim-Scroll 56 (setq scroll-conservatively 1) 57 58 ;; European datatime format 59 (setq calendar-date-display-form 60 '((if dayname (concat dayname ", ")) day " " monthname " " year)) 61 (setq calendar-time-display-form 62 '(24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))) 63 64 ;; week starts on Monday 65 (setq calendar-week-start-day 1) 66 (setq org-agenda-start-on-weekday 1) 67 68 ;; display week numbers 69 (setq calendar-intermonth-text 70 '(propertize 71 (format "%2d" 72 (car 73 (calendar-iso-from-absolute 74 (calendar-absolute-from-gregorian (list month day year))))) 75 'font-lock-face 'font-lock-warning-face)) 76 77 (setq calendar-intermonth-header 78 (propertize "Wnr" ; or e.g. "KW" in Germany 79 'font-lock-face 'font-lock-keyword-face)) 80 81 (add-hook 'calendar-load-hook 82 (lambda () 83 (calendar-set-date-style 'european))) 84 85 ;; sunrise / sunset 86 ;; (setq calendar-latitude 59.98765) 87 ;; (setq calendar-longitude 10.98765) 88 ;; (setq calendar-location-name "Oslo") 89 90 ;; Various 91 (setq auto-save-default nil) 92 (setq make-backup-files nil) 93 (setq display-time-24hr-format t) 94 (display-time-mode 1) 95 96 ;; UTF-8 support (legacy workaround for Ubuntu) 97 (set-default-coding-systems 'utf-8) 98 (set-terminal-coding-system 'utf-8) 99 (set-keyboard-coding-system 'utf-8) 100 101 (put 'downcase-region 'disabled nil) 102 (kill-buffer "*scratch*") 103 104 (setq split-height-threshold nil) 105 (setq split-width-threshold 160) 106 107 108 ;; Programming section 109 110 ;; Indentation 111 ;;(setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil js-indent-level 4 sgml-basic-offset 4) 112 (setq-default c-basic-offset 4 tab-width 4 indent-tabs-mode nil) 113 ;;(setq js-indent-level 2) 114 ;;(setq-default c-basic-offset 4 tab-width 4) 115 116 ;; Default coding style 117 (setq c-default-style "bsd") 118 119 ;; Don't attempt to guess the Python-indent 120 (setq python-indent-guess-indent-offset nil) 121 122 ;; Bind .ino (Arduino project) extension to C++ mode 123 (add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode)) 124 125 ;; Enable which-function-mode for C, C++ and Python 126 (setq which-func-modes '(c-mode c++-mode java-mode python-mode)) 127 (which-function-mode t) 128 129 ;; Python 130 (require 'whitespace) 131 (setq whitespace-line-column 79) ;; limit line length 132 (setq whitespace-style '(face lines-tail)) 133 (add-hook 'prog-mode-hook 'whitespace-mode) 134 ;;(add-hook 'python-mode-hook 'whitespace-mode) ;; doesn't work in 29 135 136 ;; Custom plugins 137 (add-to-list 'load-path "~/.emacs.d/lisp/") 138 139 ;; PHP 140 ;;(autoload 'php-mode "php-mode" "Mode for editing PHP source files") 141 ;;(add-to-list 'auto-mode-alist '("\\.\\(inc\\|php[s34]?\\)" . php-mode)) 142 143 144 ;; Lua 145 (autoload 'lua-mode "lua-mode" "Lua editing mode." t) 146 (add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode)) 147 ;;(add-to-list 'interpreter-mode-alist '("lua" . lua-mode)) 148 149 ;; Rust 150 ;; (autoload 'rust-mode "rust-mode" nil t) 151 ;; (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) 152 153 ;; Markdown 154 (autoload 'markdown-mode "markdown-mode" 155 "Major mode for editing Markdown files" t) 156 (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) 157 (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) 158 159 (autoload 'gfm-mode "markdown-mode" 160 "Major mode for editing GitHub Flavored Markdown files" t) 161 (add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode)) 162 163 164 ;; YAML 165 (require 'yaml-mode) 166 (add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) 167 168 169 ;; yasnippet 170 (require 'yasnippet) 171 (yas-global-mode 1) 172 (yas/load-directory "~/.emacs.d/snippets") 173 174 175 ;; nginx 176 ;; (require 'nginx-mode)