mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 19:45:25 +03:00
emacs: add difftastic & atuin
This commit is contained in:
parent
0f398c4505
commit
53a22ec95f
3 changed files with 150 additions and 28 deletions
|
|
@ -18,4 +18,5 @@
|
||||||
"python-black"
|
"python-black"
|
||||||
"python-yapf"
|
"python-yapf"
|
||||||
"plantuml"
|
"plantuml"
|
||||||
|
"difftastic-bin"
|
||||||
"xkb-switch"))
|
"xkb-switch"))
|
||||||
|
|
|
||||||
|
|
@ -619,6 +619,41 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
|
||||||
:straight t
|
:straight t
|
||||||
:commands (git-timemachine))
|
:commands (git-timemachine))
|
||||||
|
|
||||||
|
(use-package difftastic
|
||||||
|
:straight t
|
||||||
|
:commands (difftastic-magit-diff
|
||||||
|
difftastic-magit-show
|
||||||
|
difftastic-files
|
||||||
|
difftastic-buffers)
|
||||||
|
:init
|
||||||
|
(with-eval-after-load 'magit-diff
|
||||||
|
(transient-append-suffix 'magit-diff '(-1 -1)
|
||||||
|
[("D" "Difftastic diff (dwim)" difftastic-magit-diff)
|
||||||
|
("S" "Difftastic show" difftastic-magit-show)])
|
||||||
|
(general-define-key
|
||||||
|
:keymaps 'magit-blame-read-only-mode-map
|
||||||
|
:states 'normal
|
||||||
|
"D" #'difftastic-magit-show
|
||||||
|
"S" #'difftastic-magit-show))
|
||||||
|
:config
|
||||||
|
(setq difftastic-executable (executable-find "difft"))
|
||||||
|
(general-define-key
|
||||||
|
:keymaps 'difftastic-mode-map
|
||||||
|
:states '(normal)
|
||||||
|
"gr" #'difftastic-rerun
|
||||||
|
"q" #'kill-buffer-and-window))
|
||||||
|
|
||||||
|
(defun my/difftastic-pop-at-bottom (buffer-or-name _requested-width)
|
||||||
|
(let ((window (split-window-below)))
|
||||||
|
(select-window window)
|
||||||
|
(evil-move-window 'below))
|
||||||
|
(set-window-buffer (selected-window) buffer-or-name))
|
||||||
|
|
||||||
|
(setq difftastic-display-buffer-function #'my/difftastic-pop-at-bottom)
|
||||||
|
|
||||||
|
(setq difftastic-requested-window-width-function
|
||||||
|
(lambda () (- (frame-width) 4)))
|
||||||
|
|
||||||
(use-package forge
|
(use-package forge
|
||||||
:after magit
|
:after magit
|
||||||
:straight t
|
:straight t
|
||||||
|
|
@ -828,7 +863,8 @@ Obeys `widen-automatically', which see."
|
||||||
dired-recent-open
|
dired-recent-open
|
||||||
org-ql-view
|
org-ql-view
|
||||||
my/index-nav
|
my/index-nav
|
||||||
org-set-effort))
|
org-set-effort
|
||||||
|
eshell-atuin-history))
|
||||||
;; Do not use prescient in find-file
|
;; Do not use prescient in find-file
|
||||||
(ivy--alist-set 'ivy-sort-functions-alist #'read-file-name-internal #'ivy-sort-file-function-default))
|
(ivy--alist-set 'ivy-sort-functions-alist #'read-file-name-internal #'ivy-sort-file-function-default))
|
||||||
|
|
||||||
|
|
@ -3209,7 +3245,8 @@ With ARG, repeats or can move backward if negative."
|
||||||
(plantuml . t)
|
(plantuml . t)
|
||||||
(octave . t)
|
(octave . t)
|
||||||
,@(unless my/is-termux '((jupyter . t)))
|
,@(unless my/is-termux '((jupyter . t)))
|
||||||
(sparql . t)))
|
(sparql . t)
|
||||||
|
(gnuplot . t)))
|
||||||
|
|
||||||
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images))
|
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images))
|
||||||
|
|
||||||
|
|
@ -4403,11 +4440,11 @@ KEYS is a list of cons cells like (<label> . <time>)."
|
||||||
(my-leader-def
|
(my-leader-def
|
||||||
:infix "or"
|
:infix "or"
|
||||||
"" '(:which-key "org-roam")
|
"" '(:which-key "org-roam")
|
||||||
"i" 'org-roam-node-insert
|
"i" #'org-roam-node-insert
|
||||||
"r" 'org-roam-node-find
|
"r" #'org-roam-node-find
|
||||||
"g" 'org-roam-graph
|
"g" #'org-roam-graph
|
||||||
"c" 'org-roam-capture
|
"c" #'org-roam-capture
|
||||||
"b" 'org-roam-buffer-toggle)
|
"b" #'org-roam-buffer-toggle)
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:keymaps 'org-roam-mode-map
|
:keymaps 'org-roam-mode-map
|
||||||
:states '(normal)
|
:states '(normal)
|
||||||
|
|
@ -4422,9 +4459,10 @@ KEYS is a list of cons cells like (<label> . <time>)."
|
||||||
(my-leader-def
|
(my-leader-def
|
||||||
:keymap 'org-mode-map
|
:keymap 'org-mode-map
|
||||||
:infix "or"
|
:infix "or"
|
||||||
"t" 'org-roam-tag-add
|
"t" #'org-roam-tag-add
|
||||||
"T" 'org-roam-tag-remove
|
"T" #'org-roam-tag-remove
|
||||||
"s" 'org-roam-db-autosync-mode)
|
"s" #'org-roam-db-autosync-mode
|
||||||
|
"a" #'org-roam-alias-add)
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:keymap 'org-mode-map
|
:keymap 'org-mode-map
|
||||||
"C-c i" 'org-roam-node-insert))
|
"C-c i" 'org-roam-node-insert))
|
||||||
|
|
@ -5485,8 +5523,7 @@ KEYS is a list of cons cells like (<label> . <time>)."
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:states '(normal insert)
|
:states '(normal insert)
|
||||||
:keymaps 'eshell-mode-map
|
:keymaps 'eshell-mode-map
|
||||||
"<home>" #'eshell-bol
|
"<home>" #'eshell-bol)
|
||||||
"C-r" #'counsel-esh-history)
|
|
||||||
|
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:keymaps 'eshell-mode-map
|
:keymaps 'eshell-mode-map
|
||||||
|
|
@ -5704,6 +5741,18 @@ KEYS is a list of cons cells like (<label> . <time>)."
|
||||||
(company-complete))
|
(company-complete))
|
||||||
(company-complete)))
|
(company-complete)))
|
||||||
|
|
||||||
|
(use-package eshell-atuin
|
||||||
|
:straight (:host github :repo "SqrtMinusOne/eshell-atuin")
|
||||||
|
:after eshell
|
||||||
|
:config
|
||||||
|
(eshell-atuin-mode)
|
||||||
|
(setq eshell-atuin-search-fields '(time duration command))
|
||||||
|
(setq eshell-atuin-history-format "%-160c %t + %d")
|
||||||
|
(general-define-key
|
||||||
|
:states '(normal insert)
|
||||||
|
:keymaps 'eshell-mode-map
|
||||||
|
"C-r" #'eshell-atuin-history))
|
||||||
|
|
||||||
(add-to-list 'display-buffer-alist
|
(add-to-list 'display-buffer-alist
|
||||||
'("eshell-dedicated.*"
|
'("eshell-dedicated.*"
|
||||||
(display-buffer-reuse-window
|
(display-buffer-reuse-window
|
||||||
|
|
@ -6316,7 +6365,7 @@ the directory with resulting files."
|
||||||
(buffer (generate-new-buffer "whisper"))
|
(buffer (generate-new-buffer "whisper"))
|
||||||
(proc (start-process
|
(proc (start-process
|
||||||
"whisper" buffer
|
"whisper" buffer
|
||||||
"whisper-cpp" "--model" "/home/pavel/.whisper/ggml-tiny.en.bin"
|
"whisper-cpp" "--model" "/home/pavel/.whisper/ggml-medium.en.bin"
|
||||||
"-otxt" "-ovtt" "-osrt" input)))
|
"-otxt" "-ovtt" "-osrt" input)))
|
||||||
(set-process-sentinel
|
(set-process-sentinel
|
||||||
proc
|
proc
|
||||||
|
|
|
||||||
102
Emacs.org
102
Emacs.org
|
|
@ -1050,7 +1050,11 @@ I used to have [[https://github.com/Alexander-Miller/treemacs][Treemacs]] here,
|
||||||
(general-nmap "C-p" 'counsel-projectile-find-file)
|
(general-nmap "C-p" 'counsel-projectile-find-file)
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Git & Magit
|
*** Git & Magit
|
||||||
[[https://magit.vc/][Magit]] is a git interface for Emacs. The closest non-Emacs alternative (sans actual clones) I know is [[https://github.com/jesseduffield/lazygit][lazygit]], which I used before Emacs.
|
[[https://magit.vc/][Magit]] is a git interface for Emacs.
|
||||||
|
|
||||||
|
A few CLI alternatives:
|
||||||
|
- [[https://github.com/jesseduffield/lazygit][lazygit]]. I used it before Emacs
|
||||||
|
- [[https://github.com/altsem/gitu][gitu]]. A CLI magit clone
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package magit
|
(use-package magit
|
||||||
|
|
@ -1072,7 +1076,7 @@ I used to have [[https://github.com/Alexander-Miller/treemacs][Treemacs]] here,
|
||||||
(show-message . t)))))
|
(show-message . t)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
[[https://github.com/emacsorphanage/git-gutter][git-gutter]] is a package which shows git changes for each line (added/changed/deleted lines).
|
[[https://github.com/emacsorphanage/git-gutter][git-gutter]] is shows git changes for each line (added/changed/deleted lines).
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package git-gutter
|
(use-package git-gutter
|
||||||
:straight t
|
:straight t
|
||||||
|
|
@ -1087,6 +1091,56 @@ I used to have [[https://github.com/Alexander-Miller/treemacs][Treemacs]] here,
|
||||||
:straight t
|
:straight t
|
||||||
:commands (git-timemachine))
|
:commands (git-timemachine))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
| Guix dependency |
|
||||||
|
|-----------------|
|
||||||
|
| difftastic-bin |
|
||||||
|
|
||||||
|
[[https://github.com/pkryger/difftastic.el][difftastic.el]] is a wrapper package for [[https://difftastic.wilfred.me.uk/][difftastic]].
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package difftastic
|
||||||
|
:straight t
|
||||||
|
:commands (difftastic-magit-diff
|
||||||
|
difftastic-magit-show
|
||||||
|
difftastic-files
|
||||||
|
difftastic-buffers)
|
||||||
|
:init
|
||||||
|
(with-eval-after-load 'magit-diff
|
||||||
|
(transient-append-suffix 'magit-diff '(-1 -1)
|
||||||
|
[("D" "Difftastic diff (dwim)" difftastic-magit-diff)
|
||||||
|
("S" "Difftastic show" difftastic-magit-show)])
|
||||||
|
(general-define-key
|
||||||
|
:keymaps 'magit-blame-read-only-mode-map
|
||||||
|
:states 'normal
|
||||||
|
"D" #'difftastic-magit-show
|
||||||
|
"S" #'difftastic-magit-show))
|
||||||
|
:config
|
||||||
|
(setq difftastic-executable (executable-find "difft"))
|
||||||
|
(general-define-key
|
||||||
|
:keymaps 'difftastic-mode-map
|
||||||
|
:states '(normal)
|
||||||
|
"gr" #'difftastic-rerun
|
||||||
|
"q" #'kill-buffer-and-window))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
My screen isn't wide enough to run =difftastic= in vertical split, so...
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(defun my/difftastic-pop-at-bottom (buffer-or-name _requested-width)
|
||||||
|
(let ((window (split-window-below)))
|
||||||
|
(select-window window)
|
||||||
|
(evil-move-window 'below))
|
||||||
|
(set-window-buffer (selected-window) buffer-or-name))
|
||||||
|
|
||||||
|
(setq difftastic-display-buffer-function #'my/difftastic-pop-at-bottom)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
And I suspect the built-in window width function doesn't work as intended because of =global-display-line-numbers-mode=.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(setq difftastic-requested-window-width-function
|
||||||
|
(lambda () (- (frame-width) 4)))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
*** Forge and code-review
|
*** Forge and code-review
|
||||||
[[https://github.com/magit/forge][forge]] provides integration with forges, such as GitHub and GitLab.
|
[[https://github.com/magit/forge][forge]] provides integration with forges, such as GitHub and GitLab.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
@ -1393,7 +1447,8 @@ References:
|
||||||
dired-recent-open
|
dired-recent-open
|
||||||
org-ql-view
|
org-ql-view
|
||||||
my/index-nav
|
my/index-nav
|
||||||
org-set-effort))
|
org-set-effort
|
||||||
|
eshell-atuin-history))
|
||||||
;; Do not use prescient in find-file
|
;; Do not use prescient in find-file
|
||||||
(ivy--alist-set 'ivy-sort-functions-alist #'read-file-name-internal #'ivy-sort-file-function-default))
|
(ivy--alist-set 'ivy-sort-functions-alist #'read-file-name-internal #'ivy-sort-file-function-default))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -4454,7 +4509,8 @@ Enable languages
|
||||||
(plantuml . t)
|
(plantuml . t)
|
||||||
(octave . t)
|
(octave . t)
|
||||||
,@(unless my/is-termux '((jupyter . t)))
|
,@(unless my/is-termux '((jupyter . t)))
|
||||||
(sparql . t)))
|
(sparql . t)
|
||||||
|
(gnuplot . t)))
|
||||||
|
|
||||||
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images))
|
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -6053,11 +6109,11 @@ A set of keybindings to quickly access things in Org Roam.
|
||||||
(my-leader-def
|
(my-leader-def
|
||||||
:infix "or"
|
:infix "or"
|
||||||
"" '(:which-key "org-roam")
|
"" '(:which-key "org-roam")
|
||||||
"i" 'org-roam-node-insert
|
"i" #'org-roam-node-insert
|
||||||
"r" 'org-roam-node-find
|
"r" #'org-roam-node-find
|
||||||
"g" 'org-roam-graph
|
"g" #'org-roam-graph
|
||||||
"c" 'org-roam-capture
|
"c" #'org-roam-capture
|
||||||
"b" 'org-roam-buffer-toggle)
|
"b" #'org-roam-buffer-toggle)
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:keymaps 'org-roam-mode-map
|
:keymaps 'org-roam-mode-map
|
||||||
:states '(normal)
|
:states '(normal)
|
||||||
|
|
@ -6072,9 +6128,10 @@ A set of keybindings to quickly access things in Org Roam.
|
||||||
(my-leader-def
|
(my-leader-def
|
||||||
:keymap 'org-mode-map
|
:keymap 'org-mode-map
|
||||||
:infix "or"
|
:infix "or"
|
||||||
"t" 'org-roam-tag-add
|
"t" #'org-roam-tag-add
|
||||||
"T" 'org-roam-tag-remove
|
"T" #'org-roam-tag-remove
|
||||||
"s" 'org-roam-db-autosync-mode)
|
"s" #'org-roam-db-autosync-mode
|
||||||
|
"a" #'org-roam-alias-add)
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:keymap 'org-mode-map
|
:keymap 'org-mode-map
|
||||||
"C-c i" 'org-roam-node-insert))
|
"C-c i" 'org-roam-node-insert))
|
||||||
|
|
@ -7638,8 +7695,7 @@ Some initial configuration.
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:states '(normal insert)
|
:states '(normal insert)
|
||||||
:keymaps 'eshell-mode-map
|
:keymaps 'eshell-mode-map
|
||||||
"<home>" #'eshell-bol
|
"<home>" #'eshell-bol)
|
||||||
"C-r" #'counsel-esh-history)
|
|
||||||
|
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:keymaps 'eshell-mode-map
|
:keymaps 'eshell-mode-map
|
||||||
|
|
@ -7941,6 +7997,22 @@ Finally, a function that inserts the overlay in buffer if it's available and cal
|
||||||
(company-complete))
|
(company-complete))
|
||||||
(company-complete)))
|
(company-complete)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
**** Atuin integration
|
||||||
|
[[https://github.com/SqrtMinusOne/eshell-atuin][eshell-atuin]] is my package that integrates eshell with [[https://github.com/atuinsh/atuin][atuin]].
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(use-package eshell-atuin
|
||||||
|
:straight (:host github :repo "SqrtMinusOne/eshell-atuin")
|
||||||
|
:after eshell
|
||||||
|
:config
|
||||||
|
(eshell-atuin-mode)
|
||||||
|
(setq eshell-atuin-search-fields '(time duration command))
|
||||||
|
(setq eshell-atuin-history-format "%-160c %t + %d")
|
||||||
|
(general-define-key
|
||||||
|
:states '(normal insert)
|
||||||
|
:keymaps 'eshell-mode-map
|
||||||
|
"C-r" #'eshell-atuin-history))
|
||||||
|
#+end_src
|
||||||
**** Dedicated buffer
|
**** Dedicated buffer
|
||||||
Make a dedicated buffer for eshell in the bottom of the screen.
|
Make a dedicated buffer for eshell in the bottom of the screen.
|
||||||
|
|
||||||
|
|
@ -8784,7 +8856,7 @@ the directory with resulting files."
|
||||||
(buffer (generate-new-buffer "whisper"))
|
(buffer (generate-new-buffer "whisper"))
|
||||||
(proc (start-process
|
(proc (start-process
|
||||||
"whisper" buffer
|
"whisper" buffer
|
||||||
"whisper-cpp" "--model" "/home/pavel/.whisper/ggml-tiny.en.bin"
|
"whisper-cpp" "--model" "/home/pavel/.whisper/ggml-medium.en.bin"
|
||||||
"-otxt" "-ovtt" "-osrt" input)))
|
"-otxt" "-ovtt" "-osrt" input)))
|
||||||
(set-process-sentinel
|
(set-process-sentinel
|
||||||
proc
|
proc
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue