mirror of
https://codeberg.org/scip/dot-emacs.git
synced 2026-08-23 21:24:18 +02:00
Compare commits
13 Commits
f7ba06bdbb
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| d81c8c919a | |||
| cfb9e1dae8 | |||
| b05ec0c517 | |||
| 57b51dae23 | |||
| 9aae50bc5c | |||
| 9659ad8b58 | |||
| 1ce0a66378 | |||
| 301d837851 | |||
| f246281bc4 | |||
| f94826d8cc | |||
| 586caeffba | |||
| 1907af8f1d | |||
| a6ae2d862e |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -24,3 +24,8 @@ emms
|
||||
macros.el
|
||||
forge-database.sqlite
|
||||
forge-database*
|
||||
.cache
|
||||
cache
|
||||
*history*
|
||||
tree-sitter
|
||||
warnings
|
||||
|
||||
15
customize.el
15
customize.el
@@ -11,7 +11,20 @@
|
||||
'("7f1d414afda803f3244c6fb4c2c64bea44dac040ed3731ec9d75275b9e831fe5"
|
||||
default))
|
||||
'(magit-todos-insert-after '(bottom) nil nil "Changed by setter of obsolete option `magit-todos-insert-at'")
|
||||
'(package-selected-packages nil)
|
||||
'(package-selected-packages
|
||||
'(beacon blamer browse-kill-ring buffer-move change-inner consult-dir
|
||||
corfu csv-mode d2-mode default-text-scale dictcc
|
||||
dired-filter dired-k dired-ranger dumb-jump elmacro
|
||||
elvish-mode embark-consult ement fic-mode forge
|
||||
fringe-current-line go-mode goto-last-change
|
||||
hide-mode-line highlight-indentation htmlize hungry-delete
|
||||
ibuffer-tramp ibuffer-vc iedit loccur lsp-treemacs lsp-ui
|
||||
lua-mode magit-todos marginalia orderless org-bullets
|
||||
org-present org-superstar orgalist persistent-scratch
|
||||
perspective projectile rust-mode smartparens
|
||||
solarized-theme sqlite3 swiper tablist typst-ts-mode
|
||||
undo-tree vertico visual-fill-column vterm web-mode
|
||||
windresize yaml-mode))
|
||||
'(safe-local-variable-values '((ruby-indent-level 4)))
|
||||
'(warning-suppress-types '((comp))))
|
||||
(custom-set-faces
|
||||
|
||||
@@ -44,20 +44,35 @@
|
||||
;; prefix. So just a hydra will do.
|
||||
|
||||
(when (fboundp 'defhydra)
|
||||
(defhydra hydra-smerge (:color blue :timeout 30.0)
|
||||
(defhydra hydra-smerge (:timeout 30.0 :exit nil)
|
||||
"
|
||||
^Smerge Mode^
|
||||
^^-------------------------------------------------------
|
||||
_n_ext conflict keep _u_pper m_e_rge conflicts in Ediff
|
||||
_p_revious conflict keep _l_ower _q_uit"
|
||||
^^--------------------------------------------------------------
|
||||
_n_: next conflict _u_: keep upper _s_: swap
|
||||
_p_: prev conflict _l_: keep lower _h_: highlight
|
||||
_e_: Ediff _b_: keep base _r_: resolve
|
||||
_q_: quit _RET_: keep hunk@point _R_: revert
|
||||
|
||||
("n" smerge-next nil :exit nil)
|
||||
("p" smerge-prev nil :exit nil)
|
||||
("u" smerge-keep-upper nil :exit nil)
|
||||
("l" smerge-keep-lower nil :exit nil)
|
||||
("e" smerge-ediff nil :color red)
|
||||
("q" nil nil :color red))
|
||||
^^--------------------------------------------------------------
|
||||
Reach this hydra with <C-x m>
|
||||
^^--------------------------------------------------------------
|
||||
|
||||
"
|
||||
|
||||
("n" smerge-next nil)
|
||||
("p" smerge-prev nil)
|
||||
("u" smerge-keep-upper nil)
|
||||
("l" smerge-keep-lower nil)
|
||||
("b" smerge-keep-base nil)
|
||||
("RET" smerge-keep-current nil)
|
||||
("h" smerge-refine nil)
|
||||
("s" smerge-swap nil)
|
||||
("r" smerge-resolve nil)
|
||||
("R" undo-tree-undo nil)
|
||||
("e" smerge-ediff nil :color blue)
|
||||
("q" nil nil :color blue))
|
||||
|
||||
(global-set-key (kbd "C-x m") 'hydra-smerge/body)
|
||||
(defalias 'merge 'hydra-smerge/body))
|
||||
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ Version 2015-04-09"
|
||||
(global-set-key (kbd "C-c C-p") 'copy-buffer-read-only) ; make read-only buffer copy
|
||||
|
||||
;; --------------------------------------------------------------------------------
|
||||
;; ** Cleanup, close all windows and kill all buffers
|
||||
;; ** Cleanup, close all windows and kill all buffers and processes
|
||||
|
||||
;; From time to time I get annoyed by the many dozen buffers
|
||||
;; opened. In such cases I like to close them all at once.
|
||||
@@ -364,6 +364,8 @@ Version 2015-04-09"
|
||||
(clean-buffer-list)
|
||||
(dolist (buffer (buffer-list))
|
||||
(kill-buffer buffer))
|
||||
(dolist (process (list-processes))
|
||||
(kill-process process))
|
||||
(delete-minibuffer-contents)
|
||||
(if (fboundp 'tramp-cleanup-all-connections)
|
||||
(tramp-cleanup-all-connections))
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
:config
|
||||
(setq gofmt-args '("-s"))
|
||||
(setq tab-width 4)
|
||||
;; (setq indent-tabs-mode 1)
|
||||
|
||||
;; by default this runs godef-jump, but I like consult-imenu much more
|
||||
(unbind-key "C-c C-j" go-mode-map)
|
||||
|
||||
:init
|
||||
;; disabled, I'm now trying lsp-mode, see below:
|
||||
@@ -20,16 +22,10 @@
|
||||
(add-hook 'before-save-hook #'lsp-organize-imports t t))
|
||||
|
||||
(add-hook 'go-mode-hook #'lsp-deferred)
|
||||
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
|
||||
;; (add-hook 'go-mode-hook #'ivy-mode)
|
||||
|
||||
;; overwrite dump-jump settions here
|
||||
;; (bind-key* (kbd "C-c j") #'lsp-find-definition)
|
||||
;; (bind-key* (kbd "C-c b") #'xref-pop-marker-stack)
|
||||
)
|
||||
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks))
|
||||
|
||||
:bind (:map go-mode-map
|
||||
( "C-c j" . #'lsp-find-definition)
|
||||
("C-c j" . #'lsp-find-definition)
|
||||
("C-c b" . #'xref-pop-marker-stack)))
|
||||
|
||||
(use-package kage-mode
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
(setq lsp-ui-doc-enable nil ;; enable on the fly with "C-c D"
|
||||
lsp-ui-doc-use-webkit nil
|
||||
lsp-ui-doc-header t
|
||||
lsp-ui-doc-delay 0.2
|
||||
lsp-ui-doc-delay 1.0
|
||||
lsp-ui-doc-position 'top
|
||||
lsp-ui-doc-side 'right
|
||||
lsp-ui-doc-include-signature t
|
||||
@@ -72,7 +72,7 @@
|
||||
lsp-ui-peek-peek-height 40
|
||||
|
||||
;; FIXME: maybe this is too much, check at work
|
||||
lsp-ui-sideline-enable t
|
||||
lsp-ui-sideline-enable nil
|
||||
lsp-ui-sideline-update-mode 'point
|
||||
lsp-ui-sideline-show-code-actions nil
|
||||
lsp-ui-sideline-show-hover t
|
||||
|
||||
@@ -1,6 +1,29 @@
|
||||
;; *** Magit
|
||||
|
||||
;; TODO: add blamer.el (https://github.com/Artawower/blamer.el), currently fails to install (2023/05/08)
|
||||
(when (fboundp 'defhydra)
|
||||
(defhydra hydra-blame (:timeout 30.0 :exit nil)
|
||||
"
|
||||
^Blame Mode^
|
||||
^^--------------------------------------------------------------
|
||||
_n_: next chunk _M-w_: copy commit hash hash
|
||||
_p_: prev chunk _c_: cycle style
|
||||
_N_: next chunk same commit _RET_: show current commit
|
||||
_P_: prev chunk same commit _q_: quit blame mode
|
||||
|
||||
^^--------------------------------------------------------------
|
||||
Reach this hydra with <C-x B>, magit-blame mode must be active
|
||||
^^--------------------------------------------------------------
|
||||
|
||||
"
|
||||
|
||||
("n" magit-blame-next-chunk nil)
|
||||
("p" magit-blame-previous-chunk nil)
|
||||
("N" magit-blame-next-chunk-same-commit nil)
|
||||
("P" magit-blame-previous-chunk-same-commit nil)
|
||||
("M-w" magit-blame-copy-hash nil)
|
||||
("RET" magit-show-commit nil)
|
||||
("c" magit-blame-cycle-style nil)
|
||||
("q" nil nil :color blue)))
|
||||
|
||||
;; Not much to say about Magit
|
||||
(use-package magit
|
||||
@@ -15,6 +38,14 @@
|
||||
;; the hassle to go to status before just committing etc. So:
|
||||
(("C-c g" . magit-file-dispatch))
|
||||
|
||||
:hook
|
||||
;; automatically fire up smerge hydra when visiting a buffer
|
||||
;; containing merge conflict[s]. Hydra see init-ediff.el
|
||||
(magit-diff-visit-file . (lambda () (hydra-smerge/body)))
|
||||
|
||||
// automatically fire up blame hydra, see definition above ont top
|
||||
(magit-blame-mode . (lambda () (hydra-blame/body)))
|
||||
|
||||
:config
|
||||
(magit-todos-mode)
|
||||
|
||||
@@ -124,7 +155,17 @@
|
||||
(magit-restore-window-configuration)
|
||||
(mapc #'kill-buffer buffers)))
|
||||
|
||||
(define-key magit-status-mode-map (kbd "q") #'tvd-kill-magit-buffers))
|
||||
(define-key magit-status-mode-map (kbd "q") #'tvd-kill-magit-buffers)
|
||||
|
||||
(defun tvd-blame-mode()
|
||||
(interactive)
|
||||
(if (not magit-blame-mode)
|
||||
(progn
|
||||
(magit-blame)
|
||||
(hydra-blame/body))))
|
||||
|
||||
(global-set-key (kbd "C-x B") 'tvd-blame-mode)
|
||||
)
|
||||
|
||||
|
||||
(use-package blamer
|
||||
@@ -138,9 +179,9 @@
|
||||
|
||||
:custom-face
|
||||
(blamer-face ((t :foreground "#7a88cf"
|
||||
:background nil
|
||||
:height 140
|
||||
:italic t)))
|
||||
:background nil
|
||||
:height 140
|
||||
:italic t)))
|
||||
|
||||
:config
|
||||
(defalias 'blame 'blamer-mode)
|
||||
@@ -148,18 +189,56 @@
|
||||
;; in addition to blaming I also like to follow the lead, so make
|
||||
;; the hash lead to the commit by clicking on it.
|
||||
(defun blamer-callback-show-commit-diff (commit-info)
|
||||
(interactive)
|
||||
(let ((commit-hash (plist-get commit-info :commit-hash)))
|
||||
(when commit-hash
|
||||
(magit-show-commit commit-hash))))
|
||||
(interactive)
|
||||
(let ((commit-hash (plist-get commit-info :commit-hash)))
|
||||
(when commit-hash
|
||||
(magit-show-commit commit-hash))))
|
||||
|
||||
(setq blamer-bindings '(("<mouse-1>" . blamer-callback-show-commit-diff))))
|
||||
|
||||
(use-package forge
|
||||
:after magit)
|
||||
:after magit
|
||||
|
||||
:config
|
||||
(push '("git.f-i-ts.de" ; GITHOST
|
||||
"git.f-i-ts.de/api/v4" ; APIHOST
|
||||
"git.f-i-ts.de" ; WEBHOST and INSTANCE-ID
|
||||
forge-gitlab-repository) ; CLASS
|
||||
forge-alist))
|
||||
|
||||
(use-package sqlite3
|
||||
:defer nil)
|
||||
|
||||
;; git helpers
|
||||
(defun tvd-list-git-repos()
|
||||
"Returns a list of all available git repositories in dev and fits/git"
|
||||
(interactive)
|
||||
(setq repos (list))
|
||||
(let ((bases (list "~/dev" "~/fits/git")))
|
||||
(dolist (base bases)
|
||||
(dolist (dir (directory-files base nil "^[^\\.]"))
|
||||
(if (and (file-accessible-directory-p (concat base "/" dir "/.git"))
|
||||
(not (s-suffix? "bak" dir) ))
|
||||
(push dir repos)))))
|
||||
repos)
|
||||
|
||||
(defun tvd-switch-to-repo(repo)
|
||||
"calls magit-status with <repo>, switches to and changes dir to it"
|
||||
(interactive)
|
||||
(let* ((devdir (concat "~/dev/" repo))
|
||||
(fitsdir (concat "~/fits/git/" repo)))
|
||||
(cond
|
||||
((file-accessible-directory-p (concat devdir "/.git"))
|
||||
(magit-status devdir))
|
||||
((file-accessible-directory-p (concat fitsdir "/.git"))
|
||||
(magit-status fitsdir)))))
|
||||
|
||||
(defun gitswitch()
|
||||
"select a git repo from a list and switch to it"
|
||||
(interactive)
|
||||
(tvd-switch-to-repo (completing-read "select git repo> " (tvd-list-git-repos))))
|
||||
|
||||
(setq auth-sources '("~/.authinfo"))
|
||||
|
||||
(provide 'init-magit)
|
||||
;;; init-magit.el ends here
|
||||
|
||||
@@ -37,7 +37,7 @@ via [[http://whattheemacsd.com/setup-ido.el-02.html][whattheemacs.d]]"
|
||||
(insert "~/"))
|
||||
(call-interactively 'self-insert-command)))
|
||||
|
||||
(defun tvd-vertico-jump-root()
|
||||
(defun tvd-vertico-jump-root()
|
||||
"quickly go to root dir with / in minibuffer find-file, if we are in a local fs"
|
||||
(interactive)
|
||||
(if (file-directory-p (file-name-directory (minibuffer-contents-no-properties)))
|
||||
@@ -65,8 +65,8 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
(delete-char -1))
|
||||
(if (search-backward "/" nil t)
|
||||
(let ((beg (+ (point) 1)))
|
||||
(end-of-buffer)
|
||||
(delete-region beg (point)))
|
||||
(end-of-buffer)
|
||||
(delete-region beg (point)))
|
||||
(delete-char -1)))
|
||||
(delete-char -1)))
|
||||
|
||||
@@ -104,8 +104,6 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
("TAB" . #'minibuffer-complete)))
|
||||
|
||||
|
||||
|
||||
|
||||
(use-package orderless
|
||||
:init
|
||||
;; I am using the actual orderless completion style as a last
|
||||
@@ -128,44 +126,79 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
completion-category-overrides '((file (styles basic partial-completion))))
|
||||
|
||||
(setq read-file-name-completion-ignore-case t
|
||||
read-buffer-completion-ignore-case t
|
||||
completion-ignore-case t))
|
||||
read-buffer-completion-ignore-case t
|
||||
completion-ignore-case t))
|
||||
|
||||
|
||||
(use-package embark
|
||||
:ensure t
|
||||
|
||||
(when nil
|
||||
(use-package embark
|
||||
:ensure t
|
||||
|
||||
:bind
|
||||
(("C-." . embark-act) ;; pick some comfortable binding
|
||||
("C-," . embark-dwim)) ;; good alternative: M-.
|
||||
:bind
|
||||
(("C-." . embark-act) ;; pick some comfortable binding
|
||||
("C-," . embark-dwim)) ;; good alternative: M-.
|
||||
|
||||
|
||||
:init
|
||||
:init
|
||||
;; Optionally replace the key help with a completing-read interface
|
||||
(setq prefix-help-command #'embark-prefix-help-command)
|
||||
|
||||
;; Optionally replace the key help with a completing-read interface
|
||||
(setq prefix-help-command #'embark-prefix-help-command)
|
||||
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
|
||||
;; strategy, if you want to see the documentation from multiple providers.
|
||||
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
|
||||
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
|
||||
|
||||
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
|
||||
;; strategy, if you want to see the documentation from multiple providers.
|
||||
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
|
||||
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
|
||||
:config
|
||||
;; Hide the mode line of the Embark live/completions buffers
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
||||
nil
|
||||
(window-parameters (mode-line-format . none))))
|
||||
|
||||
:config
|
||||
|
||||
;; Hide the mode line of the Embark live/completions buffers
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
||||
nil
|
||||
(window-parameters (mode-line-format . none))))))
|
||||
(defun embark-which-key-indicator ()
|
||||
"An embark indicator that displays keymaps using which-key.
|
||||
The which-key help message will show the type and value of the
|
||||
current target followed by an ellipsis if there are further
|
||||
targets."
|
||||
(lambda (&optional keymap targets prefix)
|
||||
(if (null keymap)
|
||||
(which-key--hide-popup-ignore-command)
|
||||
(which-key--show-keymap
|
||||
(if (eq (plist-get (car targets) :type) 'embark-become)
|
||||
"Become"
|
||||
(format "Act on %s '%s'%s"
|
||||
(plist-get (car targets) :type)
|
||||
(embark--truncate-target (plist-get (car targets) :target))
|
||||
(if (cdr targets) "…" "")))
|
||||
(if prefix
|
||||
(pcase (lookup-key keymap prefix 'accept-default)
|
||||
((and (pred keymapp) km) km)
|
||||
(_ (key-binding prefix 'accept-default)))
|
||||
keymap)
|
||||
nil nil t (lambda (binding)
|
||||
(not (string-suffix-p "-argument" (cdr binding))))))))
|
||||
|
||||
(setq embark-indicators
|
||||
'(embark-which-key-indicator
|
||||
embark-highlight-indicator
|
||||
embark-isearch-highlight-indicator))
|
||||
|
||||
(defun embark-hide-which-key-indicator (fn &rest args)
|
||||
"Hide the which-key indicator immediately when using the completing-read prompter."
|
||||
(which-key--hide-popup-ignore-command)
|
||||
(let ((embark-indicators
|
||||
(remq #'embark-which-key-indicator embark-indicators)))
|
||||
(apply fn args)))
|
||||
|
||||
(advice-add #'embark-completing-read-prompter
|
||||
:around #'embark-hide-which-key-indicator))
|
||||
|
||||
(use-package consult
|
||||
;; Replace bindings. Lazily loaded due by `use-package'.
|
||||
:bind (;; C-c bindings in `mode-specific-map'
|
||||
("C-x b" . consult-buffer)
|
||||
("C-c C-j" . consult-imenu)
|
||||
("s-s" . consult-line)
|
||||
("C-x C-r" . consult-recent-file)) ;; replaces recentf
|
||||
|
||||
;; Enable automatic preview at point in the *Completions* buffer. This is
|
||||
@@ -180,7 +213,6 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
(consult-widen-key ">")
|
||||
|
||||
:config
|
||||
|
||||
(when (fboundp 'persp-new)
|
||||
(consult-customize consult--source-buffer :hidden t :default nil)
|
||||
|
||||
@@ -192,7 +224,21 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
:default t
|
||||
:items #'persp-get-buffer-names))
|
||||
|
||||
(push consult--source-perspective consult-buffer-sources)))
|
||||
(push consult--source-perspective consult-buffer-sources))
|
||||
|
||||
|
||||
(defvar git-source
|
||||
(list :name "Git Repo"
|
||||
:category 'consult-location
|
||||
:narrow ?g
|
||||
:face 'consult-buffer
|
||||
:history 'buffer-name-history
|
||||
:state #'consult--buffer-state
|
||||
:sort t
|
||||
:action #'tvd-switch-to-repo
|
||||
:items #'tvd-list-git-repos))
|
||||
|
||||
(add-to-list 'consult-buffer-sources 'git-source 'append))
|
||||
|
||||
;; needs to be defined outside
|
||||
(defalias 'rg 'consult-ripgrep)
|
||||
@@ -210,12 +256,9 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
("C-x C-d" . consult-dir)))
|
||||
|
||||
|
||||
|
||||
(when nil
|
||||
(use-package
|
||||
embark-consult
|
||||
:after (embark consult)))
|
||||
|
||||
(use-package
|
||||
embark-consult
|
||||
:after (embark consult))
|
||||
|
||||
|
||||
;; Persist history over Emacs restarts. Vertico sorts by history position.
|
||||
@@ -236,7 +279,7 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
(corfu-cycle t)
|
||||
(corfu-preselect 'prompt)
|
||||
|
||||
:bind
|
||||
:bind
|
||||
(:map corfu-map
|
||||
("TAB" . corfu-next)
|
||||
([tab] . corfu-next)
|
||||
@@ -244,14 +287,13 @@ a remote file anytime and from everywhere I am by just entering :"
|
||||
([backtab] . corfu-previous)))
|
||||
|
||||
|
||||
;; much better experience to seach current buffer consult-line would
|
||||
;; much better experience to seach current buffer, consult-line would
|
||||
;; do the job as well and looks similar, but I'm used to swiper, so
|
||||
;; stick with it.
|
||||
(use-package swiper
|
||||
:config
|
||||
(setq ivy-wrap t)
|
||||
(global-set-key "\C-s" 'swiper))
|
||||
|
||||
:config
|
||||
(setq ivy-wrap t)
|
||||
(global-set-key "\C-s" 'swiper))
|
||||
|
||||
|
||||
(provide 'init-smarter-than-emacs)
|
||||
|
||||
@@ -146,7 +146,7 @@ _k_: kill (C-k) _s_: split _{_: wrap with { }
|
||||
|
||||
(define-key smartparens-mode-map (kbd "C-x (") 'hydra-smartparens/body))
|
||||
|
||||
:bind (:map smartparens-mode-map
|
||||
:bind (;:map smartparens-mode-map
|
||||
;; auto wrapping w/o region
|
||||
( "C-c (" . 'wrap-with-parens)
|
||||
( "C-c [" . 'wrap-with-brackets)
|
||||
|
||||
Reference in New Issue
Block a user