;; Turn off mouse interface early in startup to avoid momentary display (if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) (if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) ;; No splash screen please ... (setq inhibit-startup-message t) ;; display tool tips in echo area only (tooltip-mode -1) (setq tooltip-use-echo-area t) ;; disable mouse scrolling (mouse-wheel-mode -1) (add-to-list 'load-path (concat user-emacs-directory "/lisp/")) (add-to-list 'load-path "/usr/share/emacs/site-lisp/") (load "init-package.el") (require 'better-defaults) (require 'paren-face) (global-paren-face-mode 1) ;; Keep emacs Custom-settings in separate file (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) (load custom-file) ;; sublime-themes must be installed (load-theme 'spolsky t) (set-cursor-color "White") (setq evil-default-cursor '("white" box)) (set-background-color "#181818") ;; smart mode line (setq sml/theme 'respectful) (sml/setup) (require 'visual-regexp-steroids) (define-key global-map (kbd "C-c r") 'vr/replace) (define-key global-map (kbd "C-c q") 'vr/query-replace) ;; use visual-regexp-steroids's isearch instead of the built-in regexp ;; isearch (define-key esc-map (kbd "C-r") 'vr/isearch-backward) ;; C-M-r (define-key esc-map (kbd "C-s") 'vr/isearch-forward) ;; C-M-s (add-hook 'haskell-mode-hook (lambda () (turn-on-haskell-indentation) (turn-on-haskell-doc))) (load "init-dired.el") (require 'tramp) (setq tramp-default-method "ssh") ;; for root connections to remote hosts, log in via ssh with normal ;; user account first, then su/sudo to root (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) (add-to-list 'tramp-default-proxies-alist '((regexp-quote (system-name)) nil nil)) ;; respect the PATH variable on the remote machine (add-to-list 'tramp-remote-path 'tramp-own-remote-path) ;; Backup (file~) disabled and auto-save (#file#) locally to prevent delays in editing remote files (add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil)) (setq tramp-auto-save-directory temporary-file-directory) (setq tramp-verbose 3) ;; Write backup files to own directory ;; TODO: conflicts with previous manipulation of backup-directory-alist (setq backup-directory-alist `(("." . ,(expand-file-name (concat user-emacs-directory "backups"))))) ;; Make backups of files, even when they're in version control (setq vc-make-backup-files t) (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t) (autoload 'js2-mode "js2-mode" nil t) (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) ;; fullscreen mode with F11 (fullscreen-mode 1) (global-set-key (kbd "") 'fullscreen-mode-fullscreen-toggle) (setq scss-compile-at-save nil) ;; (setq whitespace-global-modes '(not erc-mode)) ;; (global-whitespace-mode 1) ;; (set-face-attribute 'whitespace-space nil :background nil :foreground "gray20") ;; (set-face-attribute 'whitespace-newline nil :background nil :foreground "gray20") ;; (setq whitespace-style ;; '(face spaces tabs newline space-mark tab-mark newline-mark)) ;; (setq whitespace-display-mappings ;; ;; all numbers are Unicode codepoint in decimal. try ;; ;; (insert-char 182 ) to see it ;; '( ;; (space-mark 32 [183] [46]) ; 32 SPACE, 183 MIDDLE DOT 「·」, ;; ; 46 FULL STOP 「.」 ;; (newline-mark 10 [182 10]) ; 10 LINE FEED ;; (tab-mark 9 [9655 9] [92 9]) ; 9 TAB, 9655 WHITE ;; ; RIGHT-POINTING TRIANGLE 「▷」 ;; )) (desktop-save-mode t) ;; ediff settings (setq ediff-diff-options "-w") ;; cause Emacs to fully redraw the display *before* it processes queued input events. (setq redisplay-dont-pause t) ;; fewer backslashes in regexp builder (require 're-builder) (setq reb-re-syntax 'string) ;; remove prompt on killing process buffer (setq kill-buffer-query-functions (remq 'process-kill-buffer-query-function kill-buffer-query-functions)) ;; enable narrow-to-region feature (put 'narrow-to-region 'disabled nil) ;; keep the cursor centered to avoid sudden scroll jumps (require 'centered-cursor-mode) ;; disable in terminal modes ;; http://stackoverflow.com/a/6849467/519736 ;; also disable in Info mode, because it breaks going back with the backspace key (define-global-minor-mode my-global-centered-cursor-mode centered-cursor-mode (lambda () (when (not (memq major-mode (list 'Info-mode 'term-mode 'eshell-mode 'shell-mode 'erc-mode))) (centered-cursor-mode)))) (my-global-centered-cursor-mode 1) ;; http://blog.vivekhaldar.com/post/4809065853/dotemacs-extract-interactively-change-font-size (defun my/zoom-in () "Increase font size by 10 points" (interactive) (set-face-attribute 'default nil :height (+ (face-attribute 'default :height) 10))) (defun my/zoom-out () "Decrease font size by 10 points" (interactive) (set-face-attribute 'default nil :height (- (face-attribute 'default :height) 10))) ;; change font size, interactively (global-set-key (kbd "C->") 'my/zoom-in) (global-set-key (kbd "C-<") 'my/zoom-out) ;; easier way to jump to other window (global-set-key (kbd "M-o") 'other-window) (require 'smex) (smex-initialize) (global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "M-X") 'smex-major-mode-commands) (global-set-key (kbd "") 'smex) (global-set-key (kbd "S-") 'smex-major-mode-commands) ;; expand region (global-set-key (kbd "M-@") 'er/expand-region) ;; Swap C-t and C-x, so it's easier to type on Dvorak layout ;; `keyboard-translate` does not work when attaching an emacsclient to ;; a running emacs in daemon mode, so instead we define the key in the ;; key-translation-map. ;; http://lists.gnu.org/archive/html/help-gnu-emacs/2009-10/msg00505.html (define-key key-translation-map [?\C-x] [?\C-t]) (define-key key-translation-map [?\C-t] [?\C-x]) ;; kill current buffer (global-set-key (kbd "C-x C-k") (lambda () (interactive) (kill-buffer (current-buffer)))) ;; delete up to non-whitespace character (global-set-key (kbd "C-c d") 'hungry-delete-forward) (load "email.el") (load "init-ido.el") (load "init-god-mode.el") (load "init-magit.el") (load "init-eshell.el") ;; start in fullscreen mode (add-hook 'emacs-startup-hook (lambda () (fullscreen-mode-fullscreen))) (page-break-lines-mode 1) (global-set-key (kbd "") 'backward-page) (global-set-key (kbd "") 'forward-page) ;; http://whattheemacsd.com/key-bindings.el-01.html#disqus_thread (require 'linum) (global-set-key [remap goto-line] 'my/goto-line-with-feedback) (defun my/goto-line-with-feedback () "Show line numbers temporarily, while prompting for the line number input" (interactive) (let ((line-numbers-off-p (not linum-mode))) (unwind-protect (progn (when line-numbers-off-p (linum-mode 1)) (call-interactively 'goto-line)) (when line-numbers-off-p (linum-mode -1))))) (defun ssh-dtach (host) "Open SSH connection to HOST and start dtach session." (interactive) (let ((explicit-shell-file-name "dtach") (explicit-dtach-args '("-A" "/tmp/emacs.dtach" "-z" "/bin/bash" "--noediting" "-login")) (default-directory (format "/ssh:%s:" host))) (shell (format "*ssh %s*" host)))) ;; show time and date in modeline (display-time-mode 1) (setq display-time-day-and-date t) (require 'info+) (setq Info-fontify-quotations-flag t) (setq Info-fontify-single-quote-flag t) (require 'auto-complete-config) (ac-config-default) (setq ac-auto-start t) (global-auto-complete-mode) (global-prettify-symbols-mode) (defun my/new-empty-buffer () "Open a new empty buffer." (interactive) (let ((buf (generate-new-buffer "untitled"))) (switch-to-buffer buf) (funcall (and initial-major-mode)) (setq buffer-offer-save t))) (global-set-key (kbd "C-c n") 'my/new-empty-buffer)