Compare commits

..

16 Commits

10 changed files with 341 additions and 90 deletions

5
.gitignore vendored
View File

@@ -24,3 +24,8 @@ emms
macros.el macros.el
forge-database.sqlite forge-database.sqlite
forge-database* forge-database*
.cache
cache
*history*
tree-sitter
warnings

View File

@@ -11,7 +11,20 @@
'("7f1d414afda803f3244c6fb4c2c64bea44dac040ed3731ec9d75275b9e831fe5" '("7f1d414afda803f3244c6fb4c2c64bea44dac040ed3731ec9d75275b9e831fe5"
default)) default))
'(magit-todos-insert-after '(bottom) nil nil "Changed by setter of obsolete option `magit-todos-insert-at'") '(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))) '(safe-local-variable-values '((ruby-indent-level 4)))
'(warning-suppress-types '((comp)))) '(warning-suppress-types '((comp))))
(custom-set-faces (custom-set-faces

View File

@@ -44,20 +44,35 @@
;; prefix. So just a hydra will do. ;; prefix. So just a hydra will do.
(when (fboundp 'defhydra) (when (fboundp 'defhydra)
(defhydra hydra-smerge (:color blue :timeout 30.0) (defhydra hydra-smerge (:timeout 30.0 :exit nil)
" "
^Smerge Mode^ ^Smerge Mode^
^^------------------------------------------------------- ^^--------------------------------------------------------------
_n_ext conflict keep _u_pper m_e_rge conflicts in Ediff _n_: next conflict _u_: keep upper _s_: swap
_p_revious conflict keep _l_ower _q_uit" _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) Reach this hydra with <C-x m>
("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))
"
("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)) (defalias 'merge 'hydra-smerge/body))

View File

@@ -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 (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 ;; From time to time I get annoyed by the many dozen buffers
;; opened. In such cases I like to close them all at once. ;; opened. In such cases I like to close them all at once.
@@ -364,6 +364,8 @@ Version 2015-04-09"
(clean-buffer-list) (clean-buffer-list)
(dolist (buffer (buffer-list)) (dolist (buffer (buffer-list))
(kill-buffer buffer)) (kill-buffer buffer))
(dolist (process (list-processes))
(kill-process process))
(delete-minibuffer-contents) (delete-minibuffer-contents)
(if (fboundp 'tramp-cleanup-all-connections) (if (fboundp 'tramp-cleanup-all-connections)
(tramp-cleanup-all-connections)) (tramp-cleanup-all-connections))

View File

@@ -7,7 +7,9 @@
:config :config
(setq gofmt-args '("-s")) (setq gofmt-args '("-s"))
(setq tab-width 4) (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 :init
;; disabled, I'm now trying lsp-mode, see below: ;; 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 'before-save-hook #'lsp-organize-imports t t))
(add-hook 'go-mode-hook #'lsp-deferred) (add-hook 'go-mode-hook #'lsp-deferred)
(add-hook 'go-mode-hook #'lsp-go-install-save-hooks) (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)
)
:bind (:map go-mode-map :bind (:map go-mode-map
( "C-c j" . #'lsp-find-definition) ("C-c j" . #'lsp-find-definition)
("C-c b" . #'xref-pop-marker-stack))) ("C-c b" . #'xref-pop-marker-stack)))
(use-package kage-mode (use-package kage-mode

View File

@@ -10,26 +10,110 @@
("pyls.plugins.pyls_isort.enabled" t t))) ("pyls.plugins.pyls_isort.enabled" t t)))
;; disable infantile nonsense ;; disable infantile nonsense
(setq lsp-headerline-breadcrumb-enable nil (setq lsp-headerline-breadcrumb-enable t
lsp-modeline-code-actions-enable nil) lsp-modeline-code-actions-enable nil)
;; (lsp-enable-which-key-integration t)
:bind :bind
; same prefix space as dumpjump (C-c) ("C-c n". #'lsp-rename)
("C-c r" . #'lsp-find-references) ; default: C-c C-l g r ;; I am using lsp-ui for this, see below
("C-c d" . #'lsp-find-definition) ; default: C-c C-l g g ;; ("C-c r" . #'lsp-find-references) ; default: C-c C-l g r
;; ("C-c d" . #'lsp-find-definition) ; default: C-c C-l g g
;; ;; same as above, but directly within prefix, not 'g neede
;; ("C-c C-l r" . #'lsp-find-references) ; default: C-c C-l g r
;; ("C-c C-l d" . #'lsp-find-definition) ; default: C-c C-l g g
:init :init
;; I'm not using any of th lsp commands, but better define a prefix ;; I'm not using any of th lsp commands, but better define a prefix
;; than being unable to reach it ;; than being unable to reach it
;; FIXME: add at least lsp-find-definition ;; FIXME: add at least lsp-find-definition
(setq lsp-keymap-prefix "C-c C-l") (setq lsp-keymap-prefix "C-c C-l"
lsp-log-io nil
lsp-enable-indentation t
lsp-enable-imenu t
lsp-file-watch-threshold 500
lsp-prefer-flymake nil)
:commands lsp) :commands lsp)
;; I use ivy ;; for lsp code lenses etc
;; (use-package lsp-ivy ;; https://emacs-lsp.github.io/lsp-ui/
;; :commands lsp-ivy-global-workspace-symbol) ;; FIXME: ⛔ Error (use-package): Failed to install lsp-ui: https://melpa.org/packages/lsp-ui-20250804.2109.tar: Not found
;; manually installed using package-install
(use-package lsp-ui
:ensure t
:after (lsp-mode)
:commands lsp-ui-doc-hide
:bind (:map lsp-ui-mode-map
("C-c d" . #'lsp-ui-peek-find-definitions)
("C-c r" . #'lsp-ui-peek-find-references)
([remap xref-find-definitions] . lsp-ui-peek-find-definitions)
([remap xref-find-references] . lsp-ui-peek-find-references)
;;; ("C-c u" . lsp-ui-imenu) ;; using treemacs for this
("C-c D" . tvd-lsp-doc-toggle))
:init
(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 1.0
lsp-ui-doc-position 'top
lsp-ui-doc-side 'right
lsp-ui-doc-include-signature t
lsp-ui-doc-alignment 'at-point
lsp-ui-doc-use-childframe t
lsp-ui-doc-border (face-foreground 'default)
;; C-c r
lsp-ui-peek-enable t
lsp-ui-peek-show-directory t
lsp-ui-peek-peek-height 40
;; FIXME: maybe this is too much, check at work
lsp-ui-sideline-enable nil
lsp-ui-sideline-update-mode 'point
lsp-ui-sideline-show-code-actions nil
lsp-ui-sideline-show-hover t
lsp-ui-sideline-delay 2
lsp-ui-sideline-show-diagnostics nil
lsp-ui-sideline-diagnostic-max-lines t
lsp-ui-sideline-ignore-duplicate t)
:config
(add-to-list 'lsp-ui-doc-frame-parameters '(right-fringe . 8))
(defun tvd-lsp-doc-toggle()
"Toggle lsp-ui-doc, takes effect only on buffer start.
So in order to change in a buffer, reload the buffer after
the toggle with shift-F5."
(interactive)
(setq lsp-ui-doc-enable (not lsp-ui-doc-enable))
(tvd-buffer-reload))
;; `C-g'to close doc
(advice-add #'keyboard-quit :before #'lsp-ui-doc-hide))
;; better recursive refs, symbols, etc
;; see also https://github.com/Alexander-Miller/treemacs
(use-package lsp-treemacs
:after lsp
:bind
("C-c u" . #'lsp-treemacs-symbols)
("C-c C-l c" . #'lsp-treemacs-call-hierarchy))
(use-package treemacs
:bind
("C-c t" . #'treemacs)
:init
(setq
treemacs-project-follow-mode t
treemacs-extra-wide-toggle t
treemacs-follow-mode t))
(provide 'init-lsp) (provide 'init-lsp)
;;; init-lsp.el ends here ;;; init-lsp.el ends here

View File

@@ -1,6 +1,29 @@
;; *** Magit ;; *** 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 ;; Not much to say about Magit
(use-package magit (use-package magit
@@ -15,6 +38,14 @@
;; the hassle to go to status before just committing etc. So: ;; the hassle to go to status before just committing etc. So:
(("C-c g" . magit-file-dispatch)) (("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 :config
(magit-todos-mode) (magit-todos-mode)
@@ -124,7 +155,17 @@
(magit-restore-window-configuration) (magit-restore-window-configuration)
(mapc #'kill-buffer buffers))) (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 (use-package blamer
@@ -156,10 +197,48 @@
(setq blamer-bindings '(("<mouse-1>" . blamer-callback-show-commit-diff)))) (setq blamer-bindings '(("<mouse-1>" . blamer-callback-show-commit-diff))))
(use-package forge (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 (use-package sqlite3
:defer nil) :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) (provide 'init-magit)
;;; init-magit.el ends here ;;; init-magit.el ends here

View File

@@ -37,7 +37,7 @@ via [[http://whattheemacsd.com/setup-ido.el-02.html][whattheemacs.d]]"
(insert "~/")) (insert "~/"))
(call-interactively 'self-insert-command))) (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" "quickly go to root dir with / in minibuffer find-file, if we are in a local fs"
(interactive) (interactive)
(if (file-directory-p (file-name-directory (minibuffer-contents-no-properties))) (if (file-directory-p (file-name-directory (minibuffer-contents-no-properties)))
@@ -104,8 +104,6 @@ a remote file anytime and from everywhere I am by just entering :"
("TAB" . #'minibuffer-complete))) ("TAB" . #'minibuffer-complete)))
(use-package orderless (use-package orderless
:init :init
;; I am using the actual orderless completion style as a last ;; I am using the actual orderless completion style as a last
@@ -132,9 +130,7 @@ a remote file anytime and from everywhere I am by just entering :"
completion-ignore-case t)) completion-ignore-case t))
(use-package embark
(when nil
(use-package embark
:ensure t :ensure t
:bind :bind
@@ -143,7 +139,6 @@ a remote file anytime and from everywhere I am by just entering :"
:init :init
;; Optionally replace the key help with a completing-read interface ;; Optionally replace the key help with a completing-read interface
(setq prefix-help-command #'embark-prefix-help-command) (setq prefix-help-command #'embark-prefix-help-command)
@@ -153,19 +148,57 @@ a remote file anytime and from everywhere I am by just entering :"
;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly) ;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
:config :config
;; Hide the mode line of the Embark live/completions buffers ;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil nil
(window-parameters (mode-line-format . none)))))) (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 (use-package consult
;; Replace bindings. Lazily loaded due by `use-package'. ;; Replace bindings. Lazily loaded due by `use-package'.
:bind (;; C-c bindings in `mode-specific-map' :bind (;; C-c bindings in `mode-specific-map'
("C-x b" . consult-buffer) ("C-x b" . consult-buffer)
("C-c C-j" . consult-imenu) ("C-c C-j" . consult-imenu)
("s-s" . consult-line)
("C-x C-r" . consult-recent-file)) ;; replaces recentf ("C-x C-r" . consult-recent-file)) ;; replaces recentf
;; Enable automatic preview at point in the *Completions* buffer. This is ;; 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 ">") (consult-widen-key ">")
:config :config
(when (fboundp 'persp-new) (when (fboundp 'persp-new)
(consult-customize consult--source-buffer :hidden t :default nil) (consult-customize consult--source-buffer :hidden t :default nil)
@@ -192,10 +224,25 @@ a remote file anytime and from everywhere I am by just entering :"
:default t :default t
:items #'persp-get-buffer-names)) :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 ;; needs to be defined outside
(defalias 'egrep 'consult-ripgrep) (defalias 'rg 'consult-ripgrep)
(defalias 'fd 'consult-fd)
;; change directory while opening a file etc ;; change directory while opening a file etc
(use-package consult-dir (use-package consult-dir
@@ -209,12 +256,9 @@ a remote file anytime and from everywhere I am by just entering :"
("C-x C-d" . consult-dir))) ("C-x C-d" . consult-dir)))
(use-package
(when nil
(use-package
embark-consult embark-consult
:after (embark consult))) :after (embark consult))
;; Persist history over Emacs restarts. Vertico sorts by history position. ;; Persist history over Emacs restarts. Vertico sorts by history position.
@@ -243,7 +287,7 @@ a remote file anytime and from everywhere I am by just entering :"
([backtab] . corfu-previous))) ([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 ;; do the job as well and looks similar, but I'm used to swiper, so
;; stick with it. ;; stick with it.
(use-package swiper (use-package swiper
@@ -252,6 +296,5 @@ a remote file anytime and from everywhere I am by just entering :"
(global-set-key "\C-s" 'swiper)) (global-set-key "\C-s" 'swiper))
(provide 'init-smarter-than-emacs) (provide 'init-smarter-than-emacs)
;;; init-smarter-than-emacs ends here ;;; init-smarter-than-emacs ends here

View File

@@ -146,7 +146,7 @@ _k_: kill (C-k) _s_: split _{_: wrap with { }
(define-key smartparens-mode-map (kbd "C-x (") 'hydra-smartparens/body)) (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 ;; auto wrapping w/o region
( "C-c (" . 'wrap-with-parens) ( "C-c (" . 'wrap-with-parens)
( "C-c [" . 'wrap-with-brackets) ( "C-c [" . 'wrap-with-brackets)

View File

@@ -79,8 +79,8 @@
;; F5 == reload file if it has been modified by another process, shift ;; F5 == reload file if it has been modified by another process, shift
;; because Xmonad ;; because Xmonad
(global-set-key (kbd "S-<f5>") ; re-read a buffer from disk (revert)
(lambda (&optional force-reverting) (defun tvd-buffer-reload(&optional force-reverting)
"Interactive call to revert-buffer. Ignoring the auto-save "Interactive call to revert-buffer. Ignoring the auto-save
file and not requesting for confirmation. When the current buffer file and not requesting for confirmation. When the current buffer
is modified, the command refuses to revert it, unless you specify is modified, the command refuses to revert it, unless you specify
@@ -89,7 +89,21 @@
;;(message "force-reverting value is %s" force-reverting) ;;(message "force-reverting value is %s" force-reverting)
(if (or force-reverting (not (buffer-modified-p))) (if (or force-reverting (not (buffer-modified-p)))
(revert-buffer :ignore-auto :noconfirm) (revert-buffer :ignore-auto :noconfirm)
(error "The buffer has been modified")))) (error "The buffer has been modified")))
;; re-read a buffer from disk (revert)
(global-set-key (kbd "S-<f5>") 'tvd-buffer-reload)
;; (lambda (&optional force-reverting)
;; "Interactive call to revert-buffer. Ignoring the auto-save
;; file and not requesting for confirmation. When the current buffer
;; is modified, the command refuses to revert it, unless you specify
;; the optional argument: force-reverting to true."
;; (interactive "P")
;; ;;(message "force-reverting value is %s" force-reverting)
;; (if (or force-reverting (not (buffer-modified-p)))
;; (revert-buffer :ignore-auto :noconfirm)
;; (error "The buffer has been modified"))))