diff options
Diffstat (limited to '')
| -rw-r--r-- | settings/sane-defaults.el | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/settings/sane-defaults.el b/settings/sane-defaults.el new file mode 100644 index 0000000..9fc5532 --- /dev/null +++ b/settings/sane-defaults.el @@ -0,0 +1,92 @@ +;; Stolen from Magnars, with small mods +;; https://github.com/magnars/.emacs.d/blob/master/settings/sane-defaults.el + +;; Allow pasting selection outside of Emacs +(setq x-select-enable-clipboard t) + +;; Auto refresh buffers +(global-auto-revert-mode 1) + +;; setup eval elsip +(define-key global-map (kbd "C-x C-e") 'eval-last-sexp) + +;; Also auto refresh dired, but be quiet about it +(setq global-auto-revert-non-file-buffers t) +(setq auto-revert-verbose nil) + +;; Show keystrokes in progress +(setq echo-keystrokes 0.1) + +;; Move files to trash when deleting +(setq delete-by-moving-to-trash t) + +;; Transparently open compressed files +(auto-compression-mode t) + +;; Answering just 'y' or 'n' will do +(defalias 'yes-or-no-p 'y-or-n-p) + +;; UTF-8 please +(setq locale-coding-system 'utf-8) ; pretty +(set-terminal-coding-system 'utf-8) ; pretty +(set-keyboard-coding-system 'utf-8) ; pretty +(set-selection-coding-system 'utf-8) ; please +(prefer-coding-system 'utf-8) ; with sugar on top + +;; Show active region +(transient-mark-mode 1) +(make-variable-buffer-local 'transient-mark-mode) +(put 'transient-mark-mode 'permanent-local t) +(setq-default transient-mark-mode t) + +;; Don't highlight matches with jump-char - it's distracting +(setq jump-char-lazy-highlight-face nil) + +;; Always display line and column numbers +(setq line-number-mode t) +(setq column-number-mode t) + +;; Lines should be 80 characters wide, not 72 +(setq fill-column 80) + +;; Save a list of recent files visited. (open recent file with C-x f) +(recentf-mode 1) +(setq recentf-max-saved-items 100) ;; just 20 is too recent + +;; Save minibuffer history +(savehist-mode 1) +(setq history-length 1000) + +;; Allow recursive minibuffers +(setq enable-recursive-minibuffers t) + +;; More memory than even Magnars...cause the future keeps happening +;; 50 MB should be good +(setq gc-cons-threshold 50000000) + +;; warn when opening files bigger than 100MB +(setq large-file-warning-threshold 100000000) + +;; 80 chars is a good width. +(set-default 'fill-column 80) + +;; Add parts of each file's directory to the buffer name if not unique +(require 'uniquify) +(setq uniquify-buffer-name-style 'forward) + +(setq ediff-diff-options "-w") +(setq ediff-split-window-function 'split-window-horizontally) +(setq ediff-window-setup-function 'ediff-setup-windows-plain) + + +;; Offer to create parent directories if they do not exist +;; http://iqbalansari.github.io/blog/2014/12/07/automatically-create-parent-directories-on-visiting-a-new-file-in-emacs/ +(defun my-create-non-existent-directory () + (let ((parent-directory (file-name-directory buffer-file-name))) + (when (and (not (file-exists-p parent-directory)) + (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory))) + (make-directory parent-directory t)))) + +(add-to-list 'find-file-not-found-functions 'my-create-non-existent-directory) + +(provide 'sane-defaults) |
