Compare commits

..

13 Commits

9 changed files with 227 additions and 75 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,13 +22,7 @@
(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)

View File

@@ -58,7 +58,7 @@
(setq lsp-ui-doc-enable nil ;; enable on the fly with "C-c D" (setq lsp-ui-doc-enable nil ;; enable on the fly with "C-c D"
lsp-ui-doc-use-webkit nil lsp-ui-doc-use-webkit nil
lsp-ui-doc-header t 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-position 'top
lsp-ui-doc-side 'right lsp-ui-doc-side 'right
lsp-ui-doc-include-signature t lsp-ui-doc-include-signature t
@@ -72,7 +72,7 @@
lsp-ui-peek-peek-height 40 lsp-ui-peek-peek-height 40
;; FIXME: maybe this is too much, check at work ;; 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-update-mode 'point
lsp-ui-sideline-show-code-actions nil lsp-ui-sideline-show-code-actions nil
lsp-ui-sideline-show-hover t lsp-ui-sideline-show-hover t

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

@@ -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,8 +130,6 @@ a remote file anytime and from everywhere I am by just entering :"
completion-ignore-case t)) completion-ignore-case t))
(when nil
(use-package embark (use-package embark
:ensure t :ensure t
@@ -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,7 +224,21 @@ 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 'rg 'consult-ripgrep) (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))) ("C-x C-d" . consult-dir)))
(when nil
(use-package (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.
@@ -244,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
@@ -253,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)