2017-01-16 23:15:48 -05:00
|
|
|
|
;;; core-editor.el --- filling the editor shaped hole in the Emacs OS
|
|
|
|
|
|
2017-01-31 19:50:46 -05:00
|
|
|
|
(setq shift-select-mode t ; activate mark on shift-click
|
|
|
|
|
;; Save clipboard contents into kill-ring before replacing them
|
|
|
|
|
save-interprogram-paste-before-kill t
|
|
|
|
|
;; Bookmarks
|
|
|
|
|
bookmark-default-file (concat doom-cache-dir "/bookmarks")
|
|
|
|
|
bookmark-save-flag t
|
|
|
|
|
;; Formatting
|
|
|
|
|
delete-trailing-lines nil
|
2017-01-16 23:15:48 -05:00
|
|
|
|
fill-column 80
|
2017-01-31 19:50:46 -05:00
|
|
|
|
sentence-end-double-space nil
|
|
|
|
|
;; Scrolling
|
|
|
|
|
hscroll-margin 1
|
2017-01-16 23:15:48 -05:00
|
|
|
|
hscroll-step 1
|
|
|
|
|
scroll-conservatively 1001
|
|
|
|
|
scroll-margin 0
|
2017-01-31 19:50:46 -05:00
|
|
|
|
scroll-preserve-screen-position t
|
|
|
|
|
;; Whitespace (see `editorconfig')
|
|
|
|
|
indent-tabs-mode nil
|
2017-01-16 23:15:48 -05:00
|
|
|
|
require-final-newline t
|
|
|
|
|
tab-always-indent t
|
|
|
|
|
tab-width 4
|
|
|
|
|
tabify-regexp "^\t* [ \t]+" ; for :retab
|
|
|
|
|
whitespace-line-column fill-column
|
|
|
|
|
whitespace-style
|
2017-01-31 19:50:46 -05:00
|
|
|
|
'(face tabs tab-mark trailing lines-tail)
|
2017-01-16 23:15:48 -05:00
|
|
|
|
whitespace-display-mappings
|
2017-01-31 19:50:46 -05:00
|
|
|
|
'((tab-mark ?\t [?› ?\t]) (newline-mark 10 [36 10]))
|
|
|
|
|
;; Wrapping
|
|
|
|
|
truncate-lines t
|
2017-01-16 23:15:48 -05:00
|
|
|
|
truncate-partial-width-windows 50
|
|
|
|
|
visual-fill-column-center-text nil
|
2017-01-31 19:50:46 -05:00
|
|
|
|
word-wrap t
|
|
|
|
|
;; clipboard
|
|
|
|
|
x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)
|
|
|
|
|
;; Use a shared clipboard
|
|
|
|
|
select-enable-clipboard t
|
|
|
|
|
select-enable-primary t)
|
|
|
|
|
|
|
|
|
|
(unless noninteractive
|
|
|
|
|
;; Save point across sessions
|
|
|
|
|
(require 'saveplace)
|
|
|
|
|
(setq save-place-file (concat doom-cache-dir "saveplace")
|
|
|
|
|
save-place t)
|
|
|
|
|
(when (>= emacs-major-version 25)
|
|
|
|
|
(save-place-mode +1))
|
|
|
|
|
|
|
|
|
|
;; Save history across sessions
|
|
|
|
|
(require 'savehist)
|
|
|
|
|
(setq savehist-file (concat doom-cache-dir "savehist")
|
|
|
|
|
savehist-save-minibuffer-history t
|
|
|
|
|
savehist-additional-variables
|
|
|
|
|
'(kill-ring search-ring regexp-search-ring))
|
|
|
|
|
(savehist-mode 1)
|
|
|
|
|
|
|
|
|
|
;; Remove text-property cruft from history
|
|
|
|
|
(defun unpropertize-savehist ()
|
|
|
|
|
(mapc (lambda (list)
|
|
|
|
|
(when (boundp list)
|
|
|
|
|
(set list (mapcar 'substring-no-properties (eval list)))))
|
|
|
|
|
'(kill-ring minibuffer-history helm-grep-history helm-ff-history
|
|
|
|
|
file-name-history read-expression-history extended-command-history
|
|
|
|
|
evil-ex-history)))
|
|
|
|
|
(add-hook 'kill-emacs-hook 'unpropertize-savehist)
|
|
|
|
|
(add-hook 'savehist-save-hook 'unpropertize-savehist)
|
|
|
|
|
|
|
|
|
|
;; Keep track of recently opened files
|
|
|
|
|
(require 'recentf)
|
|
|
|
|
(setq recentf-save-file (concat doom-cache-dir "recentf")
|
|
|
|
|
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
|
|
|
|
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$"
|
|
|
|
|
"wg-default" "/company-statistics-cache.el$"
|
|
|
|
|
"^/var/folders/.+$" "^/tmp/.+")
|
|
|
|
|
recentf-max-menu-items 0
|
|
|
|
|
recentf-max-saved-items 250
|
|
|
|
|
recentf-auto-cleanup 600
|
|
|
|
|
recentf-filename-handlers '(abbreviate-file-name))
|
|
|
|
|
(recentf-mode 1)
|
|
|
|
|
|
|
|
|
|
;; Ediff
|
|
|
|
|
(add-hook! ediff-load
|
|
|
|
|
(setq ediff-diff-options "-w"
|
|
|
|
|
ediff-split-window-function 'split-window-horizontally
|
|
|
|
|
ediff-window-setup-function 'ediff-setup-windows-plain)) ; no extra frames
|
|
|
|
|
|
|
|
|
|
;; revert buffers for changed files
|
|
|
|
|
(global-auto-revert-mode 1)
|
|
|
|
|
(setq auto-revert-verbose nil))
|
2017-01-16 23:15:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
2017-01-31 19:50:46 -05:00
|
|
|
|
;; Core Plugins
|
2017-01-16 23:15:48 -05:00
|
|
|
|
;;
|
|
|
|
|
|
2017-01-31 19:50:46 -05:00
|
|
|
|
;; Handles whitespace (tabs/spaces) settings externally. This way projects can
|
|
|
|
|
;; specify their own formatting rules.
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! editorconfig :demand t
|
2016-05-20 19:08:02 -04:00
|
|
|
|
:mode ("\\.?editorconfig$" . editorconfig-conf-mode)
|
|
|
|
|
:config (editorconfig-mode +1)
|
|
|
|
|
;; Show whitespace in tabs indentation mode
|
2016-05-12 22:11:43 -04:00
|
|
|
|
(add-hook! 'editorconfig-custom-hooks
|
|
|
|
|
(if indent-tabs-mode (whitespace-mode +1))))
|
2016-04-23 22:08:46 -04:00
|
|
|
|
|
2017-01-31 19:50:46 -05:00
|
|
|
|
;; Auto-close delimiters and blocks as you type
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! smartparens :demand t
|
|
|
|
|
:init
|
|
|
|
|
(setq sp-autowrap-region nil ; let evil-surround handle this
|
|
|
|
|
sp-highlight-pair-overlay nil
|
|
|
|
|
sp-cancel-autoskip-on-backward-movement nil
|
|
|
|
|
sp-show-pair-delay 0
|
|
|
|
|
sp-max-pair-length 3)
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
:config
|
|
|
|
|
(smartparens-global-mode 1)
|
|
|
|
|
(require 'smartparens-config)
|
|
|
|
|
;; Smartparens interferes with Replace mode
|
|
|
|
|
(add-hook 'evil-replace-state-entry-hook 'turn-off-smartparens-mode)
|
|
|
|
|
(add-hook 'evil-replace-state-exit-hook 'turn-on-smartparens-mode)
|
|
|
|
|
;; Auto-close more conservatively
|
|
|
|
|
(sp-pair "'" nil :unless '(sp-point-after-word-p))
|
|
|
|
|
(sp-pair "\"" nil :unless '(sp-point-before-word-p sp-point-after-word-p sp-point-before-same-p))
|
|
|
|
|
(sp-pair "{" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
|
|
|
|
|
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
|
|
|
(sp-pair "(" nil :post-handlers '(("||\n[i]" "RET") ("| " " "))
|
|
|
|
|
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
|
|
|
(sp-pair "[" nil :post-handlers '(("| " " "))
|
|
|
|
|
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
2016-01-30 21:16:10 -05:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(sp-local-pair
|
|
|
|
|
'css-mode "/*" "*/" :post-handlers '(("[d-3]||\n[i]" "RET") ("| " "SPC")))
|
|
|
|
|
(sp-local-pair '(sh-mode markdown-mode) "`" nil
|
|
|
|
|
:unless '(sp-point-before-word-p sp-point-before-same-p))
|
|
|
|
|
(sp-with-modes '(xml-mode nxml-mode php-mode)
|
|
|
|
|
(sp-local-pair "<!--" "-->" :post-handlers '(("| " "SPC")))))
|
2016-03-23 11:59:06 -04:00
|
|
|
|
|
2016-03-03 15:04:14 -05:00
|
|
|
|
|
|
|
|
|
;;
|
2017-01-16 23:15:48 -05:00
|
|
|
|
;; Autoloaded Plugins
|
2016-03-03 15:04:14 -05:00
|
|
|
|
;;
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! ace-link :commands (ace-link-help ace-link-org))
|
|
|
|
|
|
|
|
|
|
(package! ace-window
|
2015-06-06 06:40:33 -04:00
|
|
|
|
:commands ace-window
|
|
|
|
|
:config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
|
|
|
|
|
aw-scope 'frame
|
2015-06-24 15:34:46 +02:00
|
|
|
|
aw-background t))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! avy
|
2016-04-16 21:27:59 -04:00
|
|
|
|
:commands (avy-goto-char-2 avy-goto-line)
|
|
|
|
|
:config (setq avy-all-windows nil
|
|
|
|
|
avy-background t))
|
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! command-log-mode
|
2016-06-08 21:08:19 -04:00
|
|
|
|
:commands (clm/command-log-buffer command-log-mode global-command-log-mode)
|
|
|
|
|
:config (setq command-log-mode-is-global t))
|
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! emr
|
2016-05-13 00:28:44 -04:00
|
|
|
|
:commands (emr-show-refactor-menu emr-declare-command)
|
2017-01-31 19:50:46 -05:00
|
|
|
|
:config (emr-initialize)
|
2016-05-13 00:28:44 -04:00
|
|
|
|
(define-key popup-menu-keymap [escape] 'keyboard-quit))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! expand-region :commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! goto-last-change :commands goto-last-change)
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! help-fns+ ; Improved help commands
|
2016-10-02 23:21:47 +02:00
|
|
|
|
:commands (describe-buffer describe-command describe-file
|
|
|
|
|
describe-keymap describe-option describe-option-of-type))
|
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! imenu-anywhere
|
|
|
|
|
:commands (ido-imenu-anywhere ivy-imenu-anywhere helm-imenu-anywhere))
|
|
|
|
|
|
|
|
|
|
(package! imenu-list :commands imenu-list-minor-mode)
|
|
|
|
|
|
|
|
|
|
(package! pcre2el :commands rxt-quote-pcre)
|
|
|
|
|
|
|
|
|
|
(package! rotate-text
|
2017-01-31 19:50:46 -05:00
|
|
|
|
:quelpa (:fetcher github :repo "debug-ito/rotate-text.el")
|
2016-01-29 07:06:52 -05:00
|
|
|
|
:commands (rotate-text rotate-text-backward)
|
2016-05-01 01:06:25 -04:00
|
|
|
|
:config (push '("true" "false") rotate-text-words))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! smart-forward
|
2016-10-08 19:38:58 +02:00
|
|
|
|
:commands (smart-up smart-down smart-backward smart-forward))
|
2015-06-06 06:40:33 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! swiper :commands (swiper swiper-all))
|
2016-06-04 22:47:20 -04:00
|
|
|
|
|
2017-01-16 23:15:48 -05:00
|
|
|
|
(package! wgrep
|
2016-06-13 02:11:33 -04:00
|
|
|
|
:commands (wgrep-setup wgrep-change-to-wgrep-mode)
|
|
|
|
|
:config
|
2017-02-01 00:31:08 -05:00
|
|
|
|
(def-popup! ("^\\*ivy-occur counsel-ag" :size 25 :select t :regexp t))
|
2016-06-13 02:11:33 -04:00
|
|
|
|
(setq wgrep-auto-save-buffer t)
|
|
|
|
|
(advice-add 'wgrep-abort-changes :after 'doom/popup-close)
|
|
|
|
|
(advice-add 'wgrep-finish-edit :after 'doom/popup-close))
|
|
|
|
|
|
2015-06-04 18:23:21 -04:00
|
|
|
|
(provide 'core-editor)
|
|
|
|
|
;;; core-editor.el ends here
|