doomemacs/init/core-editor.el

138 lines
4.2 KiB
EmacsLisp
Raw Normal View History

2014-07-15 02:21:56 -04:00
;;;; Editor behavior ;;;;;;;;;;;;;;;;
2014-08-21 03:33:30 -04:00
(blink-cursor-mode -1)
2014-08-29 22:37:25 -04:00
2014-07-15 02:21:56 -04:00
(setq-default
tab-width 4 ; set tab width to 4 for all buffers
2014-07-22 23:24:02 -04:00
indent-tabs-mode nil ; use tabs, not spaces
tab-always-indent nil)
2014-07-15 02:21:56 -04:00
;; do not soft-wrap lines
(setq-default truncate-lines t)
(setq truncate-partial-width-windows nil)
;; Remove trailing whitespace
(add-hook 'before-save-hook 'delete-trailing-whitespace)
2014-08-07 18:35:22 -04:00
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
2014-07-15 02:21:56 -04:00
2014-08-29 22:37:25 -04:00
;; All this just to show errant tab characters
(add-hook 'font-lock-mode-hook
(function
(lambda ()
(setq font-lock-keywords
(append font-lock-keywords
'(("\r" (0 'my-carriage-return-face t))
("\t" (0 'my-tab-face t))))))))
(setq whitespace-style (quote (face trailing tab-mark)))
(setq whitespace-display-mappings '((tab-mark 9 [?> 9] [92 9])))
(add-hook 'find-file-hook 'whitespace-mode)
2014-08-07 18:35:22 -04:00
;;;; Plugins ;;;;;;;;;;;;;;;;;;;;;;;;
2014-08-29 22:37:25 -04:00
(use-package highlight-indentation
:init
(add-hook 'prog-mode-hook 'highlight-indentation-mode))
2014-08-09 19:25:06 -04:00
2014-08-29 22:37:25 -04:00
(use-package evil
2014-08-13 00:24:22 -04:00
:diminish undo-tree-mode
:config
(progn
(evil-mode 1)
2014-07-16 03:28:06 -04:00
2014-08-29 22:37:25 -04:00
(use-package evil-matchit)
(use-package evil-surround)
(use-package evil-numbers)
(use-package evil-exchange)
(use-package evil-space)
(use-package evil-visualstar)
(use-package evil-nerd-commenter)
2014-08-13 00:24:22 -04:00
(use-package evil-ex-registers)
2014-07-16 03:28:06 -04:00
2014-08-13 00:24:22 -04:00
;; To get evil-leader mappings to work in the messages buffer...
(kill-buffer "*Messages*")
2014-07-15 02:21:56 -04:00
2014-08-13 00:24:22 -04:00
(global-evil-matchit-mode 1)
(global-evil-surround-mode 1)
2014-07-16 03:28:06 -04:00
2014-08-13 00:24:22 -04:00
(evil-exchange-install)
2014-07-24 00:09:47 -04:00
2014-08-13 00:24:22 -04:00
(evil-space-setup "t" ";" ",") ; Repeat t with space
(evil-space-setup "f" ";" ",") ; Repeat f with space
(evil-space-setup "T" "," ";") ; Repeat T with space
(evil-space-setup "F" "," ";") ; Repeat F with space
(evil-define-operator evil-destroy (beg end type register yank-handler)
(evil-delete beg end type ?_ yank-handler))
2014-07-15 02:21:56 -04:00
2014-08-13 00:24:22 -04:00
(evil-set-initial-state 'comint-mode 'insert)
2014-07-15 02:21:56 -04:00
2014-08-13 00:24:22 -04:00
;; Enable registers in ex-mode
(define-key evil-ex-completion-map (kbd "C-r") #'evil-ex-paste-from-register)))
2014-07-16 03:28:06 -04:00
2014-08-29 22:37:25 -04:00
(use-package rainbow-delimiters
2014-08-09 19:25:06 -04:00
:commands rainbow-delimiters-mode
2014-08-10 19:41:42 -04:00
:init (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
2014-08-07 18:35:22 -04:00
2014-08-29 22:37:25 -04:00
(use-package rotate-text
:commands (rotate-word-at-point rotate-region))
2014-08-07 18:35:22 -04:00
;;;; Init plugins ;;;;;;;;;;;;;;;;;;;
2014-08-29 22:37:25 -04:00
(use-package autopair
2014-08-09 19:25:06 -04:00
:diminish autopair-mode
:init
(progn (autopair-global-mode)
(setq autopair-blink nil)
;; disable blink-matching-paren
(setq blink-matching-paren nil)))
2014-08-07 18:35:22 -04:00
2014-08-29 22:37:25 -04:00
(use-package anzu
2014-08-09 19:25:06 -04:00
:diminish anzu-mode
:init (global-anzu-mode))
2014-08-07 18:35:22 -04:00
2014-08-29 22:37:25 -04:00
(use-package expand-region)
(use-package key-chord
2014-08-09 19:25:06 -04:00
:init
(progn (key-chord-mode 1)
(setq key-chord-two-keys-delay 0.5)))
2014-08-07 18:35:22 -04:00
2014-08-11 16:56:09 -04:00
(use-package saveplace
:init
2014-08-09 19:25:06 -04:00
(progn (setq-default save-place t)
(setq save-place-file (expand-file-name "saveplace" my/tmp-dir))))
2014-08-07 18:35:22 -04:00
(use-package savehist
2014-08-09 19:25:06 -04:00
:init
(progn (setq savehist-additional-variables
;; search entries
'(search ring regexp-search-ring)
;; save every 5 minutes
savehist-autosave-interval 300
;; keep the home clean
savehist-file (expand-file-name "savehist" my/tmp-dir))
(savehist-mode 1)))
2014-08-29 22:37:25 -04:00
(use-package multiple-cursors
2014-08-09 19:25:06 -04:00
:commands (mc/mark-next-like-this mc/mark-previous-like-this mc/mark-all-like-this)
:config
(progn
;; I do it this way because hooking mc/keyboard-quit to insert mode's exit
;; hook breaks multiple-cursors!
(defadvice keyboard-quit (around mc-and-keyboard-quit activate)
(mc/keyboard-quit) ad-do-it)))
2014-08-29 22:37:25 -04:00
(use-package smex
2014-08-11 16:56:09 -04:00
:commands (smex smex-major-mode-commands)
2014-08-09 19:25:06 -04:00
:config
(progn (smex-initialize)
;; Hook up smex to auto-update, rather than update on every run
(defun smex-update-after-load (unused)
(when (boundp 'smex-cache) (smex-update)))
(add-hook 'after-load-functions 'smex-update-after-load)))
2014-08-29 22:37:25 -04:00
(use-package recentf
2014-08-13 00:24:22 -04:00
:init
2014-08-09 19:25:06 -04:00
(progn (recentf-mode 1)
(add-to-list 'recentf-exclude "\\.ido\\.last\\'")
(add-to-list 'recentf-exclude "\\.revive\\'")
2014-08-13 00:24:22 -04:00
(setq recentf-max-menu-items 0)
2014-08-09 19:25:06 -04:00
(setq recentf-auto-cleanup 'never)))
2014-07-16 03:28:06 -04:00
2014-07-15 02:21:56 -04:00
;;
(provide 'core-editor)