2012-10-12 22:02:52 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; MAIN
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2013-01-10 17:33:33 +01:00
|
|
|
|
;; Make questions less annoying
|
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2013-01-10 17:33:33 +01:00
|
|
|
|
;; Print column number
|
|
|
|
|
(column-number-mode 1)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
2013-01-10 17:33:33 +01:00
|
|
|
|
;; Kill whole line
|
|
|
|
|
(setq kill-whole-line t)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Modern scrolling
|
|
|
|
|
(global-set-key [next]
|
|
|
|
|
(lambda () (interactive)
|
|
|
|
|
(condition-case nil (scroll-up)
|
|
|
|
|
(end-of-buffer (goto-char (point-max))))))
|
|
|
|
|
|
|
|
|
|
(global-set-key [prior]
|
|
|
|
|
(lambda () (interactive)
|
|
|
|
|
(condition-case nil (scroll-down)
|
|
|
|
|
(beginning-of-buffer (goto-char (point-min))))))
|
|
|
|
|
|
|
|
|
|
;; Line numbers
|
|
|
|
|
(autoload 'linum-mode "linum" "toggle line numbers on/off" t)
|
|
|
|
|
;; (setq linum-format "%-4d ")
|
|
|
|
|
(setq linum-format "%d ")
|
2013-01-10 17:33:33 +01:00
|
|
|
|
(global-linum-mode 1) ;; FIXME: This may generate warnings with emacsclient. Bug?
|
|
|
|
|
(global-set-key (kbd "C-<f5>") 'linum-mode) ;; Toggle line numbers.
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Indentation
|
2013-01-10 17:33:33 +01:00
|
|
|
|
;(setq standard-indent 4)
|
|
|
|
|
(setq-default tab-width 4)
|
|
|
|
|
(setq-default indent-tabs-mode nil) ;; Indentation cannot insert tabs
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Line by line scrolling
|
|
|
|
|
(setq scroll-step 1)
|
|
|
|
|
|
|
|
|
|
;; Highlight selections -- not activated by default on old emacs.
|
|
|
|
|
(transient-mark-mode 1)
|
|
|
|
|
|
|
|
|
|
;; No trailing whitespace
|
|
|
|
|
;; WARNING: this can break some configuration files needing whitespaces at the
|
|
|
|
|
;; end.
|
|
|
|
|
;; (add-hook 'before-save-hook 'delete-trailing-whitespace)
|
|
|
|
|
|
|
|
|
|
;; Abbreviation support
|
|
|
|
|
(setq default-abbrev-mode t)
|
|
|
|
|
|
|
|
|
|
;; Remember last cursor position
|
|
|
|
|
(require 'saveplace)
|
2013-01-10 17:33:33 +01:00
|
|
|
|
(setq save-place-file "~/.emacs.d/saveplace")
|
|
|
|
|
(setq-default save-place t)
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Disable autosave features
|
|
|
|
|
(setq auto-save-default nil)
|
|
|
|
|
|
|
|
|
|
;; Place Backup Files in Specific Directory
|
2013-01-10 17:33:33 +01:00
|
|
|
|
;; (setq backup-inhibited t) ;; Disable backup files.
|
|
|
|
|
;; (setq make-backup-files t) ;; Enable backup files.
|
|
|
|
|
;; (setq version-control t) ;; Enable numbered versioning.
|
|
|
|
|
(setq backup-directory-alist (quote ((".*" . "~/.emacs.d/backups/")))) ;; Save all backup file in this directory.
|
2012-10-12 15:23:36 +02:00
|
|
|
|
|
|
|
|
|
;; Remove menu-bar
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
|
|
|
|
|
|
;; Set Fill Column
|
|
|
|
|
(setq-default fill-column 80)
|
2013-01-10 17:33:33 +01:00
|
|
|
|
;; (auto-fill-mode 1) ;; Will not work because it gets overridden by major modes.
|
2012-10-12 15:23:36 +02:00
|
|
|
|
(add-hook 'text-mode-hook 'turn-on-auto-fill)
|
|
|
|
|
|
|
|
|
|
;; Man-mode
|
|
|
|
|
(setenv "MANWIDTH" "80")
|
|
|
|
|
|
|
|
|
|
;; Windmove mode
|
|
|
|
|
(when (fboundp 'windmove-default-keybindings)
|
|
|
|
|
(windmove-default-keybindings))
|
|
|
|
|
|
|
|
|
|
;; Browser
|
2013-01-26 10:36:35 +01:00
|
|
|
|
(setq browse-url-generic-program (executable-find (getenv "BROWSER"))
|
2012-10-12 15:23:36 +02:00
|
|
|
|
browse-url-browser-function 'browse-url-generic)
|
2012-11-13 18:46:20 +01:00
|
|
|
|
|
|
|
|
|
;; Default ispell dictionnay
|
|
|
|
|
(setq ispell-dictionary "fr")
|
2012-12-21 21:30:54 +01:00
|
|
|
|
|
|
|
|
|
;; Use color escape sequences. Only use if needed.
|
|
|
|
|
;; (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
|
2013-01-08 00:36:02 +01:00
|
|
|
|
|
|
|
|
|
;; Long paragraphs. Useful for quick navigation with backward-paragraph and
|
|
|
|
|
;; forward-paragraph.
|
|
|
|
|
(setq paragraph-start "
|
|
|
|
|
")
|
2013-01-10 15:57:07 +01:00
|
|
|
|
|
|
|
|
|
;; Show matching parenthesis
|
|
|
|
|
(show-paren-mode 1)
|
|
|
|
|
;; By default, there’s a small delay before showing a matching parenthesis. Set
|
|
|
|
|
;; it to 0 to deactivate.
|
|
|
|
|
(setq show-paren-delay 0)
|
|
|
|
|
|
2013-01-10 17:33:33 +01:00
|
|
|
|
;; Window resize
|
|
|
|
|
;; TODO: Use more { and } to continue.
|
|
|
|
|
(global-set-key (kbd "C-x {") (lambda () (interactive) (shrink-window-horizontally 5)))
|
|
|
|
|
(global-set-key (kbd "C-x }") (lambda () (interactive) (enlarge-window-horizontally 5)))
|
|
|
|
|
;; (define-key my-keys-minor-mode-map (kbd "S-C-<down>") 'shrink-window)
|
|
|
|
|
;; (define-key my-keys-minor-mode-map (kbd "S-C-<up>") 'enlarge-window)
|
|
|
|
|
|
|
|
|
|
;; Copy/Paste to/from clipboard.
|
|
|
|
|
;; FIXME: copying does not work.
|
|
|
|
|
(global-set-key (kbd "C-<f6>") (kbd "M-| xclip"))
|
|
|
|
|
(global-set-key (kbd "C-<f7>") (kbd "C-u M-! xclip <SPC> -o"))
|
|
|
|
|
(global-set-key (kbd "C-<f8>") (kbd "C-u M-! xclip <SPC> -o <SPC> -selection <SPC> clipboard"))
|
2013-01-23 14:59:25 +01:00
|
|
|
|
|
|
|
|
|
;; query-replace-regex fix on terminals.
|
|
|
|
|
(global-set-key (kbd "C-M-y") 'query-replace-regexp)
|