diff options
Diffstat (limited to '.emacs.d/lisp/init-editor.el')
-rw-r--r-- | .emacs.d/lisp/init-editor.el | 99 |
1 files changed, 73 insertions, 26 deletions
diff --git a/.emacs.d/lisp/init-editor.el b/.emacs.d/lisp/init-editor.el index 5cb0cc7..fc575c4 100644 --- a/.emacs.d/lisp/init-editor.el +++ b/.emacs.d/lisp/init-editor.el @@ -33,14 +33,24 @@ (setq comment-auto-fill-only-comments t) (setq large-file-warning-threshold 100000000) (setq create-lockfiles nil) - (setq global-auto-revert-non-file-buffers t) - (setq backup-by-copying t) + (setq global-auto-revert-non-file-buffers t + revert-without-query (list ".") + auto-revert-stop-on-user-input nil) + (setq backup-by-copying t + delete-old-versions t + version-control t + kept-new-versions 5 + kept-old-versions 5) (setq backup-directory-alist `((".*" . ,temporary-file-directory)) auto-save-file-name-transforms - `((".*" ,temporary-file-directory t))) + `((".*" ,temporary-file-directory t)) + auto-save-include-big-deletions t) + (setq comment-multi-line t + comment-empty-lines t) - (setq save-place-file (expand-file-name "saveplace" save-dir)) + (setq save-place-file (expand-file-name "saveplace" save-dir) + save-place-limit 800) ;; https://git.sr.ht/~technomancy/better-defaults/tree/master/item/better-defaults.el (setq save-interprogram-paste-before-kill t apropos-do-all t @@ -50,11 +60,12 @@ (setq ffap-machine-p-local 'accept ffap-machine-p-known 'reject ffap-machine-p-unkown 'reject) - ;; https://github.com/natecox/dotfiles/blob/master/workspaces/shared/symlinks/emacs/.emacs.d/nathancox.org + (setq sentence-end-double-space nil) - (set-charset-priority 'unicode) - (setq locale-coding-system 'utf-8) - (setq default-process-coding-system '(utf-8-unix . utf-8-unix)) + (set-language-environment "UTF-8") + ;; The previous line sets this to "rfc1345" + (setq default-input-method nil) + (set-default 'imenu-auto-rescan t)) (use-package move-text @@ -72,6 +83,7 @@ (savehist-additional-variables '(search-ring regexp-search-ring)) (savehist-autosave-interval 60) (savehist-file (expand-file-name "savehist" save-dir)) + (history-length 300) :hook (elpaca-after-init . savehist-mode)) (use-package super-save @@ -99,13 +111,21 @@ :config (global-flycheck-mode)) -;(use-package flyspell -; :custom -; (ispell-program-name "aspell") -; (ispell-extra-args '("--sug-mode=ultra")) -; :hook -; (text-mode . (lambda () (flyspell-mode +1))) -; (prog-mode . (lambda () (flyspell-prog-mode)))) +(use-feature flyspell + :diminish + :config + (when (string-suffix-p "aspell" ispell-program-name) + (setq ispell-extra-args '("--sug-mode=ultra"))) + (unbind-key "C-," flyspell-mode-map) + (unbind-key "C-." flyspell-mode-map) + ;;(unbind-key "C-;" flyspell-mode-map) + :custom (flyspell-auto-correct-binding (kbd "C-x C-M-;")) + :bind (:map flyspell-mode-map + ("C-x C-," . flyspell-goto-next-error) + ("C-x C-." . flyspell-correct-word)) + :hook + (text-mode . flyspell-mode) + (prog-mode . flyspell-prog-mode)) (use-feature bookmark :custom @@ -125,7 +145,6 @@ (undo-tree-auto-save-history t)) (use-feature abbrev - :defer 5 :diminish :hook (text-mode . abbrev-mode) @@ -146,28 +165,48 @@ (use-package operate-on-number :bind - ("C-c ." . operate-on-number-at-point)) + ("C-c +" . operate-on-number-at-point)) (defun +elpaca-unload-xref (e) (and (featurep 'xref) (unload-feature 'xref t)) + ;; Make sure these aren't overwritten + (setq xref-search-program 'ripgrep + xref-show-xrefs-function #'consult-xref + xref-show-definitions-function #'consult-xref) (elpaca--continue-build e)) (defun +elpaca-xref-build-steps () (append (butlast (if (file-exists-p (expand-file-name "xref" elpaca-builds-directory)) elpaca--pre-built-steps elpaca-build-steps)) - (list '+elpaca-unload-xref'elpaca--activate-package))) + (list '+elpaca-unload-xref 'elpaca--activate-package))) -;;(elpaca `(xref :build ,(+elpaca-xref-build-steps))) (use-package xref - :ensure `(xref :build ,(+elpaca-xref-build-steps)) - :custom (xref-search-program 'ripgrep) + :ensure `(xref :build ,(+elpaca-xref-build-steps) :ref "87db670d045bea2d90139b1f741eea8db7c193ea" :pin t) + :custom + (xref-search-program 'ripgrep) + (xref-show-xrefs-function #'consult-xref) + (xref-show-definitions-function #'consult-xref) :config + (defun xref-find-references-current-defun () + "`xref-find-references' for the enclosing defun." + (interactive) + (xref-backend-identifier-completion-table (xref-find-backend)) + (xref-find-references (which-function))) + (defun xref-find-definitions-current-list-function () + "`xref-find-definitions' for the function at the beginning of the current list. +With a prefix argument, moves up `current-prefix-arg' sexps first." + (interactive) + (let ((fn-name (save-excursion + (when current-prefix-arg + (sp-backward-up-sexp current-prefix-arg)) + (sp-beginning-of-sexp) (thing-at-point 'symbol)))) + (xref-find-definitions fn-name))) (defun xref-find-references-other-window (identifier) - "Like `xref-find-references' but switch to the other window" + "Like `xref-find-references' but switch to the other window." (interactive (list (xref--read-identifier "Find references of: "))) (xref--find-xrefs identifier 'references identifier 'window)) (defun xref-find-references-other-frame (identifier) - "Like `xref-find-references' but switch to the other frame" + "Like `xref-find-references' but switch to the other frame." (interactive (list (xref--read-identifier "Find references of: "))) (xref--find-xrefs identifier 'references identifier 'frame)) (define-key ctl-x-4-map (kbd "M-?") 'xref-find-references-other-window) @@ -177,7 +216,10 @@ ;; there is no value at point that can be used (add-to-list 'xref-prompt-for-identifier 'xref-find-references t) (add-to-list 'xref-prompt-for-identifier 'xref-find-references-other-window t) - (add-to-list 'xref-prompt-for-identifier 'xref-find-references-other-frame t)) + (add-to-list 'xref-prompt-for-identifier 'xref-find-references-other-frame t) + :bind + ("C-c q" . xref-find-references-current-defun) + ("C-c C-M-." . xref-find-definitions-current-list-function)) (use-package ws-butler :diminish @@ -222,8 +264,9 @@ :hook (elpaca-after-init . editorconfig-mode)) (use-package titlecase - ;; TODO find a better binding - :bind ("C-c c t t" . titlecase-dwim)) + :bind (("C-c c t t" . titlecase-dwim) + (:map embark-heading-map ("T" . titlecase-line)) + (:map embark-region-map ("T" . titlecase-region)))) (use-package caser :ensure (caser :host github :repo "emacsmirror/caser") @@ -266,5 +309,9 @@ ("x" . cider-eval-region) ("r" . cider-insert-region-in-repl))) +(use-package repeat-fu + :bind ("M-+" . repeat-fu-execute) + :hook ((prog-mode text-mode) . repeat-fu-mode)) + (provide 'init-editor) ;;; init-editor.el ends here |