dotfiles/emacs/.emacs.d/config/init-built-ins.el

84 lines
2.1 KiB
EmacsLisp

;; -*- lexical-binding: t; -*-
;; Configuration for built-ins that don't fit anywhere else
(use-package custom
:straight (:type built-in)
:defer t)
(use-package view
:straight (:type built-in)
:defer t
:config
(evil-collection-define-key 'normal 'view-mode-map
"0" 'evil-beginning-of-line
"g0" 'text-scale-adjust))
(use-package simple
:straight (:type built-in)
:general
(leader-map "!" #'shell-command
"|" #'shell-command-on-region
";" #'async-shell-command)
(normal special-mode-map
"gr" #'revert-buffer
"q" #'quit-window)
(normal messages-buffer-mode-map
"gr" #'revert-buffer
"q" #'quit-window))
(use-package shell
:straight (:type built-in)
:general
(normal shell-mode-map "q" #'quit-window))
(use-package ediff
:defer t
:straight (:type built-in)
:config
(setq ediff-window-setup-function #'ediff-setup-windows-plain)
;; Restore window configuration after an ediff session
(defvar ediff-last-windows nil)
(defun store-pre-ediff-winconfig ()
(setq ediff-last-windows (current-window-configuration)))
(defun restore-pre-ediff-winconfig ()
(set-window-configuration ediff-last-windows))
(add-hook 'ediff-before-setup-hook #'store-pre-ediff-winconfig)
(add-hook 'ediff-quit-hook #'restore-pre-ediff-winconfig))
(use-package replace
:defer t
:straight (:type built-in))
(use-package man
:straight (:type built-in)
:commands (man)
:custom
(manual-program "gman"))
(use-package re-builder
:straight (:type built-in)
:commands (re-builder)
:custom
(reb-re-syntax 'string))
(use-package hippie-expand
:straight (:type built-in)
:general
([remap dabbrev-expand] #'hippie-expand))
(use-package browse-url
:straight (:type built-in)
:config
(defun browse-url-or-search (url-or-symbol)
"If URL-OR-SYMBOL is a URL, browse it. Otherwise, search for it."
(interactive (list (thing-at-point 'symbol)))
(if (ffap-url-p url-or-symbol)
(browse-url url-or-symbol)
(browse-url (format "https://www.google.com/search?q=%s" url-or-symbol)))))
(provide 'init-built-ins)