193 lines
6.2 KiB
EmacsLisp
193 lines
6.2 KiB
EmacsLisp
|
|
(setq inhibit-startup-message t)
|
||
|
|
|
||
|
|
(menu-bar-mode -1)
|
||
|
|
(tool-bar-mode -1)
|
||
|
|
(scroll-bar-mode -1)
|
||
|
|
|
||
|
|
(load-theme 'tango-dark t)
|
||
|
|
(recentf-mode 1)
|
||
|
|
(savehist-mode 1) ; remember previous commands in minibuffer
|
||
|
|
(save-place-mode 1) ; put cursor in last place when opening a file
|
||
|
|
|
||
|
|
;; Avoid customization UI auto-variables in init.el
|
||
|
|
(setq custom-file (locate-user-emacs-file "custom-vars.el"))
|
||
|
|
(load custom-file 'noerror 'nomessage)
|
||
|
|
|
||
|
|
;; Don't show popup UI when prompting
|
||
|
|
(setq use-dialog-box nil)
|
||
|
|
|
||
|
|
;; Update files when changed on disk
|
||
|
|
(global-auto-revert-mode 1)
|
||
|
|
|
||
|
|
(set-frame-font "DejaVu Sans Mono 12")
|
||
|
|
|
||
|
|
;; Initialize Package Sources
|
||
|
|
(require 'package)
|
||
|
|
|
||
|
|
(setq package-archives
|
||
|
|
'(("melpa" . "https://melpa.org/packages/")
|
||
|
|
("org" . "https://orgmode.org/elpa/")
|
||
|
|
("elpa" . "https://elpa.gnu.org/packages/")))
|
||
|
|
|
||
|
|
(package-initialize)
|
||
|
|
(unless package-archive-contents
|
||
|
|
(package-refresh-contents))
|
||
|
|
|
||
|
|
;; Initialize use-package on non-linux platforms
|
||
|
|
(unless (package-installed-p 'use-package)
|
||
|
|
(package-install 'use-package))
|
||
|
|
|
||
|
|
(require 'use-package)
|
||
|
|
(setq use-package-always-ensure t)
|
||
|
|
|
||
|
|
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||
|
|
(use-package savehist
|
||
|
|
:init
|
||
|
|
(savehist-mode))
|
||
|
|
;; Enable vertico
|
||
|
|
(use-package vertico
|
||
|
|
:init
|
||
|
|
(vertico-mode)
|
||
|
|
|
||
|
|
;; Different scroll margin
|
||
|
|
;; (setq vertico-scroll-margin 0)
|
||
|
|
|
||
|
|
;; Show more candidates
|
||
|
|
;; (setq vertico-count 20)
|
||
|
|
|
||
|
|
;; Grow and shrink the Vertico minibuffer
|
||
|
|
;; (setq vertico-resize t)
|
||
|
|
|
||
|
|
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
|
||
|
|
;; (setq vertico-cycle t)
|
||
|
|
)
|
||
|
|
|
||
|
|
;; A few more useful configurations...
|
||
|
|
(use-package emacs
|
||
|
|
:init
|
||
|
|
;; Add prompt indicator to `completing-read-multiple'.
|
||
|
|
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
|
||
|
|
(defun crm-indicator (args)
|
||
|
|
(cons (format "[CRM%s] %s"
|
||
|
|
(replace-regexp-in-string
|
||
|
|
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
|
||
|
|
crm-separator)
|
||
|
|
(car args))
|
||
|
|
(cdr args)))
|
||
|
|
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
||
|
|
|
||
|
|
;; Do not allow the cursor in the minibuffer prompt
|
||
|
|
(setq minibuffer-prompt-properties
|
||
|
|
'(read-only t cursor-intangible t face minibuffer-prompt))
|
||
|
|
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
||
|
|
|
||
|
|
;; Emacs 28: Hide commands in M-x which do not work in the current mode.
|
||
|
|
;; Vertico commands are hidden in normal buffers.
|
||
|
|
;; (setq read-extended-command-predicate
|
||
|
|
;; #'command-completion-default-include-p)
|
||
|
|
|
||
|
|
;; Enable recursive minibuffers
|
||
|
|
(setq enable-recursive-minibuffers t))
|
||
|
|
;; A few more useful configurations...
|
||
|
|
(use-package emacs
|
||
|
|
:init
|
||
|
|
;; Add prompt indicator to `completing-read-multiple'.
|
||
|
|
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
|
||
|
|
(defun crm-indicator (args)
|
||
|
|
(cons (format "[CRM%s] %s"
|
||
|
|
(replace-regexp-in-string
|
||
|
|
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
|
||
|
|
crm-separator)
|
||
|
|
(car args))
|
||
|
|
(cdr args)))
|
||
|
|
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
|
||
|
|
|
||
|
|
;; Do not allow the cursor in the minibuffer prompt
|
||
|
|
(setq minibuffer-prompt-properties
|
||
|
|
'(read-only t cursor-intangible t face minibuffer-prompt))
|
||
|
|
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
|
||
|
|
|
||
|
|
;; Emacs 28: Hide commands in M-x which do not work in the current mode.
|
||
|
|
;; Vertico commands are hidden in normal buffers.
|
||
|
|
;; (setq read-extended-command-predicate
|
||
|
|
;; #'command-completion-default-include-p)
|
||
|
|
|
||
|
|
;; Enable recursive minibuffers
|
||
|
|
(setq enable-recursive-minibuffers t))
|
||
|
|
|
||
|
|
;; todo: evaluate this
|
||
|
|
;; Optionally use the `orderless' completion style.
|
||
|
|
(use-package orderless
|
||
|
|
:init
|
||
|
|
;; Configure a custom style dispatcher (see the Consult wiki)
|
||
|
|
;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch)
|
||
|
|
;; orderless-component-separator #'orderless-escapable-split-on-space)
|
||
|
|
(setq completion-styles '(orderless basic)
|
||
|
|
completion-category-defaults nil
|
||
|
|
completion-category-overrides '((file (styles partial-completion)))))
|
||
|
|
|
||
|
|
(setq completion-styles '(basic substring partial-completion flex))
|
||
|
|
|
||
|
|
;; Enable rich annotations using the Marginalia package
|
||
|
|
(use-package marginalia
|
||
|
|
;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding
|
||
|
|
;; available in the *Completions* buffer, add it to the
|
||
|
|
;; `completion-list-mode-map'.
|
||
|
|
:bind (:map minibuffer-local-map
|
||
|
|
("M-A" . marginalia-cycle))
|
||
|
|
|
||
|
|
;; The :init section is always executed.
|
||
|
|
:init
|
||
|
|
|
||
|
|
;; Marginalia must be activated in the :init section of use-package such that
|
||
|
|
;; the mode gets enabled right away. Note that this forces loading the
|
||
|
|
;; package.
|
||
|
|
(marginalia-mode))
|
||
|
|
(custom-set-variables
|
||
|
|
;; custom-set-variables was added by Custom.
|
||
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||
|
|
;; Your init file should contain only one such instance.
|
||
|
|
;; If there is more than one, they won't work right.
|
||
|
|
'(package-selected-packages '(counsel ivy)))
|
||
|
|
|
||
|
|
(use-package simple-modeline
|
||
|
|
:hook (after-init . simple-modeline-mode))
|
||
|
|
|
||
|
|
(use-package base16-theme)
|
||
|
|
|
||
|
|
(global-display-line-numbers-mode t)
|
||
|
|
(dolist (mode
|
||
|
|
'(org-mode-hook
|
||
|
|
term-mode-hook
|
||
|
|
eshell-mode-hook))
|
||
|
|
(add-hook mode (lambda () (display-line-numbers-mode 0))))
|
||
|
|
(column-number-mode)
|
||
|
|
|
||
|
|
(use-package rainbow-delimiters
|
||
|
|
:hook (prog-mode . rainbow-delimiters-mode))
|
||
|
|
|
||
|
|
(use-package which-key
|
||
|
|
:init (which-key-mode)
|
||
|
|
:diminish which-key-mode
|
||
|
|
:config(setq which-key-idle-delay 0.3))
|
||
|
|
|
||
|
|
(use-package helpful)
|
||
|
|
;; Note that the built-in `describe-function' includes both functions
|
||
|
|
;; and macros. `helpful-function' is functions only, so we provide
|
||
|
|
;; `helpful-callable' as a drop-in replacement.
|
||
|
|
(global-set-key (kbd "C-h f") #'helpful-callable)
|
||
|
|
|
||
|
|
(global-set-key (kbd "C-h v") #'helpful-variable)
|
||
|
|
(global-set-key (kbd "C-h k") #'helpful-key)
|
||
|
|
(global-set-key (kbd "C-h x") #'helpful-command)
|
||
|
|
|
||
|
|
;; Lookup the current symbol at point. C-c C-d is a common keybinding
|
||
|
|
;; for this in lisp modes.
|
||
|
|
(global-set-key (kbd "C-c C-d") #'helpful-at-point)
|
||
|
|
|
||
|
|
;; Look up *F*unctions (excludes macros).
|
||
|
|
;;
|
||
|
|
;; By default, C-h F is bound to `Info-goto-emacs-command-node'. Helpful
|
||
|
|
;; already links to the manual, if a function is referenced there.
|
||
|
|
(global-set-key (kbd "C-h F") #'helpful-function)
|