core-editor: refactor
This commit is contained in:
parent
58bdc997a2
commit
d2c701287a
1 changed files with 75 additions and 71 deletions
|
@ -1,103 +1,108 @@
|
||||||
;;; core-editor.el --- filling the editor shaped hole in the Emacs OS
|
;;; core-editor.el --- filling the editor shaped hole in the Emacs OS
|
||||||
|
|
||||||
;; Bookmarks
|
(setq shift-select-mode t ; activate mark on shift-click
|
||||||
(setq bookmark-default-file (concat doom-temp-dir "/bookmarks")
|
;; Save clipboard contents into kill-ring before replacing them
|
||||||
bookmark-save-flag t)
|
save-interprogram-paste-before-kill t
|
||||||
|
;; Bookmarks
|
||||||
;; Formatting
|
bookmark-default-file (concat doom-cache-dir "/bookmarks")
|
||||||
(setq delete-trailing-lines nil
|
bookmark-save-flag t
|
||||||
|
;; Formatting
|
||||||
|
delete-trailing-lines nil
|
||||||
fill-column 80
|
fill-column 80
|
||||||
sentence-end-double-space nil)
|
sentence-end-double-space nil
|
||||||
|
;; Scrolling
|
||||||
;; Scrolling
|
hscroll-margin 1
|
||||||
(setq hscroll-margin 1
|
|
||||||
hscroll-step 1
|
hscroll-step 1
|
||||||
scroll-conservatively 1001
|
scroll-conservatively 1001
|
||||||
scroll-margin 0
|
scroll-margin 0
|
||||||
scroll-preserve-screen-position t)
|
scroll-preserve-screen-position t
|
||||||
|
;; Whitespace (see `editorconfig')
|
||||||
;; Whitespace (see `editorconfig')
|
indent-tabs-mode nil
|
||||||
(setq indent-tabs-mode nil
|
|
||||||
require-final-newline t
|
require-final-newline t
|
||||||
tab-always-indent t
|
tab-always-indent t
|
||||||
tab-width 4
|
tab-width 4
|
||||||
tabify-regexp "^\t* [ \t]+" ; for :retab
|
tabify-regexp "^\t* [ \t]+" ; for :retab
|
||||||
whitespace-line-column fill-column
|
whitespace-line-column fill-column
|
||||||
whitespace-style
|
whitespace-style
|
||||||
'(face tabs tab-mark trailing indentation lines-tail)
|
'(face tabs tab-mark trailing lines-tail)
|
||||||
whitespace-display-mappings
|
whitespace-display-mappings
|
||||||
'((tab-mark ?\t [?› ?\t]) (newline-mark 10 [36 10])))
|
'((tab-mark ?\t [?› ?\t]) (newline-mark 10 [36 10]))
|
||||||
|
;; Wrapping
|
||||||
;; Wrapping
|
truncate-lines t
|
||||||
(setq truncate-lines t
|
|
||||||
truncate-partial-width-windows 50
|
truncate-partial-width-windows 50
|
||||||
visual-fill-column-center-text nil
|
visual-fill-column-center-text nil
|
||||||
word-wrap t)
|
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)
|
||||||
|
|
||||||
;; Regions
|
(unless noninteractive
|
||||||
(setq shift-select-mode t)
|
;; 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 point across sessions
|
;; Save history across sessions
|
||||||
(require 'saveplace)
|
(require 'savehist)
|
||||||
(setq save-place-file (concat doom-temp-dir "saveplace")
|
(setq savehist-file (concat doom-cache-dir "savehist")
|
||||||
save-place t)
|
savehist-save-minibuffer-history t
|
||||||
(when (>= emacs-major-version 25)
|
savehist-additional-variables
|
||||||
(save-place-mode +1))
|
'(kill-ring search-ring regexp-search-ring))
|
||||||
|
(savehist-mode 1)
|
||||||
|
|
||||||
;; Save history across sessions
|
;; Remove text-property cruft from history
|
||||||
(require 'savehist)
|
(defun unpropertize-savehist ()
|
||||||
(setq savehist-file (concat doom-temp-dir "savehist")
|
(mapc (lambda (list)
|
||||||
savehist-save-minibuffer-history t
|
(when (boundp list)
|
||||||
savehist-additional-variables
|
(set list (mapcar 'substring-no-properties (eval list)))))
|
||||||
'(kill-ring search-ring regexp-search-ring))
|
'(kill-ring minibuffer-history helm-grep-history helm-ff-history
|
||||||
(savehist-mode 1)
|
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)
|
||||||
|
|
||||||
;; Remove text-property cruft from history
|
;; Keep track of recently opened files
|
||||||
(defun unpropertize-savehist ()
|
(require 'recentf)
|
||||||
(mapc (lambda (list)
|
(setq recentf-save-file (concat doom-cache-dir "recentf")
|
||||||
(when (boundp list)
|
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
||||||
(set list (mapcar 'substring-no-properties (eval list)))))
|
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$"
|
||||||
'(kill-ring minibuffer-history helm-grep-history helm-ff-history
|
"wg-default" "/company-statistics-cache.el$"
|
||||||
file-name-history read-expression-history extended-command-history
|
"^/var/folders/.+$" "^/tmp/.+")
|
||||||
evil-ex-history)))
|
recentf-max-menu-items 0
|
||||||
(add-hook 'kill-emacs-hook 'unpropertize-savehist)
|
recentf-max-saved-items 250
|
||||||
(add-hook 'savehist-save-hook 'unpropertize-savehist)
|
recentf-auto-cleanup 600
|
||||||
|
recentf-filename-handlers '(abbreviate-file-name))
|
||||||
|
(recentf-mode 1)
|
||||||
|
|
||||||
;; Keep track of recently opened files
|
;; Ediff
|
||||||
(require 'recentf)
|
(add-hook! ediff-load
|
||||||
(setq recentf-save-file (concat doom-temp-dir "recentf")
|
(setq ediff-diff-options "-w"
|
||||||
recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last$" "\\.revive$" "/TAGS$"
|
ediff-split-window-function 'split-window-horizontally
|
||||||
"emacs\\.d/private/cache/.+" "emacs\\.d/workgroups/.+$"
|
ediff-window-setup-function 'ediff-setup-windows-plain)) ; no extra frames
|
||||||
"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
|
;; revert buffers for changed files
|
||||||
(add-hook! ediff-load
|
(global-auto-revert-mode 1)
|
||||||
(setq ediff-diff-options "-w"
|
(setq auto-revert-verbose nil))
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; Plugins
|
;; Core Plugins
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
;; Handles whitespace (tabs/spaces) settings externally. This way projects can
|
||||||
|
;; specify their own formatting rules.
|
||||||
(package! editorconfig :demand t
|
(package! editorconfig :demand t
|
||||||
:mode ("\\.?editorconfig$" . editorconfig-conf-mode)
|
:mode ("\\.?editorconfig$" . editorconfig-conf-mode)
|
||||||
:config (editorconfig-mode +1)
|
:config (editorconfig-mode +1)
|
||||||
(push 'doom-mode editorconfig-exclude-modes)
|
|
||||||
;; Show whitespace in tabs indentation mode
|
;; Show whitespace in tabs indentation mode
|
||||||
(add-hook! 'editorconfig-custom-hooks
|
(add-hook! 'editorconfig-custom-hooks
|
||||||
(if indent-tabs-mode (whitespace-mode +1))))
|
(if indent-tabs-mode (whitespace-mode +1))))
|
||||||
|
|
||||||
|
;; Auto-close delimiters and blocks as you type
|
||||||
(package! smartparens :demand t
|
(package! smartparens :demand t
|
||||||
:init
|
:init
|
||||||
(setq sp-autowrap-region nil ; let evil-surround handle this
|
(setq sp-autowrap-region nil ; let evil-surround handle this
|
||||||
|
@ -153,8 +158,7 @@
|
||||||
|
|
||||||
(package! emr
|
(package! emr
|
||||||
:commands (emr-show-refactor-menu emr-declare-command)
|
:commands (emr-show-refactor-menu emr-declare-command)
|
||||||
:config
|
:config (emr-initialize)
|
||||||
(emr-initialize)
|
|
||||||
(define-key popup-menu-keymap [escape] 'keyboard-quit))
|
(define-key popup-menu-keymap [escape] 'keyboard-quit))
|
||||||
|
|
||||||
(package! expand-region :commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
|
(package! expand-region :commands (er/expand-region er/contract-region er/mark-symbol er/mark-word))
|
||||||
|
@ -187,7 +191,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
(package! rotate-text
|
(package! rotate-text
|
||||||
:quelpa (rotate-text :fetcher github :repo "debug-ito/rotate-text.el")
|
:quelpa (:fetcher github :repo "debug-ito/rotate-text.el")
|
||||||
:commands (rotate-text rotate-text-backward)
|
:commands (rotate-text rotate-text-backward)
|
||||||
:config (push '("true" "false") rotate-text-words))
|
:config (push '("true" "false") rotate-text-words))
|
||||||
|
|
||||||
|
@ -199,7 +203,7 @@
|
||||||
(package! wgrep
|
(package! wgrep
|
||||||
:commands (wgrep-setup wgrep-change-to-wgrep-mode)
|
:commands (wgrep-setup wgrep-change-to-wgrep-mode)
|
||||||
:config
|
:config
|
||||||
(def-popup! "^\\*ivy-occur counsel-ag" :align below :size 25 :select t :regexp t)
|
(defpopup! ("^\\*ivy-occur counsel-ag" :size 25 :select t :regexp t))
|
||||||
(setq wgrep-auto-save-buffer t)
|
(setq wgrep-auto-save-buffer t)
|
||||||
(advice-add 'wgrep-abort-changes :after 'doom/popup-close)
|
(advice-add 'wgrep-abort-changes :after 'doom/popup-close)
|
||||||
(advice-add 'wgrep-finish-edit :after 'doom/popup-close))
|
(advice-add 'wgrep-finish-edit :after 'doom/popup-close))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue