123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- ;;;; Startup
- ;(package-initialize)
- (setq inhibit-splash-screen t
- inhibit-startup-echo-area-message t
- initial-scratch-message "" ; I like things empty.
- initial-major-mode 'text-mode) ; I'm usually not writing elisp.
- ;; Base
- (setq ring-bell-function 'ignore) ; Disable beep & flash
- (blink-cursor-mode 0)
- ;; No scroll bar
- (when (boundp 'scroll-bar-mode)
- (scroll-bar-mode -1))
- ;; Disable toolbar
- (when (display-graphic-p)
- (tool-bar-mode -1))
- ;; smoother scrolling
- (setq scroll-margin 0
- scroll-conservatively 9999
- scroll-step 1)
- ;; Line settings and indicators
- (setq visual-line-fringe-indicators '(left-curly-arrow right-curly-arrow))
- (setq-default left-fringe-width nil)
- (setq-default indicate-empty-lines t)
- ;; All yes or no prompts are y or n
- (defalias 'yes-or-no-p 'y-or-n-p)
- ;; Never follow symlinks
- (setq vc-follow-symlinks nil)
- ;;; Leave the OS clipboard alone (use evil's "+ and "* instead)
- ; Don't copy and paste to the clipboard
- (setq select-enable-clipboard nil)
- (setq x-select-enable-clipboard nil)
- ; Don't save to the clipboard on exit
- (setq x-select-enable-clipboard-manager nil)
- ;; Text and Notes
- (setq sentence-end-double-space nil)
- ;; Save minibar history
- (savehist-mode 1)
- (setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
- ;; Always show matching parens
- (show-paren-mode t)
- ;; Save Window layout history
- (winner-mode)
- ;; Backups (from https://stackoverflow.com/questions/151945/how-do-i-control-how-emacs-makes-backup-files/20824625#20824625)
- (setq version-control t ;; Use version numbers for backups.
- kept-new-versions 10 ;; Number of newest versions to keep.
- kept-old-versions 0 ;; Number of oldest versions to keep.
- delete-old-versions t ;; Don't ask to delete excess backup versions.
- backup-by-copying t) ;; Copy all files, don't rename them.
- (setq vc-make-backup-files t) ;; Backup versioned files
- ;; Default and per-save backups go here:
- (setq backup-directory-alist '(("" . "~/.emacs.d/backups/per-save")))
- (defun force-backup-of-buffer ()
- ;; Make a special "per session" backup at the first save of each
- ;; emacs session.
- (when (not buffer-backed-up)
- ;; Override the default parameters for per-session backups.
- (let ((backup-directory-alist '(("" . "~/.emacs.d/backups/per-session")))
- (kept-new-versions 3))
- (backup-buffer)))
- ;; Make a "per save" backup on each save. The first save results in
- ;; both a per-session and a per-save backup, to keep the numbering
- ;; of per-save backups consistent.
- (let ((buffer-backed-up nil))
- (backup-buffer)))
- (add-hook 'before-save-hook 'force-backup-of-buffer)
- ;; Autosave files
- (setq auto-save-file-name-transforms
- `((".*" , "~/.emacs.d/backups/auto-saves" t)))
- ;; remember cursor position
- (toggle-save-place-globally)
- ;; Search all buffers
- (defun grep-search-all-buffers (regexp)
- (interactive "sRegexp: ")
- (multi-occur-in-matching-buffers "." regexp t))
- (add-to-list 'load-path (expand-file-name "packages" user-emacs-directory))
- (require 'packages)
- ;;;; System-specific configs
- (defun win-setup ()
- (add-to-list 'exec-path "C:/Program Files (x86)/Aspell/bin/")
- (setq ispell-program-name "aspell")
- (if (file-directory-p "C:/MinGW/msys/1.0/bin")
- (add-to-list 'exec-path "C:/MinGW/msys/1.0/bin"))
- (defun cmd ()
- (interactive)
- (make-comint-in-buffer "cmd" nil "cmd" nil)
- (switch-to-buffer "*cmd*")))
- (defun linux-setup ())
- (cond ((eq system-type 'windows-nt) (win-setup))
- ((eq system-type 'gnu/linux) (linux-setup))
- (t (message "")))
- ;;;; Custom
- (defconst custom-file (expand-file-name "custom.el" user-emacs-directory))
- ;; if no custom file exists, write a default one
- (unless (file-exists-p custom-file)
- (write-region "(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.
- '(powerline-evil-normal-face ((t (:background \"#859900\")))))
- (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.
- '(custom-enabled-themes (quote (monokai)))
- '(custom-safe-themes
- (quote
- (\"c7a9a68bd07e38620a5508fef62ec079d274475c8f92d75ed0c33c45fbe306bc\" default))))
- " nil custom-file))
- (load custom-file)
|