diff --git a/.gitignore b/.gitignore index 5e320c7..58c7630 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,8 @@ emms macros.el forge-database.sqlite forge-database* +.cache +cache +*history* +tree-sitter +warnings diff --git a/lisp/init-magit.el b/lisp/init-magit.el index 4bfe5e5..a3c4bd9 100644 --- a/lisp/init-magit.el +++ b/lisp/init-magit.el @@ -138,9 +138,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,10 +148,10 @@ ;; 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 '(("" . blamer-callback-show-commit-diff)))) @@ -161,5 +161,34 @@ (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 , 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)))) + (provide 'init-magit) ;;; init-magit.el ends here diff --git a/lisp/init-smarter-than-emacs.el b/lisp/init-smarter-than-emacs.el index a4d0112..8c60d64 100644 --- a/lisp/init-smarter-than-emacs.el +++ b/lisp/init-smarter-than-emacs.el @@ -212,7 +212,6 @@ targets." (consult-widen-key ">") :config - (when (fboundp 'persp-new) (consult-customize consult--source-buffer :hidden t :default nil) @@ -224,7 +223,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 +286,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 diff --git a/lisp/init-smartparens.el b/lisp/init-smartparens.el index c52cf4e..6d9235d 100644 --- a/lisp/init-smartparens.el +++ b/lisp/init-smartparens.el @@ -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)