Update init.el
This commit is contained in:
parent
26cbb9c985
commit
f4a7cc1d80
163
init.el
163
init.el
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
;; Use melpa
|
;; Use melpa
|
||||||
(require 'package)
|
(require 'package)
|
||||||
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
||||||
(package-initialize)
|
(package-initialize)
|
||||||
|
|
||||||
;; Ensure use-package is installed
|
;; Ensure use-package is installed
|
||||||
@ -33,14 +33,21 @@
|
|||||||
|
|
||||||
;; basic stuff
|
;; basic stuff
|
||||||
(use-package emacs
|
(use-package emacs
|
||||||
:hook (emacs-lisp-mode . (lambda ()
|
:hook ((emacs-lisp-mode . my/-emacs-lisp-mode-setup-evil-lookup)
|
||||||
(setq-local evil-lookup-func
|
(prog-mode . my/enable-electric-pair-mode))
|
||||||
#'my/describe-symbol-at-point)))
|
|
||||||
:init
|
:init
|
||||||
|
(defun my/-emacs-lisp-mode-setup-evil-lookup ()
|
||||||
|
(setq-local evil-lookup-func
|
||||||
|
#'my/describe-symbol-at-point))
|
||||||
|
(defun my/enable-electric-pair-mode ()
|
||||||
|
(electric-pair-local-mode 1))
|
||||||
(defun my/describe-symbol-at-point ()
|
(defun my/describe-symbol-at-point ()
|
||||||
"Calls `describe-symbol' on the return value of `form-at-point'."
|
"Calls `describe-symbol' on the return value of `form-at-point'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(describe-symbol (form-at-point)))
|
(let ((form (form-at-point)))
|
||||||
|
(if (consp form)
|
||||||
|
(describe-symbol (cadr form))
|
||||||
|
(describe-symbol form))))
|
||||||
|
|
||||||
;; Make show paren instant
|
;; Make show paren instant
|
||||||
(setq show-paren-delay 0)
|
(setq show-paren-delay 0)
|
||||||
@ -58,9 +65,8 @@
|
|||||||
;; Disable startup screen
|
;; Disable startup screen
|
||||||
(setq inhibit-startup-screen t)
|
(setq inhibit-startup-screen t)
|
||||||
|
|
||||||
;; rainbow-delimiters
|
;; show column numbers
|
||||||
(use-package rainbow-delimiters
|
(column-number-mode 1)
|
||||||
:hook (prog-mode . rainbow-delimiters-mode))
|
|
||||||
|
|
||||||
;; Disable the menu and tool bars
|
;; Disable the menu and tool bars
|
||||||
(menu-bar-mode -1)
|
(menu-bar-mode -1)
|
||||||
@ -72,10 +78,24 @@
|
|||||||
;; Set fonts
|
;; Set fonts
|
||||||
(add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font Mono-12"))
|
(add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font Mono-12"))
|
||||||
|
|
||||||
|
;; Some settings for programming
|
||||||
|
(setq-default indent-tabs-mode nil
|
||||||
|
tab-width 4
|
||||||
|
c-basic-offset 4
|
||||||
|
indent-line-function 'insert-tab)
|
||||||
|
|
||||||
;; Tree sitter download locations
|
;; Tree sitter download locations
|
||||||
(setq treesit-language-source-alist
|
(setq treesit-language-source-alist
|
||||||
'((c "https://github.com/tree-sitter/tree-sitter-c")
|
'((c "https://github.com/tree-sitter/tree-sitter-c")
|
||||||
(cpp "https://github.com/tree-sitter/tree-sitter-cpp"))))
|
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
|
||||||
|
(java "https://github.com/tree-sitter/tree-sitter-java")
|
||||||
|
(python "https://github.com/tree-sitter/tree-sitter-python")
|
||||||
|
(rust "https://github.com/tree-sitter/tree-sitter-rust")))
|
||||||
|
;; Tree sitter major mode conversions
|
||||||
|
(setq major-mode-remap-alist
|
||||||
|
'((c-mode . c-ts-mode)
|
||||||
|
(java-mode . java-ts-mode)
|
||||||
|
(rust-mode . rust-ts-mode))))
|
||||||
|
|
||||||
(use-package recentf
|
(use-package recentf
|
||||||
:config
|
:config
|
||||||
@ -110,16 +130,21 @@
|
|||||||
|
|
||||||
;; avy
|
;; avy
|
||||||
(use-package avy
|
(use-package avy
|
||||||
:bind ("C-c C-j" . avy-resume)
|
:bind (("C-c C-j" . avy-resume)
|
||||||
|
("M-s s" . evil-avy-goto-char-2)
|
||||||
|
("M-s S" . evil-avy-goto-line))
|
||||||
:init
|
:init
|
||||||
(define-minor-mode my/evil-avy-mode
|
(define-minor-mode my/evil-avy-mode
|
||||||
"Minor mode to define avy motions for evil"
|
"A minor mode for binding avy commands to s and S in evil's normal and
|
||||||
:global t
|
visual states."
|
||||||
:keymap (make-sparse-keymap))
|
:keymap (make-sparse-keymap))
|
||||||
(evil-define-key '(normal visual operator motion) my/evil-avy-mode-map
|
(evil-define-key '(normal visual operator motion) my/evil-avy-mode-map
|
||||||
"s" #'evil-avy-goto-char-2
|
"s" #'evil-avy-goto-char-2
|
||||||
"S" #'evil-avy-goto-line)
|
"S" #'evil-avy-goto-line)
|
||||||
(my/evil-avy-mode 1)
|
(define-globalized-minor-mode my/evil-avy-global-mode my/evil-avy-mode
|
||||||
|
(lambda () (my/evil-avy-mode 1))
|
||||||
|
:predicate '((not magit-mode dired-mode proced-mode) t))
|
||||||
|
(my/evil-avy-global-mode 1)
|
||||||
:config
|
:config
|
||||||
(avy-setup-default))
|
(avy-setup-default))
|
||||||
|
|
||||||
@ -141,7 +166,10 @@
|
|||||||
:bind (:map vertico-map
|
:bind (:map vertico-map
|
||||||
("C-S-k" . kill-line)
|
("C-S-k" . kill-line)
|
||||||
("C-k" . vertico-previous)
|
("C-k" . vertico-previous)
|
||||||
("C-j" . vertico-next))
|
("C-j" . vertico-next)
|
||||||
|
("RET" . vertico-directory-enter)
|
||||||
|
("DEL" . vertico-directory-delete-char)
|
||||||
|
("M-DEL" . vertico-directory-delete-word))
|
||||||
:init
|
:init
|
||||||
(setq vertico-cycle t
|
(setq vertico-cycle t
|
||||||
enable-recursive-minibuffers t
|
enable-recursive-minibuffers t
|
||||||
@ -155,7 +183,10 @@
|
|||||||
;; orderless
|
;; orderless
|
||||||
(use-package orderless
|
(use-package orderless
|
||||||
:autoload orderless-define-completion-style
|
:autoload orderless-define-completion-style
|
||||||
|
:hook (text-mode . my/-setup-text-mode-completion-styles)
|
||||||
:init
|
:init
|
||||||
|
(defun my/-setup-text-mode-completion-styles ()
|
||||||
|
(setq-local completion-styles '(basic)))
|
||||||
(orderless-define-completion-style my/orderless-with-initialism
|
(orderless-define-completion-style my/orderless-with-initialism
|
||||||
(orderless-matching-styles '(orderless-initialism
|
(orderless-matching-styles '(orderless-initialism
|
||||||
orderless-literal
|
orderless-literal
|
||||||
@ -165,7 +196,9 @@
|
|||||||
completion-category-overrides '((file
|
completion-category-overrides '((file
|
||||||
(styles basic partial-completion))
|
(styles basic partial-completion))
|
||||||
(command
|
(command
|
||||||
(my/orderless-with-initialism basic)))))
|
(my/orderless-with-initialism basic))
|
||||||
|
(eglot
|
||||||
|
(orderless basic)))))
|
||||||
|
|
||||||
;; marginalia
|
;; marginalia
|
||||||
(use-package marginalia
|
(use-package marginalia
|
||||||
@ -176,9 +209,14 @@
|
|||||||
|
|
||||||
;; embark
|
;; embark
|
||||||
(use-package embark
|
(use-package embark
|
||||||
:bind (("M-e" . embark-act)
|
:bind (("C-." . embark-act)
|
||||||
:map minibuffer-local-map
|
("C-;" . embark-dwim))
|
||||||
("M-E" . embark-collect)))
|
:init
|
||||||
|
(setq embark-quit-after-action nil)
|
||||||
|
(add-to-list 'display-buffer-alist
|
||||||
|
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
||||||
|
nil
|
||||||
|
(window-parameters (mode-line-format . none)))))
|
||||||
|
|
||||||
;; consult
|
;; consult
|
||||||
(use-package consult
|
(use-package consult
|
||||||
@ -193,8 +231,9 @@
|
|||||||
("C-x c f" . consult-focus-lines)
|
("C-x c f" . consult-focus-lines)
|
||||||
("C-x c r" . consult-recent-file)
|
("C-x c r" . consult-recent-file)
|
||||||
("C-x c b" . consult-bookmark)
|
("C-x c b" . consult-bookmark)
|
||||||
:map flymake-mode-map
|
("M-g i" . consult-imenu)
|
||||||
("C-c e" . consult-flymake))
|
("M-g I" . consult-imenu-multi)
|
||||||
|
("M-g r" . consult-imenu-multi))
|
||||||
:init
|
:init
|
||||||
(defun my/consult-emacs-info ()
|
(defun my/consult-emacs-info ()
|
||||||
"`consult-info' for emacs specific pages."
|
"`consult-info' for emacs specific pages."
|
||||||
@ -208,13 +247,39 @@
|
|||||||
|
|
||||||
;; corfu (autocomplete)
|
;; corfu (autocomplete)
|
||||||
(use-package corfu
|
(use-package corfu
|
||||||
:bind ("M-<tab>" . corfu-complete)
|
:bind (("M-<tab>" . completion-at-point)
|
||||||
|
:map corfu-map
|
||||||
|
("M-SPC" . corfu-insert-separator)
|
||||||
|
("M-m" . my/corfu-move-to-minibuffer))
|
||||||
:init
|
:init
|
||||||
|
(defun my/corfu-move-to-minibuffer ()
|
||||||
|
(interactive)
|
||||||
|
(when completion-in-region--data
|
||||||
|
(let ((completion-extra-properties corfu--extra)
|
||||||
|
completion-cycle-threshold completion-cycling)
|
||||||
|
(apply #'consult-completion-in-region completion-in-region--data))))
|
||||||
(setq corfu-cycle t
|
(setq corfu-cycle t
|
||||||
corfu-auto t
|
corfu-auto t
|
||||||
corfu-on-exact-match nil
|
corfu-on-exact-match nil
|
||||||
completion-cycle-threshold 3)
|
completion-cycle-threshold 3)
|
||||||
(global-corfu-mode 1))
|
(global-corfu-mode 1)
|
||||||
|
(corfu-popupinfo-mode 1)
|
||||||
|
:config
|
||||||
|
(add-to-list 'corfu-continue-commands #'corfu-move-to-minibuffer))
|
||||||
|
(use-package corfu-terminal
|
||||||
|
:init
|
||||||
|
(corfu-terminal-mode 1))
|
||||||
|
|
||||||
|
;; cape (a bunch of capfs!)
|
||||||
|
(use-package cape
|
||||||
|
:bind (("M-p" . cape-dabbrev)
|
||||||
|
("M-P" . cape-line))
|
||||||
|
:hook (text-mode . my/-cape-setup-text-mode)
|
||||||
|
:init
|
||||||
|
(defun my/-cape-setup-text-mode ()
|
||||||
|
(setq-local completion-at-point-functions
|
||||||
|
'(cape-dict cape-dabbrev)))
|
||||||
|
(add-to-list 'completion-at-point-functions #'cape-file))
|
||||||
|
|
||||||
;; xref
|
;; xref
|
||||||
(use-package xref
|
(use-package xref
|
||||||
@ -226,8 +291,24 @@
|
|||||||
|
|
||||||
;; flymake
|
;; flymake
|
||||||
(use-package flymake
|
(use-package flymake
|
||||||
|
:bind (:map flymake-mode-map
|
||||||
|
("C-c e" . my/flymake-show-diagnostic-at-point)
|
||||||
|
("C-c E" . consult-flymake))
|
||||||
|
:hook (emacs-lisp-mode . my/enable-flymake-mode)
|
||||||
:init
|
:init
|
||||||
(flymake-mode 1))
|
(defun my/flymake-show-diagnostic-at-point ()
|
||||||
|
(interactive)
|
||||||
|
(if-let ((pos (point))
|
||||||
|
(diag (and flymake-mode
|
||||||
|
(get-char-property pos 'flymake-diagnostic)))
|
||||||
|
(message (flymake--diag-text diag)))
|
||||||
|
(progn
|
||||||
|
;; show the frame
|
||||||
|
)))
|
||||||
|
(defun my/-flymake-show-diagnostic-hide-frame ()
|
||||||
|
(make-frame-invisible my/-flymake-show-diagnostic-frame))
|
||||||
|
(defun my/enable-flymake-mode ()
|
||||||
|
(flymake-mode 1)))
|
||||||
|
|
||||||
;; eldoc
|
;; eldoc
|
||||||
(use-package eldoc
|
(use-package eldoc
|
||||||
@ -235,17 +316,34 @@
|
|||||||
:init
|
:init
|
||||||
(set eldoc-echo-area-use-multiline-p nil))
|
(set eldoc-echo-area-use-multiline-p nil))
|
||||||
|
|
||||||
|
;; eglot
|
||||||
|
(use-package eglot
|
||||||
|
:hook (((c-ts-mode c++-ts-mode java-ts-mode rust-ts-mode
|
||||||
|
python-ts-mode) . eglot-ensure)
|
||||||
|
(eglot-managed-mode . my/-eglot-setup-eldoc))
|
||||||
|
:init
|
||||||
|
(defun my/-eglot-setup-eldoc ()
|
||||||
|
"Setup eldoc variables for `eglot-managed-mode-hook'."
|
||||||
|
(setq-local eldoc-echo-area-use-multiline-p
|
||||||
|
nil))
|
||||||
|
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)
|
||||||
|
(setq eglot-autoshutdown t
|
||||||
|
eglot-ignored-server-capabilities '(:inlayHintProvider)))
|
||||||
|
|
||||||
|
;; rust
|
||||||
|
(use-package rust-mode)
|
||||||
|
|
||||||
|
;; json
|
||||||
|
(use-package json-mode)
|
||||||
|
|
||||||
;; vterm
|
;; vterm
|
||||||
(use-package vterm
|
(use-package vterm
|
||||||
:bind ("M-RET" . vterm))
|
:bind ("C-x C-a" . vterm))
|
||||||
|
|
||||||
;; proced
|
;; proced
|
||||||
(use-package proced
|
(use-package proced
|
||||||
:bind ("C-x o" . proced)
|
:bind ("C-x o" . proced)
|
||||||
:init
|
:init
|
||||||
(evil-define-key '(normal visual motion) proced-mode-map
|
|
||||||
"zf" #'proced-filter-interactive
|
|
||||||
"zF" #'proced-format-interactive)
|
|
||||||
(setq proced-auto-update-flag t
|
(setq proced-auto-update-flag t
|
||||||
proced-auto-update-interval 1))
|
proced-auto-update-interval 1))
|
||||||
|
|
||||||
@ -261,7 +359,16 @@
|
|||||||
"U" #'dired-unmark-all-marks))
|
"U" #'dired-unmark-all-marks))
|
||||||
|
|
||||||
;; magit
|
;; magit
|
||||||
(use-package magit)
|
(use-package magit
|
||||||
|
:bind ("C-x C-m" . magit)
|
||||||
|
:init
|
||||||
|
(evil-define-key '(normal visual motion) magit-mode-map
|
||||||
|
"s" #'magit-stage-file
|
||||||
|
"S" #'magit-stage-modified))
|
||||||
|
|
||||||
|
;; rainbow-delimiters
|
||||||
|
(use-package rainbow-delimiters
|
||||||
|
:hook (prog-mode . rainbow-delimiters-mode))
|
||||||
|
|
||||||
;; Theme (doom-themes)
|
;; Theme (doom-themes)
|
||||||
(use-package doom-themes
|
(use-package doom-themes
|
||||||
|
Loading…
Reference in New Issue
Block a user