Compare commits

..

10 Commits

8 changed files with 157 additions and 29 deletions

5
.gitignore vendored
View File

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

View File

@@ -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

View File

@@ -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))

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
;; --------------------------------------------------------------------------------
;; ** 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))

View File

@@ -55,10 +55,10 @@
("C-c D" . tvd-lsp-doc-toggle))
:init
(setq lsp-ui-doc-enable t ;; 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-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

View File

@@ -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
@@ -156,10 +197,48 @@
(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

View File

@@ -198,6 +198,7 @@ targets."
: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
@@ -212,7 +213,6 @@ targets."
(consult-widen-key ">")
:config
(when (fboundp 'persp-new)
(consult-customize consult--source-buffer :hidden t :default nil)
@@ -224,7 +224,21 @@ targets."
: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)
@@ -273,7 +287,7 @@ targets."
([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

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))
: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)