Big emacs cleanup, nearly there.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
;;;; Markdown
|
||||
(use-package markdown-mode)
|
||||
|
||||
;;;; Odin
|
||||
(use-package odin-mode
|
||||
:vc (:url "https://github.com/mattt-b/odin-mode"
|
||||
:rev :newest)
|
||||
:mode "\\.odin\\'"
|
||||
:hook (odin-mode . eglot-ensure))
|
||||
|
||||
(use-package eglot
|
||||
:ensure nil
|
||||
:config
|
||||
(setq eglot-autoshutdown t)
|
||||
(add-to-list 'eglot-ignored-server-capabilities :signatureHelpProvider)
|
||||
|
||||
;; Explicit OLS configuration.
|
||||
(add-to-list
|
||||
'eglot-server-programs
|
||||
'(odin-mode
|
||||
. ("/home/jason/.local/bin/ols"
|
||||
:initializationOptions
|
||||
(:odin_command "/home/jason/.odin/odin"
|
||||
:enable_document_symbols t
|
||||
:enable_format t
|
||||
:collections
|
||||
[(:name "core"
|
||||
:path "/home/jason/.odin/core")
|
||||
(:name "vendor"
|
||||
:path "/home/jason/.odin/vendor")])))))
|
||||
|
||||
;; OLS built-in definitions.
|
||||
(setenv "OLS_BUILTIN_FOLDER" "/home/jason/ThirdParty/ols/builtin")
|
||||
|
||||
;;;; Code navigation
|
||||
;; Vim-style code navigation.
|
||||
(evil-define-key '(normal motion) 'global
|
||||
"gd" #'xref-find-definitions
|
||||
"gD" #'xref-find-references
|
||||
"K" #'eldoc
|
||||
(kbd "C-t") #'xref-go-back)
|
||||
|
||||
;; ESC closes any open eldoc window.
|
||||
(defun my/eldoc-close (&rest _)
|
||||
(dolist (w (window-list))
|
||||
(when (string-prefix-p "*eldoc" (buffer-name (window-buffer w)))
|
||||
(quit-window nil w))))
|
||||
(advice-add 'evil-force-normal-state :after #'my/eldoc-close)
|
||||
@@ -0,0 +1,58 @@
|
||||
;;; git.el --- Magit, set up for Evil -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;; Loaded from init.el, which must set `evil-want-keybinding' to nil before
|
||||
;; Evil loads (Evil Collection needs it).
|
||||
;;
|
||||
;; :git Magit status for the current repo, full frame.
|
||||
;; q puts your previous window layout back.
|
||||
;; :git ARGS Run `git ARGS' from the repo root, e.g. :git log --oneline
|
||||
;;
|
||||
;; In Magit (Evil Collection layout):
|
||||
;; j/k move, TAB folds, s stage, u unstage, x discard, c c commit,
|
||||
;; p push, F pull, l log, d diff, b branch, z stash, gr refresh, q quit,
|
||||
;; ? lists every command.
|
||||
;; Commit message: opens in insert state; ZZ or C-c C-c commits,
|
||||
;; ZQ or C-c C-k cancels.
|
||||
;; Ctrl+hjkl, C-f and C-b keep their global meaning in Magit buffers.
|
||||
;;; Code:
|
||||
|
||||
(use-package magit
|
||||
:defer t
|
||||
:custom
|
||||
;; Status takes the whole frame; q restores the previous window layout.
|
||||
(magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
|
||||
(magit-bury-buffer-function #'magit-restore-window-configuration))
|
||||
|
||||
;; Vim-style keys for Magit, its section folding, and the commit message buffer.
|
||||
;; (magit magit-submodule) is the form Evil Collection's own default list uses.
|
||||
(with-eval-after-load 'evil-collection
|
||||
;; Evil Collection puts section jumps on C-j/C-k and page scrolling on C-f/C-b.
|
||||
;; Unbind them so your window and Consult keys show through. Sibling sections
|
||||
;; are still on ] and [, and scrolling on C-d/C-u.
|
||||
(add-hook 'evil-collection-setup-hook
|
||||
(lambda (mode &rest _)
|
||||
(when (eq mode 'magit)
|
||||
(evil-define-key 'normal magit-mode-map
|
||||
(kbd "C-j") nil
|
||||
(kbd "C-k") nil
|
||||
(kbd "C-f") nil
|
||||
(kbd "C-b") nil))))
|
||||
|
||||
(evil-collection-init '((magit magit-submodule) magit-section with-editor)))
|
||||
|
||||
;; Commit messages start in insert state. Added after git-commit loads so its
|
||||
;; default hook functions are kept.
|
||||
(with-eval-after-load 'git-commit
|
||||
(add-hook 'git-commit-setup-hook #'evil-insert-state))
|
||||
|
||||
;; :git opens Magit; :git ARGS runs a git command.
|
||||
(evil-define-command my/git (args)
|
||||
"Open Magit status, or run `git ARGS' from the repository root."
|
||||
(interactive "<a>")
|
||||
(if (and args (string-match-p "[^[:space:]]" args))
|
||||
(magit-git-command-topdir (concat "git " args))
|
||||
(magit-status)))
|
||||
|
||||
(evil-ex-define-cmd "git" #'my/git)
|
||||
|
||||
;;; git.el ends here
|
||||
Reference in New Issue
Block a user