dotfiles/.config/emacs/core/earnecore-editing.el

72 lines
1.7 KiB
EmacsLisp

;;; earnecore-editing.el --- -*- lexical-binding: t; -*-
;; Copyright (C) 2020-2021 earnest ma
;; SPDX-License-Identifier: MIT
;; Author: earnest ma <me@earne.link>
;;; Commentary:
;;
;;; Code:
(use-package editorconfig
:demand
:config
(editorconfig-mode 1))
;; Improve performance for large files
(global-so-long-mode 1)
;; Automatically revert buffers when changed on disk
(global-auto-revert-mode 1)
;; Save and restore place in file
(save-place-mode +1)
;; Auto-saving/ backup/ lockfiles
(use-package super-save
:demand
:config
(super-save-mode +1)
(setq super-save-auto-save-when-idle t)
(setq super-save-remote-files nil)
(setq super-save-exclude '(".gpg")))
(setq backup-by-copying t
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t)
;; crux (A Collection of Ridiculously Useful eXtensions for Emacs)
(use-package crux
:general
(earnemacs-spc-def
"fr" 'crux-sudo-edit))
;; "Paste menu" - taken and adapted with <3 from Doom Emacs
(defun earnemacs/paste ()
"Interactively select what text to insert from the kill ring."
(interactive)
(call-interactively
(cond ((fboundp 'counsel-yank-pop) #'counsel-yank-pop)
((error "No kill-ring search backend available.")))))
(earnemacs-spc-def "ip" 'earnemacs/paste)
;; yes or no -> y or n
(fset 'yes-or-no-p 'y-or-n-p)
;; Windows: open current directory in explorer.exe
(when *sys-windows*
(defun earnemacs/open-current-dir-in-explorer ()
"Open the currently visited directory in Windows Explorer."
(interactive)
(shell-command "explorer.exe .")))
(setq delete-by-moving-to-trash t)
(setq-default fill-column 80)
(provide 'earnecore-editing)
;;; earnecore-editing.el ends here