Commit 5809efc348ec
Changed files (50)
tools
emacs
config
old-config
tools/emacs/config/config-appearance.el
@@ -2,7 +2,6 @@
;;; Commentary:
;;; Appearance configuration
;;; Code:
-(declare-function projectile-project-name "projectile")
(use-package emacs
:defer 3
@@ -51,10 +50,6 @@
;; and for all modes derived from text-mode
(add-hook 'text-mode-hook #'hl-line-mode))
-(use-package hl-todo
- :commands (hl-todo-mode)
- :hook ((prog-mode . hl-todo-mode)))
-
(use-package frame
:unless noninteractive
:commands vde/cursor-type-mode
@@ -82,7 +77,6 @@
cursor-in-non-selected-windows))
(kill-local-variable `,local))
(blink-cursor-mode -1))))
-
(use-package emacs
:config
(setq-default custom-safe-themes t)
@@ -101,7 +95,6 @@ Ignores `ARGS'."
(setq window-divider-default-bottom-width 1)
(setq window-divider-default-places 'right-only)
:hook (after-init . window-divider-mode))
-
(use-package tab-bar
:unless noninteractive
:config
tools/emacs/config/config-buffers.el
@@ -3,140 +3,6 @@
;;; Buffer related configurations
;;; Code:
-(use-package popper
- :commands (popper-mode)
- :bind ((("C-`" . popper-toggle-latest)
- ("M-`" . popper-cycle)
- ("C-M-`" . popper-toggle-type)))
- :init
- (setq popper-reference-buffers
- '("\\*Messages\\*"
- "Output\\*$" "\\*Pp Eval Output\\*$"
- "\\*Compile-Log\\*"
- ;; "\\*Completions\\*"
- "\\*Warnings\\*"
- "\\*Async Shell Command\\*"
- "\\*Apropos\\*"
- "\\*Backtrace\\*"
- "\\*Calendar\\*"
- "\\*Embark Actions\\*"
- "\\*Finder\\*"
- "\\*Kill Ring\\*"
-
- bookmark-bmenu-mode
- comint-mode
- compilation-mode
- help-mode helpful-mode
- tabulated-list-mode
- Buffer-menu-mode
-
- gnus-article-mode devdocs-mode
- grep-mode occur-mode rg-mode deadgrep-mode ag-mode pt-mode
- ivy-occur-mode ivy-occur-grep-mode
- process-menu-mode list-environment-mode cargo-process-mode
- youdao-dictionary-mode osx-dictionary-mode fanyi-mode
-
- "^\\*eshell.*\\*.*$" eshell-mode
- "^\\*shell.*\\*.*$" shell-mode
- "^\\*terminal.*\\*.*$" term-mode
- "^\\*vterm.*\\*.*$" vterm-mode
-
- "\\*DAP Templates\\*$" dap-server-log-mode
- "\\*ELP Profiling Restuls\\*" profiler-report-mode
- "\\*Flycheck errors\\*$" " \\*Flycheck checker\\*$"
- "\\*Paradox Report\\*$" "\\*package update results\\*$" "\\*Package-Lint\\*$"
- "\\*[Wo]*Man.*\\*$"
- "\\*ert\\*$" overseer-buffer-mode
- "\\*gud-debug\\*$"
- "\\*lsp-help\\*$" "\\*lsp session\\*$"
- "\\*quickrun\\*$"
- "\\*tldr\\*$"
- "\\*vc-.*\\*$"
- "^\\*elfeed-entry\\*$"
- "^\\*macro expansion\\**"
-
- "\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*"
- "\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode
- "\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*"
- "\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode
- "\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
- rustic-cargo-outdated-mode rustic-cargo-test-moed))
- (setq popper-group-function #'popper-group-by-project)
- :config
- (popper-echo-mode 1))
-
-(use-package emacs
- :unless noninteractive
- :config
- ;; Configure `display-buffer' behaviour for some special buffers
- (setq-default display-buffer-alist
- '(;; bottom side window
- ;; ("\\*e?shell.*"
- ;; (display-buffer-in-side-window)
- ;; (window-height . 0.25)
- ;; (side . bottom)
- ;; (slot . -1))
- ;; ("\\*v?term.*"
- ;; (display-buffer-in-side-window)
- ;; (window-height . 0.25)
- ;; (side . bottom)
- ;; (slot . -1))
- (".*\\*\\(Completions\\).*"
- (display-buffer-in-side-window)
- (window-height . 0.16)
- (side . bottom)
- (slot . 0)
- (window-parameters . ((no-other-window . t))))
- ("\\*\\(Backtrace\\|Warnings\\|Compile-Log\\|[Hh]elp\\|Messages\\)\\*"
- (display-buffer-in-side-window)
- (window-height . 0.25)
- (side . bottom)
- (slot . 0))
- ("\\*\\(helpful\\).*"
- (display-buffer-in-side-window)
- (window-height . 0.25)
- (side . bottom)
- (slot . 0))
- ("\\*.*\\(compilation\\|go test\\).*"
- (display-buffer-in-side-window)
- (window-height . 0.25)
- (side . bottom)
- (slot . 0))
- ("\\*\\(ielm\\).*"
- (display-buffer-in-side-window)
- (window-height . 0.25)
- (side . bottom)
- (slot . 1))
- ;; right side window
- ("\\*wclock*"
- (display-buffer-in-side-window)
- (window-width . 0.20)
- (side . right)
- (slot . -1))
- ("\\*undo-tree*"
- (display-buffer-in-side-window)
- (window-width . 0.20)
- (side . right)
- (slot . -1))
- ("\\*\\(Flycheck\\|Package-Lint\\).*"
- (display-buffer-in-side-window)
- (window-width . 0.40)
- (side . right)
- (slot . 0)
- (window-parameters . ((no-other-window . t)
- (mode-line-format . (" "
- mode-line-buffer-identification)))))
- ;; ("\\*Custom.*"
- ;; (display-buffer-in-side-window)
- ;; (window-width . 0.20)
- ;; (side . right)
- ;; (slot . 2))
- ("\\*Embark Occur.*"
- (display-buffer-at-bottom))))
- (setq window-sides-vertical nil)
- (setq window-combination-resize t) ; Size new windows proportionally
- :bind (("C-x +" . balance-windows-area)
- ("<C-f7>" . window-toggle-side-windows)))
(use-package savehist
:unless noninteractive
@@ -209,5 +75,6 @@
(unless (eq ibuffer-sorting-mode 'filename/process)
(ibuffer-do-sort-by-filename/process)))))
+
(provide 'config-buffers)
;;; config-buffers.el ends here
tools/emacs/config/config-compile.el
@@ -3,6 +3,39 @@
;;; Generic compilation configuration
;;; Code:
+(defun my-recompile (args)
+ (interactive "P")
+ (cond
+ ((eq major-mode #'emacs-lisp-mode)
+ (call-interactively 'eros-eval-defun))
+ ((bound-and-true-p my-vterm-command)
+ (my-vterm-execute-region-or-current-line my-vterm-command))
+ ((get-buffer "*compilation*")
+ (with-current-buffer"*compilation*"
+ (recompile)))
+ ((get-buffer "*Go Test*")
+ (with-current-buffer "*Go Test*"
+ (recompile)))
+ ((and (eq major-mode #'go-mode)
+ buffer-file-name
+ (string-match
+ "_test\\'" (file-name-sans-extension buffer-file-name)))
+ (my-gotest-maybe-ts-run))
+ ((and (get-buffer "*cargo-test*")
+ (boundp 'my-rustic-current-test-compile)
+ my-rustic-current-test-compile)
+ (with-current-buffer "*cargo-test*"
+ (rustic-cargo-test-run my-rustic-current-test-compile)))
+ ((get-buffer "*cargo-run*")
+ (with-current-buffer "*cargo-run*"
+ (rustic-cargo-run-rerun)))
+ ((get-buffer "*pytest*")
+ (with-current-buffer "*pytest*"
+ (recompile)))
+ ((eq major-mode #'python-mode)
+ (compile (concat python-shell-interpreter " " (buffer-file-name))))
+ ((call-interactively 'compile))))
+
;; UseCompile
(use-package compile
:unless noninteractive
@@ -66,5 +99,11 @@
(add-hook 'compilation-filter-hook #'vde/colorize-compilation-buffer)
(add-hook 'compilation-mode-hook #'vde/goto-address-mode))
+(use-package emacs
+ :bind
+ (:map prog-mode-map
+ ("C-M-<return>" . compile)
+ ("C-<return>" . my-recompile)))
+
(provide 'config-compile)
;;; config-compile.el ends here
tools/emacs/config/config-completion.el
@@ -3,319 +3,5 @@
;;; Setup completion framework
;;; Code
-(use-package orderless
- :unless noninteractive
- :config
- (setq orderless-regexp-separator " +")
- (setq orderless-matching-styles
- '(orderless-prefixes
- orderless-literal
- orderless-regexp
- orderless-flex))
-
- (defun vde/orderless-literal-dispatcher (pattern _index _total)
- "Literal style dispatcher using the equals sign as a suffix.
-It matches PATTERN _INDEX and _TOTAL according to how Orderless
-parses its input."
- (when (string-suffix-p "=" pattern)
- `(orderless-literal . ,(substring pattern 0 -1))))
-
- (setq orderless-style-dispatchers '(vde/orderless-literal-dispatcher))
- :bind (:map minibuffer-local-completion-map
- ("SPC" . nil))) ; space should never complete
-
-(use-package marginalia
- :config
- (setq marginalia-max-relative-age 0) ; time is absolute here!
- (setq marginalia-annotators '(marginalia-annotators-heavy
- marginalia-annotators-light))
- (marginalia-mode 1))
-
-(use-package minibuffer
- :unless noninteractive
- :config
- (setq completion-cycle-threshold 3)
- (setq completion-flex-nospace nil)
- (setq completion-pcm-complete-word-inserts-delimiters t)
- (setq completion-pcm-word-delimiters "-_./:| ")
- (setq completion-ignore-case t)
- (setq-default case-fold-search nil) ; For general regexp
- ;; NOTE: flex completion is introduced in Emacs 27
- (setq completion-show-help nil)
- (setq completion-styles
- '(substring initials flex partial-completion orderless))
- (setq completion-category-overrides
- '((file (styles partial-completion))))
- ;; The following two are updated in Emacs 28. They concern the
- ;; *Completions* buffer.
- (setq completions-format 'one-column)
- (setq completions-detailed t)
-
- ;; Grouping of completions for Emacs 28
- (setq completions-group t)
- (setq completions-group-sort nil)
- (setq completions-group-format
- (concat
- (propertize " " 'face 'completions-group-separator)
- (propertize " %s " 'face 'completions-group-title)
- (propertize " " 'face 'completions-group-separator
- 'display '(space :align-to right))))
-
- (setq enable-recursive-minibuffers t)
- (setq read-answer-short t)
- (setq read-buffer-completion-ignore-case t)
- (setq read-file-name-completion-ignore-case t)
- (setq resize-mini-windows t)
- (setq minibuffer-eldef-shorten-default t)
-
- (file-name-shadow-mode 1)
- (minibuffer-depth-indicate-mode 1)
- (minibuffer-electric-default-mode 1)
-
- (defun vde/focus-minibuffer ()
- "Focus the active minibuffer.
-
-Bind this to `completion-list-mode-map' to M-v to easily jump
-between the list of candidates present in the \\*Completions\\*
-buffer and the minibuffer (because by default M-v switches to the
-completions if invoked from inside the minibuffer."
- (interactive)
- (let ((mini (active-minibuffer-window)))
- (when mini
- (select-window mini))))
-
- (defun vde/focus-minibuffer-or-completions ()
- "Focus the active minibuffer or the \\*Completions\\*.
-
-If both the minibuffer and the Completions are present, this
-command will first move per invocation to the former, then the
-latter, and then continue to switch between the two.
-
-The continuous switch is essentially the same as running
-`vde/focus-minibuffer' and `switch-to-completions' in
-succession."
- (interactive)
- (let* ((mini (active-minibuffer-window))
- (completions (get-buffer-window "*Completions*")))
- (cond ((and mini
- (not (minibufferp)))
- (select-window mini nil))
- ((and completions
- (not (eq (selected-window)
- completions)))
- (select-window completions nil)))))
-
- ;; Technically, this is not specific to the minibuffer, but I define
- ;; it here so that you can see how it is also used from inside the
- ;; "Completions" buffer
- (defun vde/describe-symbol-at-point (&optional arg)
- "Get help (documentation) for the symbol at point.
-
-With a prefix argument, switch to the *Help* window. If that is
-already focused, switch to the most recently used window
-instead."
- (interactive "P")
- (let ((symbol (symbol-at-point)))
- (when symbol
- (describe-symbol symbol)))
- (when current-prefix-arg
- (let ((help (get-buffer-window "*Help*")))
- (when help
- (if (not (eq (selected-window) help))
- (select-window help)
- (select-window (get-mru-window)))))))
-
- ;; Defines, among others, aliases for common actions to Super-KEY.
- ;; Normally these should go in individual package declarations, but
- ;; their grouping here makes things easier to understand.
- :bind (("M-v" . vde/focus-minibuffer-or-completions)
- :map completion-list-mode-map
- ("h" . vde/describe-symbol-at-point)
- ("n" . next-line)
- ("p" . previous-line)
- ("f" . next-completion)
- ("b" . previous-completion)
- ("M-v" . vde/focus-minibuffer)))
-
-(use-package vertico
- :unless noninteractive
- :config
- (setq vertico-scroll-margin 0)
- (setq vertico-count 10)
- (setq vertico-resize nil)
- (setq vertico-cycle t)
- (vertico-mode))
-
-(use-package embark
- :unless noninteractive
- :bind (("C-." . embark-act))
- :init
- (setq prefix-help-command #'embark-prefix-help-command)
- (setq embark-cycle-key "C-."))
-
-(use-package embark-consult
- :after (embark consult))
-
-(use-package consult
- :unless noninteractive
- :after minibuffer
- :init
- ;; Use Consult to select xref locations with preview
- (setq xref-show-xrefs-function #'consult-xref
- xref-show-definitions-function #'consult-xref)
- (setq consult-narrow-key "<") ;; (kbd "C-+")
- :config
- (consult-customize
- consult-ripgrep consult-git-grep consult-grep consult-bookmark consult-xref
- consult--source-recent-file consult--source-project-recent-file consult--source-bookmark
- :preview-key (kbd "M-."))
- (setq consult-async-input-debounce 0.5)
- (setq consult-async-input-throttle 0.8)
- (setq consult-project-root-function
- (lambda ()
- (when-let (project (project-current))
- (car (project-roots project)))))
-
- :bind (("M-X" . consult-mode-command)
- ("C-c b" . consult-bookmark)
- ("C-c k" . consult-kmacro)
- ;; C-x bindings (ctl-x-map)
- ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
- ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
- ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
- ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
- ;; Other custom bindings
- ("M-y" . consult-yank-pop) ;; orig. yank-pop
- ("<help> a" . consult-apropos) ;; orig. apropos-command
- ;; M-g bindings (goto-map)
- ("M-g e" . consult-compile-error)
- ("M-g g" . consult-goto-line) ;; orig. goto-line
- ("M-g M-g" . consult-goto-line) ;; orig. goto-line
- ("M-g m" . consult-mark)
- ("M-g o" . consult-outline)
- ("M-g i" . consult-imenu)
- ("M-g I" . consult-imenu-multi)
- ;; "live" search
- ("M-s s g" . consult-grep)
- ("M-s s G" . consult-gip-grep)
- ("M-s s r" . consult-ripgrep)
- ("M-s l" . consult-line)
- ("M-s k" . consult-keep-lines)
- ("M-s u" . consult-focus-lines)
- ;; Isearch integration
- ("M-s e" . consult-isearch)
- :map minibuffer-local-completion-map
- ("<tab>" . minibuffer-force-complete)
- :map isearch-mode-map
- ("M-e" . consult-isearch) ;; orig. isearch-edit-string
- ("M-s e" . consult-isearch) ;; orig. isearch-edit-string
- ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
- ("M-s L" . consult-line-multi)))
-
-(use-package consult-dir
- :bind (("C-x C-d" . consult-dir)
- :map minibuffer-local-completion-map
- ("C-x C-d" . consult-dir)
- ("C-x C-j" . consult-dir-jump-file)))
-
-(use-package corfu
- :ensure
- ;; Optional customizations
- ;; :custom
- ;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
- ;; (corfu-auto t) ;; Enable auto completion
- ;; (corfu-commit-predicate nil) ;; Do not commit selected candidates on next input
- ;; (corfu-quit-at-boundary t) ;; Automatically quit at word boundary
- ;; (corfu-quit-no-match t) ;; Automatically quit if there is no match
- ;; (corfu-preview-current nil) ;; Disable current candidate preview
- ;; (corfu-preselect-first nil) ;; Disable candidate preselection
- ;; (corfu-echo-documentation nil) ;; Disable documentation in the echo area
- ;; (corfu-scroll-margin 5) ;; Use scroll margin
-
- ;; You may want to enable Corfu only for certain modes.
- ;; :hook ((prog-mode . corfu-mode)
- ;; (shell-mode . corfu-mode)
- ;; (eshell-mode . corfu-mode))
-
- ;; Recommended: Enable Corfu globally. This is recommended since dabbrev can
- ;; be used globally (M-/).
- :hook (((prog-mode tex-mode) . corfu-mode) ; text-mode
- ((shell-mode eshell-mode) . my/corfu-shell-settings))
- :bind (:map corfu-map
- ("TAB" . corfu-next)
- ([tab] . corfu-next)
- ("S-TAB" . corfu-previous)
- ([backtab] . corfu-previous)
- ("M-." . corfu-show-location)
- ("C-n" . nil)
- ("C-p" . nil)
- ("M-h" . nil)
- ("C-h" . corfu-show-documentation))
- :config
- (setq corfu-auto nil
- corfu-cycle t
- corfu-quit-no-match t
- corfu-preselect-first nil
- corfu-quit-at-boundary nil
- corfu-scroll-margin 5)
- (defun my/corfu-shell-settings ()
- (setq-local corfu-quit-at-boundary t
- corfu-quit-no-match t
- corfu-auto nil)
- (setq-local corfu-map (copy-keymap corfu-map)
- completion-cycle-threshold nil)
- (define-key corfu-map "\r" #'corfu-insert-and-send)
- (corfu-mode))
- (defun corfu-insert-and-send ()
- (interactive)
- ;; 1. First insert the completed candidate
- (corfu-insert)
- ;; 2. Send the entire prompt input to the shell
- (cond
- ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
- (eshell-send-input))
- ((derived-mode-p 'comint-mode)
- (comint-send-input)))))
-
-(use-package kind-icon
- :ensure t
- :after corfu
- :custom
- (kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly
- :config
- (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
-
-;; Add extensions
-(use-package cape
- :ensure
- :bind (("C-c p i" . cape-ispell)
- ("C-c p f" . cape-file)
- ("C-c p /" . cape-dabbrev)
- ("C-c p w" . cape-dict)
- ("C-c p k" . cape-keyword)
- ("C-c p s" . cape-symbol))
- :init
- ;; Add `completion-at-point-functions', used by `completion-at-point'.
- (add-to-list 'completion-at-point-functions #'cape-file)
- (add-to-list 'completion-at-point-functions #'cape-tex)
- (add-to-list 'completion-at-point-functions #'cape-dabbrev)
- (add-to-list 'completion-at-point-functions #'cape-keyword)
- (add-to-list 'completion-at-point-functions #'cape-symbol)
- :config
- (setq cape-dict-file "/usr/share/dict/words")
-
- (use-package pcomplete
- :defer
- :config
- ;; Silence the pcomplete capf, no errors or messages!
- (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
- ;; (advice-remove 'pcomplete-completions-at-point #'cape-wrap-silent)
-
- ;; Ensure that pcomplete does not write to the buffer
- ;; and behaves as a pure `completion-at-point-function'.
- (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
- ;; (advice-remove 'pcomplete-completions-at-point #'cape-wrap-purify)
- ))
-
(provide 'config-completion)
;;; config-completion.el ends here
tools/emacs/config/config-dired.el
@@ -3,7 +3,6 @@
;;; Configuration of Dired
;;; Code:
-;; UseDired
(use-package dired
:unless noninteractive
:commands (dired find-name-dired)
tools/emacs/config/config-editing.el
@@ -30,63 +30,6 @@
:config
(save-place-mode 1))
-(use-package smartparens
- :unless noninteractive
- :commands (smartparens-mode smartparens-global-mode show-smartparens-global-mode
- sp-split-sexp sp-newline sp-up-sexp)
- :hook ((prog-mode . turn-on-smartparens-mode)
- (markdown-mode . turn-on-smartparens-mode)
- (org-mode . turn-on-smartparens-mode)
- (prog-mode . turn-on-show-smartparens-mode)
- (markdown-mode . turn-on-show-smartparens-mode)
- (org-mode . turn-on-show-smartparens-mode)
- (emacs-lisp-mode . turn-on-smartparens-strict-mode))
- :config
- (require 'smartparens-config)
-
- (sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
- (sp-local-pair 'web-mode "{%" "%}")
- (sp-with-modes '(org-mode)
- (sp-local-pair "=" "="))
- (sp-with-modes 'emacs-lisp-mode
- ;; disable ', it's the quote character!
- (sp-local-pair "'" nil :actions nil)
- ;; also only use the pseudo-quote inside strings where it
- ;; serves as hyperlink.
- (sp-local-pair "`" "'" :when '(sp-in-string-p sp-in-comment-p))))
-
-(use-package color-identifiers-mode
- :unless noninteractive
- :commands (color-identifiers-mode)
- :config
- (setq-default color-identifiers:num-colors 15
- color-identifiers:min-color-saturation 0.1
- color-identifiers:max-color-saturation 0.9)
- (defun myfunc-color-identifiers-mode-hook ()
- (let ((faces '(font-lock-comment-face font-lock-comment-delimiter-face font-lock-constant-face font-lock-type-face font-lock-function-name-face font-lock-variable-name-face font-lock-keyword-face font-lock-string-face font-lock-builtin-face font-lock-preprocessor-face font-lock-warning-face font-lock-doc-face font-lock-negation-char-face font-lock-regexp-grouping-construct font-lock-regexp-grouping-backslash)))
- (dolist (face faces)
- (face-remap-add-relative face '((:foreground "" :weight normal :slant normal)))))
- (face-remap-add-relative 'font-lock-keyword-face '((:weight bold :slant normal :foreground "#666666")))
- (face-remap-add-relative 'font-lock-comment-face '((:slant italic :weight bold :foreground "#333333")))
- (face-remap-add-relative 'font-lock-comment-delimiter-face '((:slant italic :weight bold :foreground "#333333")))
- (face-remap-add-relative 'font-lock-builtin-face '((:weight bold :foreground "#666666")))
- (face-remap-add-relative 'font-lock-preprocessor-face '((:weight bold)))
- (face-remap-add-relative 'font-lock-function-name-face '((:underline t)))
- (face-remap-add-relative 'font-lock-string-face '((:weight normal :foreground "#333333")))
- (face-remap-add-relative 'font-lock-constant-face '((:foreground "#666666" :slant italic))))
- (add-hook 'color-identifiers-mode-hook 'myfunc-color-identifiers-mode-hook)
- :hook ((go-mode . color-identifiers-mode)
- (js-mode . color-identifiers-mode)
- (python-mode . color-identifiers-mode)))
-
-(use-package aggressive-indent
- :unless noninteractive
- :bind ("C-c e i" . aggressive-indent-mode)
- :hook ((lisp-mode . aggressive-indent-mode)
- (emacs-lisp-mode . aggressive-indent-mode))
- :config
- ;; Free C-c C-q, used in Org and in CIDER
- (unbind-key "C-c C-q" aggressive-indent-mode-map))
(use-package undo-tree
:unless noninteractive
@@ -94,7 +37,6 @@
:config
(setq-default undo-tree-visualizer-timestamps t
undo-tree-enable-undo-in-region t))
-
(use-package whitespace
:unless noninteractive
:commands (whitespace-mode vde/toggle-invisibles)
@@ -108,22 +50,6 @@
(whitespace-mode)))
:bind ("<f6>" . vde/toggle-invisibles))
-(use-package expand-region
- :unless noninteractive
- :commands (er/expand-region er/contract-region)
- :bind (("C-=" . er/expand-region)
- ("C--". er/contract-region)))
-
-(use-package visual-regexp
- :unless noninteractive
- :commands (vr/replace vr/query-replace)
- :bind (("C-c r" . vr/replace)
- ("C-c %" . vr/query-replace)))
-
-(use-package hs-minor-mode
- :unless noninteractive
- :hook ((prog-mode . hs-minor-mode)))
-
(use-package easy-kill
:unless noninteractive
:commands (easy-kill)
@@ -173,39 +99,6 @@ Else toggle the comment status of the line at point."
("M-;" . comment-indent)
("C-x C-;" . comment-box)))
-;; FIXME(vdemeester) Do I need on-the-fly spellcheck *or* not ?
-(use-package flyspell
- :unless noninteractive
- :commands (flyspell-prog-mode flyspell-mode)
- :hook((text-mode . flyspell-mode)
- (prog-mode . flyspell-prog-mode))
- :config
- (define-key flyspell-mode-map (kbd "C-;") nil)
- (setq-default flyspell-issue-message-flag nil
- flyspell-issue-welcome-flag nil
- ispell-program-name "hunspell"
- ispell-local-dictionary "en_GB"
- ispell-local-dictionary-alist
- '(("en_GB"
- "[[:alpha:]]"
- "[^[:alpha:]]"
- "[']"
- nil
- ("-d" "en_GB,fr_FR")
- nil
- utf-8))))
-
-(use-package emacs
- :init
- (setq-default tab-always-indent 'complete
- tab-width 4
- indent-tabs-mode nil))
-
-;; FIXME: enable/disable this through a minor mode
-;; can be enable by default in code, disable in adoc-mode, …
-;; (use-package emacs
-;; :hook (before-save . delete-trailing-whitespace))
-
(use-package delsel
:unless noninteractive
:config
@@ -218,44 +111,17 @@ Else toggle the comment status of the line at point."
(set-mark-command-repeat-pop t)
:bind ("M-z" . zap-up-to-char))
+(use-package visual-regexp
+ :unless noninteractive
+ :commands (vr/replace vr/query-replace)
+ :bind (("C-c r" . vr/replace)
+ ("C-c %" . vr/query-replace)))
+
(use-package emacs
:config
- (defun prot/new-line-below ()
- "Create a new line below the current one. Move the point to
-the absolute beginning. Also see `prot/new-line-above'."
- (interactive)
- (end-of-line)
- (newline))
-
- (defun prot/new-line-above ()
- "Create a new line above the current one. Move the point to
-the absolute beginning. Also see `prot/new-line-below'."
- (interactive)
- (beginning-of-line)
- (newline)
- (forward-line -1))
-
- (defun prot/yank-replace-line-or-region ()
- "Replace the line at point with the contents of the last
-stretch of killed text. If the region is active, operate over it
-instead. This command can then be followed by the standard
-`yank-pop' (default is bound to M-y)."
- (interactive)
- (if (use-region-p)
- (progn
- (delete-region (region-beginning) (region-end))
- (yank))
- (progn
- (delete-region (point-at-bol) (point-at-eol))
- (yank))))
-
- :bind (("C-S-SPC" . contrib/mark-whole-word)
- ("<C-return>" . prot/new-line-below)
- ("<C-S-return>" . prot/new-line-above)
- ("M-SPC" . cycle-spacing)
+ :bind (("M-SPC" . cycle-spacing)
("M-o" . delete-blank-lines)
- ("<C-f6>" . tear-off-window)
- ("C-S-y" . prot/yank-replace-line-or-region)))
+ ("<C-f6>" . tear-off-window)))
(use-package pdf-tools
:unless noninteractive
@@ -267,11 +133,6 @@ instead. This command can then be followed by the standard
(pdf-tools-install :no-query)
(require 'pdf-occur))
-(use-package paste-sbr
- :unless noninteractive
- :commands (htmlize-paste-it)
- :bind ("C-c e p" . htmlize-paste-it))
-
(use-package scratch
:unless noninteractive
:commands (scratch)
tools/emacs/config/config-keybindings.el
@@ -10,5 +10,7 @@
;; See https://www.masteringemacs.org/article/text-expansion-hippie-expand
(global-set-key [remap dabbrev-expand] 'hippie-expand)
-(provide 'config-keybindings)
-;;; config-keybindings.el ends here
+
+;;
+;; (provide 'config-keybindings)
+;; ;;; config-keybindings.el ends here
tools/emacs/config/config-music.el
@@ -1,40 +0,0 @@
-;;; config-music.el --- -*- lexical-binding: t; -*-
-;;; Commentary:
-;;; Music configuration
-;;; Code:
-
-(use-package bongo
- :commands (bongo bongo-show)
- :bind (("C-c x b" . bongo)
- ("<C-XF86AudioPlay>" . bongo-pause/resume)
- ("<C-XF86AudioNext>" . bongo-next)
- ("<C-XF86AudioPrev>" . bongo-previous)
- ("<M-XF86AudioPlay>" . bongo-show)
- ("<S-XF86AudioNext>" . bongo-seek-forward-10)
- ("<S-XF86AudioPrev>" . bongo-seek-backward-10))
- :config
- (setq-default bongo-audio-file-name-extensions
- '("669" "aac" "amf" "apun" "au" "dsm" "far" "flac" "g18" "g36" "gdm"
- "imf" "it" "mdz" "med" "mid" "midi" "mka" "mod" "m4a" "mp2" "mp3"
- "mtm" "ogg" "oga ""opus" "okt" "r36" "ra" "rcp" "rmi" "s3m" "spx"
- "stm" "stx" "ult" "umx" "uni" "vqf" "wav" "wma" "xm")
- bongo-custom-backend-matchers
- '((mpv local-file "m4a")
- (mpv local-file "oga")
- (mpv local-file "opus"))
- bongo-default-directory "/net/sakhalin.home/export/gaia/music"
- bongo-prefer-library-buffers nil
- bongo-insert-whole-directory-trees t
- bongo-logo nil
- bongo-display-track-icons nil
- bongo-display-track-lengths nil
- bongo-display-header-icons nil
- bongo-display-playback-mode-indicator t
- bongo-display-inline-playback-progress nil
- bongo-join-inserted-tracks nil
- bongo-field-separator (propertize " · " 'face 'shadow))
- (bongo-mode-line-indicator-mode -1)
- (bongo-header-line-mode -1))
-
-(provide 'config-music)
-;;; config-music ends here
tools/emacs/config/config-programming.el
@@ -0,0 +1,40 @@
+;;; config-programming.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Configure general programming
+;;; Code:
+
+(defun my-recompile (args)
+ (interactive "P")
+ (cond
+ ((eq major-mode #'emacs-lisp-mode)
+ (call-interactively 'eros-eval-defun))
+ ((bound-and-true-p my-vterm-command)
+ (my-vterm-execute-region-or-current-line my-vterm-command))
+ ((get-buffer "*compilation*")
+ (with-current-buffer"*compilation*"
+ (recompile)))
+ ((get-buffer "*Go Test*")
+ (with-current-buffer "*Go Test*"
+ (recompile)))
+ ((and (eq major-mode #'go-mode)
+ buffer-file-name
+ (string-match
+ "_test\\'" (file-name-sans-extension buffer-file-name)))
+ (my-gotest-maybe-ts-run))
+ ((and (get-buffer "*cargo-test*")
+ (boundp 'my-rustic-current-test-compile)
+ my-rustic-current-test-compile)
+ (with-current-buffer "*cargo-test*"
+ (rustic-cargo-test-run my-rustic-current-test-compile)))
+ ((get-buffer "*cargo-run*")
+ (with-current-buffer "*cargo-run*"
+ (rustic-cargo-run-rerun)))
+ ((get-buffer "*pytest*")
+ (with-current-buffer "*pytest*"
+ (recompile)))
+ ((eq major-mode #'python-mode)
+ (compile (concat python-shell-interpreter " " (buffer-file-name))))
+ ((call-interactively 'compile))))
+
+(provide 'config-programming)
+;;; config-programming.el ends here
tools/emacs/config/programming-eglot.el
@@ -0,0 +1,36 @@
+;;; programming-eglot.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Eglot configuration
+;;; Code:
+(use-package eglot
+ :bind
+ (:map eglot-mode-map
+ ("C-c a" . eglot-code-actions)
+ ("C-c r" . eglot-reconnect)
+ ("<f2>" . eglot-rename)
+ ("C-c ?" . eldoc-print-current-symbol-info))
+ :config
+ (add-to-list 'eglot-ignored-server-capabilities :documentHighlightProvider)
+ (add-to-list 'eglot-server-programs `(json-mode "vscode-json-language-server" "--stdio"))
+ (setq-default eglot-workspace-configuration
+ '(:gopls (:usePlaceholders t)))
+ (setq-default
+ eglot-workspace-configuration
+ '((:gopls . ((gofumpt . t)))))
+ :hook
+ (before-save . gofmt-before-save)
+ (before-save . eglot-format-buffer)
+ (rust-mode . eglot-ensure)
+ (sh-script-mode . eglot-ensure)
+ (python-mode . eglot-ensure)
+ (json-mode . eglot-ensure)
+ (yaml-mode . eglot-ensure)
+ (c-mode . eglot-ensure)
+ (cc-mode . eglot-ensure)
+ (go-mode . eglot-ensure)
+ :custom
+ rustic-lsp-client 'eglot)
+
+
+(provide 'programming-eglot)
+;;; programming-eglot.el ends here
tools/emacs/config/programming-go.el
@@ -2,32 +2,37 @@
;;; Commentary:
;;; Go programming language configuration
;;; Code:
-(use-package go-mode
- :commands (go-mode)
- :mode "\\.go$"
- :interpreter "go"
- :config
- ;(setq gofmt-command "goimports")
- (if (not (executable-find "goimports"))
- (warn "go-mode: couldn't find goimports; no code formatting/fixed imports on save")
- (add-hook 'before-save-hook 'gofmt-before-save))
- (if (not (string-match "go" compile-command)) ; set compile command default
- (set (make-local-variable 'compile-command)
- "go build -v && go test -v && go vet")))
+
(use-package gotest
- :after go-mode)
+ :commands (my-gotest-maybe-ts-run go-test--get-current-test-info)
+ :after go-mode
+ :custom
+ (go-test-verbose t)
+ :hook
+ (go-test-mode . (lambda () (pop-to-buffer (get-buffer "*Go Test*"))))
+ (go-mode . (lambda ()(interactive) (setq go-run-args "-v")))
+ :config
+ (defun my-go-test-current-project()
+ (interactive)
+ (let ((default-directory (project-root (project-current t))))
+ (go-test-current-project)))
+ (defun my-gotest-maybe-ts-run()
+ (interactive)
+ (let ((testrunname)
+ (gotest (cadr (go-test--get-current-test-info))))
+ (save-excursion
+ (goto-char (line-beginning-position))
+ (re-search-forward "name:[[:blank:]]*\"\\([^\"]*\\)\"" (line-end-position) t))
+ (setq testrunname (match-string-no-properties 1))
+ (if testrunname
+ (setq gotest (format "%s/%s" gotest (shell-quote-argument
+ (replace-regexp-in-string " " "_" testrunname)))))
+ (go-test--go-test (concat "-run " gotest "\\$ .")))))
-(use-package gotest-ui
- :commands (gotest-ui-current-test gotest-ui-current-file gotest-ui-current-project)
- :after (go-mode gotest)
- :bind (:map go-mode-map
- ("C-c t t" . gotest-ui-current-test)
- ("C-c t f" . gotest-ui-current-file)
- ("C-c t p" . gotest-ui-current-project)))
-
-(use-package go-stacktracer
- :commands (go-stacktracer-region))
+(use-package go-mode
+ :hook
+ (go-mode . go-ts-mode-hook))
(provide 'programming-go)
;;; programming-go.el ends here
tools/emacs/config/programming-lsp.el
@@ -1,44 +0,0 @@
-;;; programming-lsp.el --- -*- lexical-binding: t; -*-
-;;; Commentary:
-;;; LSP configuration
-;;; Code:
-(use-package lsp-mode
- :commands (lsp lsp-deferred)
- :hook ((python-mode . lsp)
- (go-mode . lsp))
- :init
- (setq lsp-keymap-prefix "C-c l")
- :config
- ;; (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\vendor\\'")
- :custom
- ;; turn this on to capture client/server comms before
- ;; submitting bug reports with `lsp-workspace-show-log`
- (lsp-enable-file-watchers nil)
- (lsp-completion-provider :none)
- (lsp-log-io nil)
- ;; (lsp-lens-enable t)
- (lsp-eldoc-enable-hover t)
- ;; (lsp-enable-indentation nil)
- (lsp-prefer-flymake t)
- (lsp-ui-sideline-enable nil)
- (lsp-ui-doc-enable nil)
- (lsp-ui-imenu-enable t)
- (lsp-ui-sideline-ignore-duplicate t)
- (lsp-enable-folding t)
- (lsp-enable-dap-auto-configure nil) ; Don't try to auto-enable dap: this creates a lot of binding clashes
- (lsp-headerline-breadcrumb-enable nil)
- (lsp-modeline-code-actions-enable nil)
- (lsp-modeline-diagnostics-enable nil)
- (lsp-idle-delay .01)
- (lsp-keymap-prefix nil)
- (lsp-eldoc-render-all nil)
- (lsp-file-watch-threshold 4000)
- (lsp-gopls-complete-unimported t t)
- (lsp-yaml-format-enable t)
- (lsp-gopls-staticcheck t t))
-
-(use-package consult-lsp
- :after (lsp))
-
-(provide 'programming-lsp)
-;;; programming-lsp.el ends here
tools/emacs/config/programming-treesitter.el
@@ -0,0 +1,12 @@
+;;; programming-treesitter.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Treesitter configuration
+;;; Code:
+
+(use-package treesit-auto
+ :config
+ (setq treesit-auto-install 'prompt)
+ (global-treesit-auto-mode))
+
+(provide 'programming-treesitter)
+;;; programming-treesitter.el ends here
tools/emacs/old-config/00-base.el
@@ -0,0 +1,44 @@
+;;; 00-base.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Emacs *absolute* base configuration
+;;; Code:
+
+(setq frame-title-form '("%b")) ;; do not add "GNU Emacs at …"
+(setq use-short-answers t) ;; for emacs and above, replace defalias yes-or-no-p
+(setq read-answer-short t) ;; accepts single-character answers, very similar to above
+
+(put 'overwrite-mode 'disabled t) ;; I don't really want to use overwrite-mod, ever
+(setq initial-buffer-choice t) ;; always start with *scratch*
+
+(setq use-dialog-box nil) ;; never use dialog box (no mouse >:D)
+(setq use-file-dialog nil) ;; never use file dialog (gtk)
+(setq echo-keystrokes 0.1) ;; display command keystrokes quickly
+
+(global-unset-key (kbd "C-z"))
+(global-unset-key (kbd "C-x C-z"))
+(global-unset-key (kbd "C-h h"))
+
+;; Custom file management
+(defconst vde/custom-file (locate-user-emacs-file "custom.el")
+ "File used to store settings from Customization UI.")
+
+(setq minibuffer-prompt-properties
+ '(read-only t cursor-intangible t face minibuffer-prompt))
+
+(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
+
+(use-package cus-edit
+ :config
+ (setq
+ custom-file vde/custom-file
+ custom-buffer-done-kill nil ; Kill when existing
+ custom-buffer-verbose-help nil ; Remove redundant help text
+ custom-unlispify-tag-names nil ; Show me the real variable name
+ custom-unlispify-menu-entries nil)
+ (unless (file-exists-p custom-file)
+ (write-region "" nil custom-file))
+
+ (load vde/custom-file 'no-error 'no-message))
+
+(provide '00-base)
+;;; 00-base.el ends here
tools/emacs/old-config/00-clean.el
@@ -0,0 +1,64 @@
+;;; 00-clean.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; no-littering and recentf configurations
+;;; Note: this file is autogenerated from an org-mode file.
+;;; Code:
+(use-package recentf
+ :config
+ (setq recentf-max-saved-items 200
+ recentf-auto-cleanup 360
+ recentf-show-file-shortcuts-flag nil)
+ (recentf-mode 1)
+ (add-to-list 'recentf-exclude "^/\\(?:ssh\\|su\\|sudo\\)?:")
+ ;; Magic advice to rename entries in recentf when moving files in
+ ;; dired.
+ (defun rjs/recentf-rename-notify (oldname newname &rest args)
+ (if (file-directory-p newname)
+ (rjs/recentf-rename-directory oldname newname)
+ (rjs/recentf-rename-file oldname newname)))
+
+ (defun rjs/recentf-rename-file (oldname newname)
+ (setq recentf-list
+ (mapcar (lambda (name)
+ (if (string-equal name oldname)
+ newname
+ oldname))
+ recentf-list))
+ recentf-cleanup)
+
+ (defun rjs/recentf-rename-directory (oldname newname)
+ ;; oldname, newname and all entries of recentf-list should already
+ ;; be absolute and normalised so I think this can just test whether
+ ;; oldname is a prefix of the element.
+ (setq recentf-list
+ (mapcar (lambda (name)
+ (if (string-prefix-p oldname name)
+ (concat newname (substring name (length oldname)))
+ name))
+ recentf-list))
+ recentf-cleanup)
+
+ (advice-add 'dired-rename-file :after #'rjs/recentf-rename-notify))
+
+(use-package no-littering ; Keep .emacs.d clean
+ :config
+ (require 'recentf)
+ (add-to-list 'recentf-exclude no-littering-var-directory)
+ (add-to-list 'recentf-exclude no-littering-etc-directory)
+
+ ;; Move this in its own thing
+ (setq
+ create-lockfiles nil
+ delete-old-versions t
+ kept-new-versions 6
+ kept-old-versions 2
+ version-control t)
+
+ (setq
+ backup-directory-alist
+ `((".*" . ,(no-littering-expand-var-file-name "backup/")))
+ auto-save-file-name-transforms
+ `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
+
+(provide '00-clean)
+;;; 00-clean.el ends here
tools/emacs/old-config/config-appearance.el
@@ -0,0 +1,259 @@
+;;; config-appearance.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Appearance configuration
+;;; Code:
+(declare-function projectile-project-name "projectile")
+
+(use-package emacs
+ :defer 3
+ :bind ("C-c f r" . mu-reset-fonts)
+ :commands (mu-reset-fonts)
+ :hook (after-init . mu-reset-fonts)
+ :config
+ ;; For displaying emojies 😛🦁
+ (set-fontset-font t 'symbol "Apple Color Emoji")
+ (set-fontset-font t 'symbol "Noto Color Emoji" nil 'append)
+ (set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append)
+ (set-fontset-font t 'symbol "Symbola" nil 'append)
+ (defun mu-reset-fonts ()
+ "Reset fonts to my preferences."
+ (interactive)
+ (when (member font-family-mono (font-family-list))
+ (set-face-attribute 'default nil
+ :family font-family-mono
+ :height font-height)
+ (set-face-attribute 'fixed-pitch nil
+ :family font-family-mono))
+ (when (member font-family-sans (font-family-list))
+ (set-face-attribute 'variable-pitch nil
+ :family font-family-sans
+ :weight 'regular))
+ (set-fontset-font t 'symbol "Apple Color Emoji")
+ (set-fontset-font t 'symbol "Noto Color Emoji" nil 'append)
+ (set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append)
+ (set-fontset-font t 'symbol "Symbola" nil 'append)))
+
+(use-package emacs
+ :config
+ (setq-default use-file-dialog nil
+ use-dialog-box nil
+ echo-keystrokes 0.1
+ line-number-display-limit-width 10000
+ indicate-buffer-boundaries 'left
+ indicate-empty-lines +1)
+ (line-number-mode 1)
+ (column-number-mode 1)
+ (global-unset-key (kbd "C-z"))
+ (global-unset-key (kbd "C-x C-z"))
+ (global-unset-key (kbd "C-h h"))
+ ;; let's enable it for all programming major modes
+ (add-hook 'prog-mode-hook #'hl-line-mode)
+ ;; and for all modes derived from text-mode
+ (add-hook 'text-mode-hook #'hl-line-mode))
+
+(use-package hl-todo
+ :commands (hl-todo-mode)
+ :hook ((prog-mode . hl-todo-mode)))
+
+(use-package frame
+ :unless noninteractive
+ :commands vde/cursor-type-mode
+ :config
+ (setq-default cursor-type 'box)
+ (setq-default cursor-in-non-selected-windows '(bar . 2))
+ (setq-default blink-cursor-blinks 50)
+ (setq-default blink-cursor-interval nil) ; 0.75 would be my choice
+ (setq-default blink-cursor-delay 0.2)
+
+ (blink-cursor-mode -1)
+
+ (define-minor-mode vde/cursor-type-mode
+ "Toggle between static block and pulsing bar cursor."
+ :init-value nil
+ :global t
+ (if vde/cursor-type-mode
+ (progn
+ (setq-local blink-cursor-interval 0.75
+ cursor-type '(bar . 2)
+ cursor-in-non-selected-windows 'hollow)
+ (blink-cursor-mode 1))
+ (dolist (local '(blink-cursor-interval
+ cursor-type
+ cursor-in-non-selected-windows))
+ (kill-local-variable `,local))
+ (blink-cursor-mode -1))))
+
+(use-package emacs
+ :config
+ (setq-default custom-safe-themes t)
+ (setq-default custom--inhibit-theme-enable nil)
+
+ (defun vde/before-load-theme (&rest args)
+ "Clear existing theme settings instead of layering them.
+Ignores `ARGS'."
+ (mapc #'disable-theme custom-enabled-themes))
+
+ (advice-add 'load-theme :before #'vde/before-load-theme))
+
+(use-package emacs
+ :config
+ (setq window-divider-default-right-width 1)
+ (setq window-divider-default-bottom-width 1)
+ (setq window-divider-default-places 'right-only)
+ :hook (after-init . window-divider-mode))
+
+(use-package tab-bar
+ :unless noninteractive
+ :config
+ (setq-default tab-bar-close-button-show nil)
+ (setq-default tab-bar-close-last-tab-choice 'tab-bar-mode-disable)
+ (setq-default tab-bar-close-tab-select 'recent)
+ (setq-default tab-bar-new-tab-choice t)
+ (setq-default tab-bar-new-tab-to 'right)
+ (setq-default tab-bar-position nil)
+ (setq-default tab-bar-show t)
+ (setq-default tab-bar-tab-hints nil)
+ (setq-default tab-bar-tab-name-function 'vde/tab-bar-tab-name)
+
+ (defun vde/tab-bar-tab-name ()
+ "Generate tab name from the buffer of the selected window *or* projectile."
+ (cond
+ ((boundp 'projectile-project-name) (if (string-equal (projectile-project-name) "-")
+ (tab-bar-tab-name-current-with-count)
+ (projectile-project-name)))
+ ((project-current) (let ((project-path (vde-project--project-current)))
+ (cond ((string-prefix-p "~/src" project-path)
+ (directory-file-name (file-relative-name project-path "~/src")))
+ ((string-prefix-p "~/desktop" project-path)
+ (directory-file-name (file-relative-name project-path "~/desktop")))
+ ((string-prefix-p "/etc" project-path)
+ (directory-file-name (file-relative-name project-path "/etc")))
+ (t
+ (file-relative-name project-path)))))
+ (t (tab-bar-tab-name-current-with-count))))
+
+ (defun vde/complete-tab-bar-tab-dwim ()
+ "Do-What-I-Mean function for getting to a `tab-bar-mode' tab.
+If no other tab exists, create one and switch to it. If there is
+one other tab (so two in total) switch to it without further
+questions. Else use completion to select the tab to switch to."
+ (interactive)
+ (let ((tabs (mapcar (lambda (tab)
+ (alist-get 'name tab))
+ (tab-bar--tabs-recent))))
+ (cond ((eq tabs nil)
+ (tab-new))
+ ((eq (length tabs) 1)
+ (tab-next))
+ (t
+ (tab-bar-switch-to-tab
+ (completing-read "Select tab: " tabs nil t))))))
+
+ :bind (("C-x t t" . vde/complete-tab-bar-tab-dwim)
+ ("C-x t s" . tab-switcher)))
+
+(use-package moody
+ :unless noninteractive
+ :config
+ (setq-default x-underline-at-descent-line t
+ ;; Show buffer position percentage starting from top
+ mode-line-percent-position '(-3 "%o"))
+
+ (setq-default mode-line-format
+ '("%e"
+ mode-line-front-space
+ mode-line-client
+ mode-line-modified
+ mode-line-remote
+ mode-line-frame-identification
+ mode-line-buffer-identification " " mode-line-position
+ (vc-mode vc-mode)
+ (multiple-cursors-mode mc/mode-line)
+ " " mode-line-modes
+ mode-line-end-spaces))
+
+ (setq-default global-mode-string (remove 'display-time-string global-mode-string)
+ mode-line-end-spaces
+ (list (propertize " " 'display '(space :align-to (- right 19)))
+ 'display-time-string))
+ (advice-add #'vc-git-mode-line-string :filter-return #'my-replace-git-status)
+ (defun my-replace-git-status (tstr)
+ (let* ((tstr (replace-regexp-in-string "Git" "" tstr))
+ (first-char (substring tstr 0 1))
+ (rest-chars (substring tstr 1)))
+ (cond
+ ((string= ":" first-char) ;;; Modified
+ (replace-regexp-in-string "^:" "~ " tstr))
+ ((string= "-" first-char) ;; No change
+ (replace-regexp-in-string "^-" "- " tstr))
+ (t tstr))))
+ (moody-replace-mode-line-buffer-identification)
+ (moody-replace-vc-mode))
+
+(use-package minions
+ :unless noninteractive
+ :config
+ (setq-default minions-mode-line-lighter "λ="
+ minions-mode-line-delimiters '("" . "")
+ minions-direct '(flycheck-mode))
+ (minions-mode +1))
+
+(use-package time
+ :unless noninteractive
+ :config
+ (setq-default display-time-24hr-format t
+ display-time-day-and-date t
+ display-time-world-list '(("Europe/Paris" "Paris")
+ ("Europe/London" "London")
+ ("America/New_York" "Boston")
+ ("America/Los_Angeles" "San Francisco")
+ ("Asia/Calcutta" "Bangalore")
+ ("Australia/Brisbane" "Brisbane"))
+ display-time-string-forms
+ '((format "%s %s %s, %s:%s"
+ dayname
+ monthname day
+ 24-hours minutes)))
+ (display-time))
+
+(use-package lin
+ :unless noninteractive
+ :config
+ (setq lin-face 'lin-blue)
+ (setq lin-mode-hooks
+ '(bongo-mode-hook
+ dired-mode-hook
+ elfeed-search-mode-hook
+ git-rebase-mode-hook
+ ibuffer-mode-hook
+ ilist-mode-hook
+ ledger-report-mode-hook
+ log-view-mode-hook
+ magit-log-mode-hook
+ mu4e-headers-mode
+ notmuch-search-mode-hook
+ notmuch-tree-mode-hook
+ occur-mode-hook
+ org-agenda-mode-hook
+ tabulated-list-mode-hook))
+ (lin-global-mode))
+
+(use-package tooltip
+ :unless noninteractive
+ :config
+ (setq tooltip-delay 0.5)
+ (setq tooltip-short-delay 0.5)
+ (setq x-gtk-use-system-tooltips nil)
+ (setq tooltip-frame-parameters
+ '((name . "tooltip")
+ (internal-border-width . 6)
+ (border-width . 0)
+ (no-special-glyphs . t)))
+ :hook (after-init-hook . tooltip-mode))
+
+(use-package alert
+ :config
+ (setq alert-default-style 'libnotify))
+
+(provide 'config-appearance)
+;;; config-appearance.el ends here
tools/emacs/old-config/config-buffers.el
@@ -0,0 +1,213 @@
+;;; config-buffers.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Buffer related configurations
+;;; Code:
+
+(use-package popper
+ :commands (popper-mode)
+ :bind ((("C-`" . popper-toggle-latest)
+ ("M-`" . popper-cycle)
+ ("C-M-`" . popper-toggle-type)))
+ :init
+ (setq popper-reference-buffers
+ '("\\*Messages\\*"
+ "Output\\*$" "\\*Pp Eval Output\\*$"
+ "\\*Compile-Log\\*"
+ ;; "\\*Completions\\*"
+ "\\*Warnings\\*"
+ "\\*Async Shell Command\\*"
+ "\\*Apropos\\*"
+ "\\*Backtrace\\*"
+ "\\*Calendar\\*"
+ "\\*Embark Actions\\*"
+ "\\*Finder\\*"
+ "\\*Kill Ring\\*"
+
+ bookmark-bmenu-mode
+ comint-mode
+ compilation-mode
+ help-mode helpful-mode
+ tabulated-list-mode
+ Buffer-menu-mode
+
+ gnus-article-mode devdocs-mode
+ grep-mode occur-mode rg-mode deadgrep-mode ag-mode pt-mode
+ ivy-occur-mode ivy-occur-grep-mode
+ process-menu-mode list-environment-mode cargo-process-mode
+ youdao-dictionary-mode osx-dictionary-mode fanyi-mode
+
+ "^\\*eshell.*\\*.*$" eshell-mode
+ "^\\*shell.*\\*.*$" shell-mode
+ "^\\*terminal.*\\*.*$" term-mode
+ "^\\*vterm.*\\*.*$" vterm-mode
+
+ "\\*DAP Templates\\*$" dap-server-log-mode
+ "\\*ELP Profiling Restuls\\*" profiler-report-mode
+ "\\*Flycheck errors\\*$" " \\*Flycheck checker\\*$"
+ "\\*Paradox Report\\*$" "\\*package update results\\*$" "\\*Package-Lint\\*$"
+ "\\*[Wo]*Man.*\\*$"
+ "\\*ert\\*$" overseer-buffer-mode
+ "\\*gud-debug\\*$"
+ "\\*lsp-help\\*$" "\\*lsp session\\*$"
+ "\\*quickrun\\*$"
+ "\\*tldr\\*$"
+ "\\*vc-.*\\*$"
+ "^\\*elfeed-entry\\*$"
+ "^\\*macro expansion\\**"
+
+ "\\*Agenda Commands\\*" "\\*Org Select\\*" "\\*Capture\\*" "^CAPTURE-.*\\.org*"
+ "\\*Gofmt Errors\\*$" "\\*Go Test\\*$" godoc-mode
+ "\\*docker-containers\\*" "\\*docker-images\\*" "\\*docker-networks\\*" "\\*docker-volumes\\*"
+ "\\*prolog\\*" inferior-python-mode inf-ruby-mode swift-repl-mode
+ "\\*rustfmt\\*$" rustic-compilation-mode rustic-cargo-clippy-mode
+ rustic-cargo-outdated-mode rustic-cargo-test-moed))
+ (setq popper-group-function #'popper-group-by-project)
+ :config
+ (popper-echo-mode 1))
+
+(use-package emacs
+ :unless noninteractive
+ :config
+ ;; Configure `display-buffer' behaviour for some special buffers
+ (setq-default display-buffer-alist
+ '(;; bottom side window
+ ;; ("\\*e?shell.*"
+ ;; (display-buffer-in-side-window)
+ ;; (window-height . 0.25)
+ ;; (side . bottom)
+ ;; (slot . -1))
+ ;; ("\\*v?term.*"
+ ;; (display-buffer-in-side-window)
+ ;; (window-height . 0.25)
+ ;; (side . bottom)
+ ;; (slot . -1))
+ (".*\\*\\(Completions\\).*"
+ (display-buffer-in-side-window)
+ (window-height . 0.16)
+ (side . bottom)
+ (slot . 0)
+ (window-parameters . ((no-other-window . t))))
+ ("\\*\\(Backtrace\\|Warnings\\|Compile-Log\\|[Hh]elp\\|Messages\\)\\*"
+ (display-buffer-in-side-window)
+ (window-height . 0.25)
+ (side . bottom)
+ (slot . 0))
+ ("\\*\\(helpful\\).*"
+ (display-buffer-in-side-window)
+ (window-height . 0.25)
+ (side . bottom)
+ (slot . 0))
+ ("\\*.*\\(compilation\\|go test\\).*"
+ (display-buffer-in-side-window)
+ (window-height . 0.25)
+ (side . bottom)
+ (slot . 0))
+ ("\\*\\(ielm\\).*"
+ (display-buffer-in-side-window)
+ (window-height . 0.25)
+ (side . bottom)
+ (slot . 1))
+ ;; right side window
+ ("\\*wclock*"
+ (display-buffer-in-side-window)
+ (window-width . 0.20)
+ (side . right)
+ (slot . -1))
+ ("\\*undo-tree*"
+ (display-buffer-in-side-window)
+ (window-width . 0.20)
+ (side . right)
+ (slot . -1))
+ ("\\*\\(Flycheck\\|Package-Lint\\).*"
+ (display-buffer-in-side-window)
+ (window-width . 0.40)
+ (side . right)
+ (slot . 0)
+ (window-parameters . ((no-other-window . t)
+ (mode-line-format . (" "
+ mode-line-buffer-identification)))))
+ ;; ("\\*Custom.*"
+ ;; (display-buffer-in-side-window)
+ ;; (window-width . 0.20)
+ ;; (side . right)
+ ;; (slot . 2))
+ ("\\*Embark Occur.*"
+ (display-buffer-at-bottom))))
+ (setq window-sides-vertical nil)
+ (setq window-combination-resize t) ; Size new windows proportionally
+ :bind (("C-x +" . balance-windows-area)
+ ("<C-f7>" . window-toggle-side-windows)))
+
+(use-package savehist
+ :unless noninteractive
+ :config
+ (setq-default history-length 10000
+ savehist-save-minibuffer-history t
+ savehist-autosave-interval 180
+ savehist-additional-variables '(extended-command-history
+ search-ring
+ regexp-search-ring
+ comint-input-ring
+ compile-history
+ last-kbd-macro
+ shell-command-history
+ projectile-project-command-history))
+ (savehist-mode 1))
+
+(use-package uniquify
+ :unless noninteractive
+ :config
+ (setq-default uniquify-buffer-name-style 'post-forward
+ uniquify-separator ":"
+ uniquify-ignore-buffers-re "^\\*"
+ uniquify-after-kill-buffer-p t))
+
+(use-package ibuffer
+ :unless noninteractive
+ :commands (ibuffer)
+ :bind (("C-x C-b" . ibuffer)
+ ([remap list-buffers] . ibuffer))
+ :config
+ (setq-default ibuffer-expert t
+ ibuffer-filter-group-name-face 'font-lock-doc-face
+ ibuffer-default-sorting-mode 'filename/process
+ ibuffer-use-header-line t
+ ibuffer-show-empty-filter-groups nil)
+ ;; Use human readable Size column instead of original one
+ (define-ibuffer-column size-h
+ (:name "Size" :inline t)
+ (cond
+ ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
+ ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
+ (t (format "%8d" (buffer-size)))))
+
+ (setq ibuffer-formats
+ '((mark modified read-only " "
+ (name 18 18 :left :elide)
+ " "
+ (size-h 9 -1 :right)
+ " "
+ (mode 16 16 :left :elide)
+ " "
+ filename-and-process)
+ (mark modified read-only " "
+ (name 18 18 :left :elide)
+ " "
+ (size 9 -1 :right)
+ " "
+ (mode 16 16 :left :elide)
+ " "
+ (vc-status 16 16 :left)
+ " "
+ filename-and-process))))
+
+(use-package ibuffer-vc
+ :unless noninteractive
+ :commands (ibuffer-vc-set-filter-groups-by-vc-root)
+ :hook (ibuffer . (lambda ()
+ (ibuffer-vc-set-filter-groups-by-vc-root)
+ (unless (eq ibuffer-sorting-mode 'filename/process)
+ (ibuffer-do-sort-by-filename/process)))))
+
+(provide 'config-buffers)
+;;; config-buffers.el ends here
tools/emacs/old-config/config-compile.el
@@ -0,0 +1,70 @@
+;;; config-compile.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Generic compilation configuration
+;;; Code:
+
+;; UseCompile
+(use-package compile
+ :unless noninteractive
+ :commands (compile)
+ :preface
+ (autoload 'ansi-color-apply-on-region "ansi-color")
+
+ (defvar compilation-filter-start)
+
+ (defun vde/colorize-compilation-buffer ()
+ (unless (or (derived-mode-p 'grep-mode)
+ (derived-mode-p 'ag-mode)
+ (derived-mode-p 'rg-mode))
+ (let ((inhibit-read-only t))
+ (ansi-color-apply-on-region compilation-filter-start (point)))))
+ (defun vde/goto-address-mode ()
+ (unless (or (derived-mode-p 'grep-mode)
+ (derived-mode-p 'ag-mode)
+ (derived-mode-p 'rg-mode))
+ (goto-address-mode t)))
+ :config
+ (setq-default compilation-scroll-output t
+ ;; I'm not scared of saving everything.
+ compilation-ask-about-save nil
+ ;; Automatically scroll and jump to the first error
+ ;; compilation-scroll-output 'next-error
+ ;; compilation-scroll-output 'first-error
+ ;; compilation-auto-jump-to-first-error t
+ ;; Skip over warnings and info messages in compilation
+ compilation-skip-threshold 2
+ ;; Don't freeze when process reads from stdin
+ compilation-disable-input t
+ ;; Show three lines of context around the current message
+ compilation-context-lines 3
+ )
+ (add-hook 'comint-output-filter-functions
+ 'comint-watch-for-password-prompt)
+ (setq-default comint-password-prompt-regexp
+ (concat
+ "\\("
+ "^Enter passphrase.*:"
+ "\\|"
+ "^Repeat passphrase.*:"
+ "\\|"
+ "[Pp]assword for '[a-z0-9_-.]+':"
+ "\\|"
+ "\\[sudo\\] [Pp]assword for [a-z0-9_-.]+:"
+ "\\|"
+ "[a-zA-Z0-9]'s password:"
+ "\\|"
+ "^[Pp]assword:"
+ "\\|"
+ "^[Pp]assword (again):"
+ "\\|"
+ ".*\\([Ww]ork\\|[Pp]ersonal\\).* password:"
+ "\\|"
+ "Password for '([^()]+)' GNOME keyring"
+ "\\|"
+ "Password for 'http.*github.*':"
+ "\\)"))
+ (add-hook 'compilation-filter-hook #'vde/colorize-compilation-buffer)
+ (add-hook 'compilation-mode-hook #'vde/goto-address-mode))
+
+(provide 'config-compile)
+;;; config-compile.el ends here
tools/emacs/old-config/config-completion.el
@@ -0,0 +1,321 @@
+;;; config-completion.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Setup completion framework
+;;; Code
+
+;; (use-package orderless
+;; :unless noninteractive
+;; :config
+;; (setq orderless-regexp-separator " +")
+;; (setq orderless-matching-styles
+;; '(orderless-prefixes
+;; orderless-literal
+;; orderless-regexp
+;; orderless-flex))
+;;
+;; (defun vde/orderless-literal-dispatcher (pattern _index _total)
+;; "Literal style dispatcher using the equals sign as a suffix.
+;; It matches PATTERN _INDEX and _TOTAL according to how Orderless
+;; parses its input."
+;; (when (string-suffix-p "=" pattern)
+;; `(orderless-literal . ,(substring pattern 0 -1))))
+;;
+;; (setq orderless-style-dispatchers '(vde/orderless-literal-dispatcher))
+;; :bind (:map minibuffer-local-completion-map
+;; ("SPC" . nil))) ; space should never complete
+;;
+;; (use-package marginalia
+;; :config
+;; (setq marginalia-max-relative-age 0) ; time is absolute here!
+;; (setq marginalia-annotators '(marginalia-annotators-heavy
+;; marginalia-annotators-light))
+;; (marginalia-mode 1))
+;;
+;; (use-package minibuffer
+;; :unless noninteractive
+;; :config
+;; (setq completion-cycle-threshold 3)
+;; (setq completion-flex-nospace nil)
+;; (setq completion-pcm-complete-word-inserts-delimiters t)
+;; (setq completion-pcm-word-delimiters "-_./:| ")
+;; (setq completion-ignore-case t)
+;; (setq-default case-fold-search nil) ; For general regexp
+;; ;; NOTE: flex completion is introduced in Emacs 27
+;; (setq completion-show-help nil)
+;; (setq completion-styles
+;; '(substring initials flex partial-completion orderless))
+;; (setq completion-category-overrides
+;; '((file (styles partial-completion))))
+;; ;; The following two are updated in Emacs 28. They concern the
+;; ;; *Completions* buffer.
+;; (setq completions-format 'one-column)
+;; (setq completions-detailed t)
+;;
+;; ;; Grouping of completions for Emacs 28
+;; (setq completions-group t)
+;; (setq completions-group-sort nil)
+;; (setq completions-group-format
+;; (concat
+;; (propertize " " 'face 'completions-group-separator)
+;; (propertize " %s " 'face 'completions-group-title)
+;; (propertize " " 'face 'completions-group-separator
+;; 'display '(space :align-to right))))
+;;
+;; (setq enable-recursive-minibuffers t)
+;; (setq read-answer-short t)
+;; (setq read-buffer-completion-ignore-case t)
+;; (setq read-file-name-completion-ignore-case t)
+;; (setq resize-mini-windows t)
+;; (setq minibuffer-eldef-shorten-default t)
+;;
+;; (file-name-shadow-mode 1)
+;; (minibuffer-depth-indicate-mode 1)
+;; (minibuffer-electric-default-mode 1)
+;;
+;; (defun vde/focus-minibuffer ()
+;; "Focus the active minibuffer.
+;;
+;; Bind this to `completion-list-mode-map' to M-v to easily jump
+;; between the list of candidates present in the \\*Completions\\*
+;; buffer and the minibuffer (because by default M-v switches to the
+;; completions if invoked from inside the minibuffer."
+;; (interactive)
+;; (let ((mini (active-minibuffer-window)))
+;; (when mini
+;; (select-window mini))))
+;;
+;; (defun vde/focus-minibuffer-or-completions ()
+;; "Focus the active minibuffer or the \\*Completions\\*.
+;;
+;; If both the minibuffer and the Completions are present, this
+;; command will first move per invocation to the former, then the
+;; latter, and then continue to switch between the two.
+;;
+;; The continuous switch is essentially the same as running
+;; `vde/focus-minibuffer' and `switch-to-completions' in
+;; succession."
+;; (interactive)
+;; (let* ((mini (active-minibuffer-window))
+;; (completions (get-buffer-window "*Completions*")))
+;; (cond ((and mini
+;; (not (minibufferp)))
+;; (select-window mini nil))
+;; ((and completions
+;; (not (eq (selected-window)
+;; completions)))
+;; (select-window completions nil)))))
+;;
+;; ;; Technically, this is not specific to the minibuffer, but I define
+;; ;; it here so that you can see how it is also used from inside the
+;; ;; "Completions" buffer
+;; (defun vde/describe-symbol-at-point (&optional arg)
+;; "Get help (documentation) for the symbol at point.
+;;
+;; With a prefix argument, switch to the *Help* window. If that is
+;; already focused, switch to the most recently used window
+;; instead."
+;; (interactive "P")
+;; (let ((symbol (symbol-at-point)))
+;; (when symbol
+;; (describe-symbol symbol)))
+;; (when current-prefix-arg
+;; (let ((help (get-buffer-window "*Help*")))
+;; (when help
+;; (if (not (eq (selected-window) help))
+;; (select-window help)
+;; (select-window (get-mru-window)))))))
+;;
+;; ;; Defines, among others, aliases for common actions to Super-KEY.
+;; ;; Normally these should go in individual package declarations, but
+;; ;; their grouping here makes things easier to understand.
+;; :bind (("M-v" . vde/focus-minibuffer-or-completions)
+;; :map completion-list-mode-map
+;; ("h" . vde/describe-symbol-at-point)
+;; ("n" . next-line)
+;; ("p" . previous-line)
+;; ("f" . next-completion)
+;; ("b" . previous-completion)
+;; ("M-v" . vde/focus-minibuffer)))
+;;
+;; (use-package vertico
+;; :unless noninteractive
+;; :config
+;; (setq vertico-scroll-margin 0)
+;; (setq vertico-count 10)
+;; (setq vertico-resize nil)
+;; (setq vertico-cycle t)
+;; (vertico-mode))
+;;
+;; (use-package embark
+;; :unless noninteractive
+;; :bind (("C-." . embark-act))
+;; :init
+;; (setq prefix-help-command #'embark-prefix-help-command)
+;; (setq embark-cycle-key "C-."))
+;;
+;; (use-package embark-consult
+;; :after (embark consult))
+;;
+;; (use-package consult
+;; :unless noninteractive
+;; :after minibuffer
+;; :init
+;; ;; Use Consult to select xref locations with preview
+;; (setq xref-show-xrefs-function #'consult-xref
+;; xref-show-definitions-function #'consult-xref)
+;; (setq consult-narrow-key "<") ;; (kbd "C-+")
+;; :config
+;; (consult-customize
+;; consult-ripgrep consult-git-grep consult-grep consult-bookmark consult-xref
+;; consult--source-recent-file consult--source-project-recent-file consult--source-bookmark
+;; :preview-key (kbd "M-."))
+;; (setq consult-async-input-debounce 0.5)
+;; (setq consult-async-input-throttle 0.8)
+;; (setq consult-project-root-function
+;; (lambda ()
+;; (when-let (project (project-current))
+;; (car (project-roots project)))))
+;;
+;; :bind (("M-X" . consult-mode-command)
+;; ("C-c b" . consult-bookmark)
+;; ("C-c k" . consult-kmacro)
+;; ;; C-x bindings (ctl-x-map)
+;; ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
+;; ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
+;; ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
+;; ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
+;; ;; Other custom bindings
+;; ("M-y" . consult-yank-pop) ;; orig. yank-pop
+;; ("<help> a" . consult-apropos) ;; orig. apropos-command
+;; ;; M-g bindings (goto-map)
+;; ("M-g e" . consult-compile-error)
+;; ("M-g g" . consult-goto-line) ;; orig. goto-line
+;; ("M-g M-g" . consult-goto-line) ;; orig. goto-line
+;; ("M-g m" . consult-mark)
+;; ("M-g o" . consult-outline)
+;; ("M-g i" . consult-imenu)
+;; ("M-g I" . consult-imenu-multi)
+;; ;; "live" search
+;; ("M-s s g" . consult-grep)
+;; ("M-s s G" . consult-gip-grep)
+;; ("M-s s r" . consult-ripgrep)
+;; ("M-s l" . consult-line)
+;; ("M-s k" . consult-keep-lines)
+;; ("M-s u" . consult-focus-lines)
+;; ;; Isearch integration
+;; ("M-s e" . consult-isearch)
+;; :map minibuffer-local-completion-map
+;; ("<tab>" . minibuffer-force-complete)
+;; :map isearch-mode-map
+;; ("M-e" . consult-isearch) ;; orig. isearch-edit-string
+;; ("M-s e" . consult-isearch) ;; orig. isearch-edit-string
+;; ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
+;; ("M-s L" . consult-line-multi)))
+;;
+;; (use-package consult-dir
+;; :bind (("C-x C-d" . consult-dir)
+;; :map minibuffer-local-completion-map
+;; ("C-x C-d" . consult-dir)
+;; ("C-x C-j" . consult-dir-jump-file)))
+;;
+;; (use-package corfu
+;; :ensure
+;; ;; Optional customizations
+;; ;; :custom
+;; ;; (corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
+;; ;; (corfu-auto t) ;; Enable auto completion
+;; ;; (corfu-commit-predicate nil) ;; Do not commit selected candidates on next input
+;; ;; (corfu-quit-at-boundary t) ;; Automatically quit at word boundary
+;; ;; (corfu-quit-no-match t) ;; Automatically quit if there is no match
+;; ;; (corfu-preview-current nil) ;; Disable current candidate preview
+;; ;; (corfu-preselect-first nil) ;; Disable candidate preselection
+;; ;; (corfu-echo-documentation nil) ;; Disable documentation in the echo area
+;; ;; (corfu-scroll-margin 5) ;; Use scroll margin
+;;
+;; ;; You may want to enable Corfu only for certain modes.
+;; ;; :hook ((prog-mode . corfu-mode)
+;; ;; (shell-mode . corfu-mode)
+;; ;; (eshell-mode . corfu-mode))
+;;
+;; ;; Recommended: Enable Corfu globally. This is recommended since dabbrev can
+;; ;; be used globally (M-/).
+;; :hook (((prog-mode tex-mode) . corfu-mode) ; text-mode
+;; ((shell-mode eshell-mode) . my/corfu-shell-settings))
+;; :bind (:map corfu-map
+;; ("TAB" . corfu-next)
+;; ([tab] . corfu-next)
+;; ("S-TAB" . corfu-previous)
+;; ([backtab] . corfu-previous)
+;; ("M-." . corfu-show-location)
+;; ("C-n" . nil)
+;; ("C-p" . nil)
+;; ("M-h" . nil)
+;; ("C-h" . corfu-show-documentation))
+;; :config
+;; (setq corfu-auto nil
+;; corfu-cycle t
+;; corfu-quit-no-match t
+;; corfu-preselect-first nil
+;; corfu-quit-at-boundary nil
+;; corfu-scroll-margin 5)
+;; (defun my/corfu-shell-settings ()
+;; (setq-local corfu-quit-at-boundary t
+;; corfu-quit-no-match t
+;; corfu-auto nil)
+;; (setq-local corfu-map (copy-keymap corfu-map)
+;; completion-cycle-threshold nil)
+;; (define-key corfu-map "\r" #'corfu-insert-and-send)
+;; (corfu-mode))
+;; (defun corfu-insert-and-send ()
+;; (interactive)
+;; ;; 1. First insert the completed candidate
+;; (corfu-insert)
+;; ;; 2. Send the entire prompt input to the shell
+;; (cond
+;; ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
+;; (eshell-send-input))
+;; ((derived-mode-p 'comint-mode)
+;; (comint-send-input)))))
+;;
+;; (use-package kind-icon
+;; :ensure t
+;; :after corfu
+;; :custom
+;; (kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly
+;; :config
+;; (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
+;;
+;; ;; Add extensions
+;; (use-package cape
+;; :ensure
+;; :bind (("C-c p i" . cape-ispell)
+;; ("C-c p f" . cape-file)
+;; ("C-c p /" . cape-dabbrev)
+;; ("C-c p w" . cape-dict)
+;; ("C-c p k" . cape-keyword)
+;; ("C-c p s" . cape-symbol))
+;; :init
+;; ;; Add `completion-at-point-functions', used by `completion-at-point'.
+;; (add-to-list 'completion-at-point-functions #'cape-file)
+;; (add-to-list 'completion-at-point-functions #'cape-tex)
+;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
+;; (add-to-list 'completion-at-point-functions #'cape-keyword)
+;; (add-to-list 'completion-at-point-functions #'cape-symbol)
+;; :config
+;; (setq cape-dict-file "/usr/share/dict/words")
+;;
+;; (use-package pcomplete
+;; :defer
+;; :config
+;; ;; Silence the pcomplete capf, no errors or messages!
+;; (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
+;; ;; (advice-remove 'pcomplete-completions-at-point #'cape-wrap-silent)
+;;
+;; ;; Ensure that pcomplete does not write to the buffer
+;; ;; and behaves as a pure `completion-at-point-function'.
+;; (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
+;; ;; (advice-remove 'pcomplete-completions-at-point #'cape-wrap-purify)
+;; ))
+
+(provide 'config-completion)
+;;; config-completion.el ends here
tools/emacs/old-config/config-dired.el
@@ -0,0 +1,229 @@
+;;; config-dired.el -- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Configuration of Dired
+;;; Code:
+
+;; UseDired
+;; (use-package dired
+;; :unless noninteractive
+;; :commands (dired find-name-dired)
+;; :bind (("C-c RET" . vde/open-in-external-app)
+;; ("C-c f g" . vde/dired-get-size)
+;; ("M-s d" . vde/dired-fd-dirs)
+;; ("M-s z" . vde/dired-fd-files-and-dirs)
+;; ("C-c f f" . find-name-dired)
+;; (:map dired-mode-map
+;; ("M-p" . vde/dired-up)
+;; ("^" . vde/dired-up)
+;; ("<backspace>" . vde/dired-up)
+;; ("M-n" . vde/dired-down)
+;; ("RET" . find-file-reuse-dir-buffer)
+;; ("!" . vde/sudired)
+;; ("<prior>" . beginend-dired-mode-goto-beginning)
+;; ("<next>" . beginend-dired-mode-goto-end)))
+;; :config
+;; (setq-default dired-auto-revert-buffer t
+;; dired-recursive-copies 'always
+;; dired-recursive-deletes 'always
+;; dired-isearch-filenames 'dwim
+;; delete-by-moving-to-trash t
+;; dired-listing-switches "-lFaGh1v --group-directories-first"
+;; dired-ls-F-marks-symlinks t
+;; dired-dwim-target t)
+;; (when (string= system-type "darwin")
+;; (setq dired-use-ls-dired t
+;; insert-directory-program "/usr/local/bin/gls"))
+;;
+;; ;; Enable dired-find-alternate-file
+;; (put 'dired-find-alternate-file 'disabled nil)
+;;
+;; ;; Handle long file names
+;; (add-hook 'dired-mode-hook #'toggle-truncate-lines)
+;;
+;; (defun vde/dired-up ()
+;; "Go to previous directory."
+;; (interactive)
+;; (find-alternate-file ".."))
+;;
+;; (defun vde/dired-down ()
+;; "Enter directory."
+;; (interactive)
+;; (dired-find-alternate-file))
+;;
+;; (defun vde/open-in-external-app ()
+;; "Open the file(s) at point with an external application."
+;; (interactive)
+;; (let* ((file-list
+;; (dired-get-marked-files)))
+;; (mapc
+;; (lambda (file-path)
+;; (let ((process-connection-type nil))
+;; (start-process "" nil "xdg-open" file-path))) file-list)))
+;;
+;; (defun find-file-reuse-dir-buffer ()
+;; "Like `dired-find-file', but reuse Dired buffers."
+;; (interactive)
+;; (set-buffer-modified-p nil)
+;; (let ((file (dired-get-file-for-visit)))
+;; (if (file-directory-p file)
+;; (find-alternate-file file)
+;; (find-file file))))
+;;
+;; (defun vde/sudired ()
+;; "Open directory with sudo in Dired."
+;; (interactive)
+;; (require 'tramp)
+;; (let ((dir (expand-file-name default-directory)))
+;; (if (string-match "^/sudo:" dir)
+;; (user-error "Already in sudo")
+;; (dired (concat "/sudo::" dir)))))
+;;
+;; (defun vde/dired-get-size ()
+;; "Quick and easy way to get file size in Dired."
+;; (interactive)
+;; (let ((files (dired-get-marked-files)))
+;; (with-temp-buffer
+;; (apply 'call-process "du" nil t nil "-sch" files)
+;; (message
+;; "Size of all marked files: %s"
+;; (progn
+;; (re-search-backward "\\(^[0-9.,]+[A-Za-z]+\\).*total$")
+;; (match-string 1))))))
+;; (defmacro vde/dired-fd (name doc prompt &rest flags)
+;; "Make commands for selecting 'fd' results with completion.
+;; NAME is how the function should be named. DOC is the function's
+;; documentation string. PROMPT describes the scope of the query.
+;; FLAGS are the command-line arguments passed to the 'fd'
+;; executable, each of which is a string."
+;; `(defun ,name (&optional arg)
+;; ,doc
+;; (interactive "P")
+;; (let* ((vc (vc-root-dir))
+;; (dir (expand-file-name (if vc vc default-directory)))
+;; (regexp (read-regexp
+;; (format "%s matching REGEXP in %s: " ,prompt
+;; (propertize dir 'face 'bold))))
+;; (names (process-lines "fd" ,@flags regexp dir))
+;; (buf "*FD Dired*"))
+;; (if names
+;; (if arg
+;; (dired (cons (generate-new-buffer-name buf) names))
+;; (icomplete-vertical-do ()
+;; (find-file
+;; (completing-read (format "Items matching %s (%s): "
+;; (propertize regexp 'face 'success)
+;; (length names))
+;; names nil t)))))
+;; (user-error (format "No matches for « %s » in %s" regexp dir)))))
+;;
+;; (vde/dired-fd
+;; vde/dired-fd-dirs
+;; "Search for directories in VC root or PWD.
+;; With \\[universal-argument] put the results in a `dired' buffer.
+;; This relies on the external 'fd' executable."
+;; "Subdirectories"
+;; "-i" "-H" "-a" "-t" "d" "-c" "never")
+;;
+;; (vde/dired-fd
+;; vde/dired-fd-files-and-dirs
+;; "Search for files and directories in VC root or PWD.
+;; With \\[universal-argument] put the results in a `dired' buffer.
+;; This relies on the external 'fd' executable."
+;; "Files and dirs"
+;; "-i" "-H" "-a" "-t" "d" "-t" "f" "-c" "never")
+;; )
+;;
+;; (use-package find-dired
+;; :after dired
+;; :commands (find-name-dired)
+;; :config
+;; (setq-default find-ls-option ;; applies to `find-name-dired'
+;; '("-ls" . "-AFhlv --group-directories-first")
+;; find-name-arg "-iname"))
+;;
+;; (use-package dired-x
+;; :after dired
+;; :bind ("C-x C-j" . dired-jump)
+;; :commands (dired-jump dired-omit-mode)
+;; :config
+;; (setq-default dired-omit-files (concat dired-omit-files "\\|^\\.+$\\|^\\..+$")
+;; dired-omit-verbose nil
+;; dired-clean-confirm-killing-deleted-buffers nil))
+;;
+;; (use-package dired-aux
+;; :unless noninteractive
+;; :after dired
+;; :config
+;; (setq-default
+;; ;; Ask for creation of missing directories when copying/moving
+;; dired-create-destination-dirs 'ask
+;; ;; Search only file names when point is on a file name
+;; dired-isearch-filenames'dwim))
+;;
+;; (use-package dired-collapse
+;; :unless noninteractive
+;; :commands (dired-collapse-mode)
+;; :hook (dired-mode . dired-collapse-mode))
+;;
+;; (use-package async)
+;; (use-package dired-async
+;; :unless noninteractive
+;; :after (dired async)
+;; :commands (dired-async-mode)
+;; :hook (dired-mode . dired-async-mode))
+;;
+;; (use-package dired-narrow
+;; :unless noninteractive
+;; :after dired
+;; :commands (dired-narrow)
+;; :bind (:map dired-mode-map
+;; ("M-s n" . dired-narrow))
+;; :config
+;; (setq-default dired-narrow-exit-when-one-left t
+;; dired-narrow-enable-blinking t
+;; dired-narrow-blink-time 0.3))
+;;
+;; (use-package wdired
+;; :unless noninteractive
+;; :after dired
+;; :commands (wdired-mode
+;; wdired-change-to-wdired-mode)
+;; :config
+;; (setq-default wdired-allow-to-change-permissions t
+;; wdired-create-parent-directories t))
+;;
+;; (use-package dired-rsync
+;; :unless noninteractive
+;; :after dired
+;; :commands (dired-rsync)
+;; :bind (:map dired-mode-map
+;; ("r" . dired-rsync)))
+;;
+;; (use-package dired-subtree
+;; :unless noninteractive
+;; :after dired
+;; :config
+;; (setq dired-subtree-use-backgrounds nil)
+;; :bind (:map dired-mode-map
+;; ("<tab>" . dired-subtree-toggle)
+;; ("<C-tab>" . dired-subtree-cycle)
+;; ("<S-iso-lefttab>" . dired-subtree-remove)))
+;;
+;; (use-package diredfl
+;; :unless noninteractive
+;; :commands (diredfl-mode)
+;; :config
+;; (setq diredfl-ignore-compressed-flag nil)
+;; :hook (dired-mode . diredfl-mode))
+;;
+;; (use-package trashed
+;; :unless noninteractive
+;; :commands (trashed)
+;; :config
+;; (setq trashed-action-confirmer 'y-or-n-p)
+;; (setq trashed-use-header-line t)
+;; (setq trashed-sort-key '("Date deleted" . t))
+;; (setq trashed-date-format "%Y-%m-%d %H:%M:%S"))
+
+(provide 'config-dired)
+;; config-dired.el ends here
tools/emacs/old-config/config-editing.el
@@ -0,0 +1,306 @@
+;;; config-editing.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Editing configuration
+;;; Code:
+
+(setq-default enable-remote-dir-locals t)
+
+;; When finding file in non-existing directory, offer to create the
+;; parent directory.
+(defun with-buffer-name-prompt-and-make-subdirs ()
+ (let ((parent-directory (file-name-directory buffer-file-name)))
+ (when (and (not (file-exists-p parent-directory))
+ (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory)))
+ (make-directory parent-directory t))))
+
+(add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs)
+
+;; Fix long line "problems"
+;; Disable some right-to-left behavior that might not be needed.
+;; Learning arabic might make me change this, but for now..
+(setq-default bidi-paragraph-direction 'left-to-right)
+(if (version<= "27.1" emacs-version)
+ (setq bidi-inhibit-bpa t))
+;; Detect if the line in a buffer are so long they could have a performance impact
+(if (version<= "27.1" emacs-version)
+ (global-so-long-mode 1))
+
+(use-package saveplace
+ :unless noninteractive
+ :config
+ (save-place-mode 1))
+
+;; (use-package smartparens
+;; :unless noninteractive
+;; :commands (smartparens-mode smartparens-global-mode show-smartparens-global-mode
+;; sp-split-sexp sp-newline sp-up-sexp)
+;; :hook ((prog-mode . turn-on-smartparens-mode)
+;; (markdown-mode . turn-on-smartparens-mode)
+;; (org-mode . turn-on-smartparens-mode)
+;; (prog-mode . turn-on-show-smartparens-mode)
+;; (markdown-mode . turn-on-show-smartparens-mode)
+;; (org-mode . turn-on-show-smartparens-mode)
+;; (emacs-lisp-mode . turn-on-smartparens-strict-mode))
+;; :config
+;; (require 'smartparens-config)
+;;
+;; (sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
+;; (sp-local-pair 'web-mode "{%" "%}")
+;; (sp-with-modes '(org-mode)
+;; (sp-local-pair "=" "="))
+;; (sp-with-modes 'emacs-lisp-mode
+;; ;; disable ', it's the quote character!
+;; (sp-local-pair "'" nil :actions nil)
+;; ;; also only use the pseudo-quote inside strings where it
+;; ;; serves as hyperlink.
+;; (sp-local-pair "`" "'" :when '(sp-in-string-p sp-in-comment-p))))
+;;
+;; (use-package color-identifiers-mode
+;; :unless noninteractive
+;; :commands (color-identifiers-mode)
+;; :config
+;; (setq-default color-identifiers:num-colors 15
+;; color-identifiers:min-color-saturation 0.1
+;; color-identifiers:max-color-saturation 0.9)
+;; (defun myfunc-color-identifiers-mode-hook ()
+;; (let ((faces '(font-lock-comment-face font-lock-comment-delimiter-face font-lock-constant-face font-lock-type-face font-lock-function-name-face font-lock-variable-name-face font-lock-keyword-face font-lock-string-face font-lock-builtin-face font-lock-preprocessor-face font-lock-warning-face font-lock-doc-face font-lock-negation-char-face font-lock-regexp-grouping-construct font-lock-regexp-grouping-backslash)))
+;; (dolist (face faces)
+;; (face-remap-add-relative face '((:foreground "" :weight normal :slant normal)))))
+;; (face-remap-add-relative 'font-lock-keyword-face '((:weight bold :slant normal :foreground "#666666")))
+;; (face-remap-add-relative 'font-lock-comment-face '((:slant italic :weight bold :foreground "#333333")))
+;; (face-remap-add-relative 'font-lock-comment-delimiter-face '((:slant italic :weight bold :foreground "#333333")))
+;; (face-remap-add-relative 'font-lock-builtin-face '((:weight bold :foreground "#666666")))
+;; (face-remap-add-relative 'font-lock-preprocessor-face '((:weight bold)))
+;; (face-remap-add-relative 'font-lock-function-name-face '((:underline t)))
+;; (face-remap-add-relative 'font-lock-string-face '((:weight normal :foreground "#333333")))
+;; (face-remap-add-relative 'font-lock-constant-face '((:foreground "#666666" :slant italic))))
+;; (add-hook 'color-identifiers-mode-hook 'myfunc-color-identifiers-mode-hook)
+;; :hook ((go-mode . color-identifiers-mode)
+;; (js-mode . color-identifiers-mode)
+;; (python-mode . color-identifiers-mode)))
+;;
+;; (use-package aggressive-indent
+;; :unless noninteractive
+;; :bind ("C-c e i" . aggressive-indent-mode)
+;; :hook ((lisp-mode . aggressive-indent-mode)
+;; (emacs-lisp-mode . aggressive-indent-mode))
+;; :config
+;; ;; Free C-c C-q, used in Org and in CIDER
+;; (unbind-key "C-c C-q" aggressive-indent-mode-map))
+
+(use-package undo-tree
+ :unless noninteractive
+ :hook (after-init . global-undo-tree-mode)
+ :config
+ (setq-default undo-tree-visualizer-timestamps t
+ undo-tree-enable-undo-in-region t))
+
+;; (use-package whitespace
+;; :unless noninteractive
+;; :commands (whitespace-mode vde/toggle-invisibles)
+;; :config
+;; (setq-default whitespace-style '(face tabs spaces trailing space-before-tab newline indentation empty space-after-tab space-mark tab-mark newline-mark))
+;; (defun vde/toggle-invisibles ()
+;; "Toggles the display of indentation and space characters."
+;; (interactive)
+;; (if (bound-and-true-p whitespace-mode)
+;; (whitespace-mode -1)
+;; (whitespace-mode)))
+;; :bind ("<f6>" . vde/toggle-invisibles))
+;;
+;; (use-package expand-region
+;; :unless noninteractive
+;; :commands (er/expand-region er/contract-region)
+;; :bind (("C-=" . er/expand-region)
+;; ("C--". er/contract-region)))
+;;
+;; (use-package visual-regexp
+;; :unless noninteractive
+;; :commands (vr/replace vr/query-replace)
+;; :bind (("C-c r" . vr/replace)
+;; ("C-c %" . vr/query-replace)))
+;;
+;; (use-package hs-minor-mode
+;; :unless noninteractive
+;; :hook ((prog-mode . hs-minor-mode)))
+;;
+;; (use-package easy-kill
+;; :unless noninteractive
+;; :commands (easy-kill)
+;; :config
+;; (global-set-key [remap kill-ring-save] 'easy-kill)
+;; (global-set-key [remap mark-sexp] 'easy-mark))
+
+(use-package display-line-numbers
+ :unless noninteractive
+ :hook (prog-mode . display-line-numbers-mode)
+ :config
+ (setq-default display-line-numbers-type 'relative)
+ (defun vde/toggle-line-numbers ()
+ "Toggles the display of line numbers. Applies to all buffers."
+ (interactive)
+ (if (bound-and-true-p display-line-numbers-mode)
+ (display-line-numbers-mode -1)
+ (display-line-numbers-mode)))
+ :bind ("<f7>" . vde/toggle-line-numbers))
+
+(add-hook 'prog-mode-hook 'toggle-truncate-lines)
+
+(use-package newcomment
+ :unless noninteractive
+ :config
+ (setq-default comment-empty-lines t
+ comment-fill-column nil
+ comment-multi-line t
+ comment-style 'multi-line)
+ (defun prot/comment-dwim (&optional arg)
+ "Alternative to `comment-dwim': offers a simple wrapper
+around `comment-line' and `comment-dwim'.
+
+If the region is active, then toggle the comment status of the
+region or, if the major mode defines as much, of all the lines
+implied by the region boundaries.
+
+Else toggle the comment status of the line at point."
+ (interactive "*P")
+ (if (use-region-p)
+ (comment-dwim arg)
+ (save-excursion
+ (comment-line arg))))
+
+ :bind (("C-;" . prot/comment-dwim)
+ ("C-:" . comment-kill)
+ ("M-;" . comment-indent)
+ ("C-x C-;" . comment-box)))
+
+;; FIXME(vdemeester) Do I need on-the-fly spellcheck *or* not ?
+;; (use-package flyspell
+;; :unless noninteractive
+;; :commands (flyspell-prog-mode flyspell-mode)
+;; :hook((text-mode . flyspell-mode)
+;; (prog-mode . flyspell-prog-mode))
+;; :config
+;; (define-key flyspell-mode-map (kbd "C-;") nil)
+;; (setq-default flyspell-issue-message-flag nil
+;; flyspell-issue-welcome-flag nil
+;; ispell-program-name "hunspell"
+;; ispell-local-dictionary "en_GB"
+;; ispell-local-dictionary-alist
+;; '(("en_GB"
+;; "[[:alpha:]]"
+;; "[^[:alpha:]]"
+;; "[']"
+;; nil
+;; ("-d" "en_GB,fr_FR")
+;; nil
+;; utf-8))))
+;;
+;; (use-package emacs
+;; :init
+;; (setq-default tab-always-indent 'complete
+;; tab-width 4
+;; indent-tabs-mode nil))
+
+;; FIXME: enable/disable this through a minor mode
+;; can be enable by default in code, disable in adoc-mode, …
+;; (use-package emacs
+;; :hook (before-save . delete-trailing-whitespace))
+
+(use-package delsel
+ :unless noninteractive
+ :config
+ (delete-selection-mode 1))
+
+(use-package emacs
+ :unless noninteractive
+ :custom
+ (repeat-on-final-keystroke t)
+ (set-mark-command-repeat-pop t)
+ :bind ("M-z" . zap-up-to-char))
+
+(use-package emacs
+ :config
+ (defun prot/new-line-below ()
+ "Create a new line below the current one. Move the point to
+the absolute beginning. Also see `prot/new-line-above'."
+ (interactive)
+ (end-of-line)
+ (newline))
+
+ (defun prot/new-line-above ()
+ "Create a new line above the current one. Move the point to
+the absolute beginning. Also see `prot/new-line-below'."
+ (interactive)
+ (beginning-of-line)
+ (newline)
+ (forward-line -1))
+
+ (defun prot/yank-replace-line-or-region ()
+ "Replace the line at point with the contents of the last
+stretch of killed text. If the region is active, operate over it
+instead. This command can then be followed by the standard
+`yank-pop' (default is bound to M-y)."
+ (interactive)
+ (if (use-region-p)
+ (progn
+ (delete-region (region-beginning) (region-end))
+ (yank))
+ (progn
+ (delete-region (point-at-bol) (point-at-eol))
+ (yank))))
+
+ :bind (("C-S-SPC" . contrib/mark-whole-word)
+ ("<C-return>" . prot/new-line-below)
+ ("<C-S-return>" . prot/new-line-above)
+ ("M-SPC" . cycle-spacing)
+ ("M-o" . delete-blank-lines)
+ ("<C-f6>" . tear-off-window)
+ ("C-S-y" . prot/yank-replace-line-or-region)))
+
+(use-package pdf-tools
+ :unless noninteractive
+ :mode ("\\.pdf\\'" . pdf-view-mode)
+ :config
+ (setq-default pdf-view-display-size 'fit-page)
+ (setq pdf-annot-activate-created-annotations t)
+ (setq pdf-view-midnight-colors '("#ffffff" . "#000000"))
+ (pdf-tools-install :no-query)
+ (require 'pdf-occur))
+
+;; (use-package paste-sbr
+;; :unless noninteractive
+;; :commands (htmlize-paste-it)
+;; :bind ("C-c e p" . htmlize-paste-it))
+
+(use-package scratch
+ :unless noninteractive
+ :commands (scratch)
+ :config
+ (defun vde/scratch-buffer-setup ()
+ "Add contents to `scratch' buffer and name it accordingly.
+If region is active, add its contents to the new buffer."
+ (let* ((mode major-mode)
+ (string (format "Scratch buffer for: %s\n\n" mode))
+ (region (with-current-buffer (current-buffer)
+ (if (region-active-p)
+ (buffer-substring-no-properties
+ (region-beginning)
+ (region-end)))
+ ""))
+ (text (concat string region)))
+ (when scratch-buffer
+ (save-excursion
+ (insert text)
+ (goto-char (point-min))
+ (comment-region (point-at-bol) (point-at-eol)))
+ (forward-line 2))
+ (rename-buffer (format "*Scratch for %s*" mode) t)))
+ :hook (scratch-create-buffer . vde/scratch-buffer-setup)
+ :bind ("C-c s" . scratch))
+
+(use-package subword
+ :diminish
+ :hook (prog-mode-hook . subword-mode))
+
+(provide 'config-editing)
+;;; config-editing.el ends here
tools/emacs/old-config/config-elfeed.el
@@ -0,0 +1,122 @@
+;;; config-elfeed.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Elfeed configuration
+;;; Code:
+
+(use-package elfeed
+ :commands (elfeed)
+ :bind (("C-c x e" . elfeed)
+ :map elfeed-show-mode-map
+ ("q" . 'vde/elfeed-show-quit-window))
+ :init
+ ;; (bind-keys
+ ;; :map elfeed-show-mode-map
+ ;; ([remap elfeed-search-quit-window] 'vde/elfeed-show-quit-window))
+ :config
+ (setq-default elfeed-log-level 'debug
+ elfeed-use-curl 't
+ elfeed-db-directory "~/sync/elfeed/db/"
+ elfeed-db-index "~/sync/elfeed/index")
+
+ (setq elfeed-show-entry-switch #'pop-to-buffer
+ elfeed-show-entry-delete #'delete-window
+ elfeed-show-unique-buffers t)
+
+ (defun vde/elfeed-show-quit-window ()
+ (interactive)
+ (if (window-live-p (get-buffer-window "*elfeed-search*"))
+ (progn
+ (kill-buffer-and-window) ;Don't use quit-window for this
+ (select-window (get-buffer-window "*elfeed-search*")))
+ (kill-buffer (current-buffer))))
+ ;; TODO define what we want for this..
+ ;; TODO also probably handle "quit", on "next", … (if tab)
+ ;; (add-to-list 'display-buffer-alist
+ ;; '("^\\*elfeed-entry-"
+ ;; (display-buffer-below-selected)
+ ;; (direction . bottom)
+ ;; (window-height . 0.70)))
+
+ ;; (add-to-list 'display-buffer-alist
+ ;; `("^\\*elfeed-entry-"
+ ;; (display-buffer-in-tab)
+ ;; (dedicated . t)
+ ;; (tab-name . (lambda (buffer alist)
+ ;; (with-current-buffer buffer
+ ;; (concat "🚀 " (elfeed-feed-title (elfeed-entry-feed elfeed-show-entry))))))
+ ;; (tab-group . "📻 Elfeed")))
+ ;;
+ ;; (add-to-list 'display-buffer-alist
+ ;; `("\\*elfeed-search\\*"
+ ;; (display-buffer-in-tab)
+ ;; (dedicated . t)
+ ;; (tab-name . "📣 Entries")
+ ;; (tab-group . "📻 Elfeed")))
+
+ (elfeed-org)
+ (defun vde/org-elfeed-entry-store-link ()
+ (when elfeed-show-entry
+ (let* ((link (elfeed-entry-link elfeed-show-entry))
+ (title (elfeed-entry-title elfeed-show-entry)))
+ (org-store-link-props
+ :link link
+ :description title)
+ )))
+ (add-hook 'org-store-link-functions
+ 'vde/org-elfeed-entry-store-link)
+
+ (defun elfeed-link-title (entry)
+ "Copy the entry title and URL as org link to the clipboard."
+ (interactive)
+ (let* ((link (elfeed-entry-link entry))
+ (title (elfeed-entry-title entry))
+ (titlelink (org-make-link-string link title))))
+ (when titlelink
+ (kill-new titlelink)
+ (x-set-selection 'PRIMARY titlelink)
+ (message "Yanked: %s" titlelink)))
+ (defun elfeed-show-link-title ()
+ "Copy the current entry title and URL as org link to the clipboard."
+ (interactive)
+ (elfeed-link-title elfeed-show-entry))
+
+ (defun elfeed-show-quick-url-note ()
+ "Fastest way to capture entry link to org agenda from elfeed show mode"
+ (interactive)
+ (elfeed-link-title elfeed-show-entry)
+ (org-capture nil "n")
+ (yank)
+ (org-capture-finalize))
+
+ (defface elfeed-face-tag-reddit
+ '((t :foreground "#ffb9a0"))
+ "This is a custom font face for the F1 tag in Elfeed.")
+
+ (push '(f1 elfeed-face-tag-reddit)
+ elfeed-search-face-alist)
+
+ (defun yt-dl-it (url)
+ "Downloads the URL in an async shell"
+ (let ((default-directory "~/desktop/videos"))
+ (async-shell-command (format "youtube-dl \"%s\"" url))))
+
+ (defun elfeed-youtube-dl (&optional use-generic-p)
+ "Youtube-DL link"
+ (interactive "P")
+ (let ((entries (elfeed-search-selected)))
+ (cl-loop for entry in entries
+ do (elfeed-untag entry 'unread)
+ when (elfeed-entry-link entry)
+ do (yt-dl-it it))
+ (mapc #'elfeed-search-update-entry entries)
+ (unless (use-region-p) (forward-line))))
+
+ (define-key elfeed-search-mode-map (kbd "d") 'elfeed-youtube-dl)
+
+ (use-package elfeed-org
+ :commands (elfeed-org)
+ :config
+ (setq-default rmh-elfeed-org-files (list (expand-file-name "feeds.org" org-private-notes-dir)))))
+
+(provide 'config-elfeed)
+;;; config-elfeed.el ends here
tools/emacs/old-config/config-files.el
@@ -0,0 +1,87 @@
+;;; config-files.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Files related configurations
+;;; Code:
+
+(use-package autoinsert
+ :init
+ (setq-default auto-insert-query nil
+ auto-insert-alist nil)
+ :config
+ (auto-insert-mode 1))
+
+(use-package files
+ :commands (revert-buffer)
+ :bind (("<f5>" . revert-buffer))
+ :config
+ (setq-default view-read-only t))
+
+(use-package envrc
+ :defer 2
+ :if (executable-find "direnv")
+ :bind (:map envrc-mode-map
+ ("C-c d" . envrc-command-map))
+ :config (envrc-global-mode))
+
+(use-package hardhat
+ :init (global-hardhat-mode))
+
+(use-package highlight-indentation
+ :unless noninteractive
+ :commands (highlight-indentation-mode highlight-indentation-current-column-mode)
+ :config
+ (set-face-background 'highlight-indentation-face "#e3e3d3")
+ (set-face-background 'highlight-indentation-current-column-face "#c3b3b3"))
+
+(defun vde/delete-this-file ()
+ "Delete the current file, and kill the buffer."
+ (interactive)
+ (or (buffer-file-name) (error "No file is currently being edited"))
+ (when (yes-or-no-p (format "Really delete '%s'?"
+ (file-name-nondirectory buffer-file-name)))
+ (delete-file (buffer-file-name))
+ (kill-this-buffer)))
+
+(defun vde/rename-this-file-and-buffer (new-name)
+ "Renames both current buffer and file it's visiting to NEW-NAME."
+ (interactive "sNew name: ")
+ (let ((name (buffer-name))
+ (filename (buffer-file-name)))
+ (unless filename
+ (error "Buffer '%s' is not visiting a file!" name))
+ (if (get-buffer new-name)
+ (message "A buffer named '%s' already exists!" new-name)
+ (progn
+ (when (file-exists-p filename)
+ (rename-file filename new-name 1))
+ (rename-buffer new-name)
+ (set-visited-file-name new-name)))))
+
+(bind-key "C-c f D" #'vde/delete-this-file)
+(bind-key "C-c f R" #'vde/rename-this-file-and-buffer)
+
+;; Additional bindings for built-ins
+(bind-key "C-c f v d" #'add-dir-local-variable)
+(bind-key "C-c f v l" #'add-file-local-variable)
+(bind-key "C-c f v p" #'add-file-local-variable-prop-line)
+
+(defun vde/reload-dir-locals-for-current-buffer ()
+ "Reload dir locals for the current buffer."
+ (interactive)
+ (let ((enable-local-variables :all))
+ (hack-dir-local-variables-non-file-buffer)))
+
+(defun vde/reload-dir-locals-for-all-buffers-in-this-directory ()
+ "Reload dir-locals for all buffers in current buffer's `default-directory'."
+ (interactive)
+ (let ((dir default-directory))
+ (dolist (buffer (buffer-list))
+ (with-current-buffer buffer
+ (when (equal default-directory dir))
+ (vde/reload-dir-locals-for-current-buffer)))))
+
+(bind-key "C-c f v r" #'vde/reload-dir-locals-for-current-buffer)
+(bind-key "C-c f v r" #'vde/reload-dir-locals-for-all-buffers-in-this-directory)
+
+(provide 'config-files)
+;;; config-files.el ends here
tools/emacs/old-config/config-keybindings.el
@@ -0,0 +1,14 @@
+;;; config-keybindings.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Key binding specific configuration
+;;; Code:
+
+;; Disable C-x C-n to avoid the disabled command buffer
+(unbind-key "C-x C-n" global-map)
+
+;; Remap dynamic-abbrev to hippie-expand
+;; See https://www.masteringemacs.org/article/text-expansion-hippie-expand
+;; (global-set-key [remap dabbrev-expand] 'hippie-expand)
+;;
+;; (provide 'config-keybindings)
+;; ;;; config-keybindings.el ends here
tools/emacs/config/config-mails.el → tools/emacs/old-config/config-mails.el
File renamed without changes
tools/emacs/old-config/config-misc.el
@@ -0,0 +1,17 @@
+;;; config-misc.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Miscellaneous modes configuration
+;;; Code:
+
+(use-package helpful
+ :unless noninteractive
+ :bind (("C-h f" . helpful-callable)
+ ("C-h F" . helpful-function)
+ ("C-h M" . helpful-macro)
+ ("C-c h S" . helpful-at-point)
+ ("C-h k" . helpful-key)
+ ("C-h v" . helpful-variable)
+ ("C-h C" . helpful-command)))
+
+(provide 'config-misc)
+;;; config-misc.el ends here
tools/emacs/old-config/config-mouse.el
@@ -0,0 +1,20 @@
+;;; config-mouse.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Mouse configuration
+;;; Code:
+
+(use-package mouse
+ :unless noninteractive
+ :config
+ (setq mouse-wheel-scroll-amount
+ '(1
+ ((shift) . 5)
+ ((meta) . 0.5)
+ ((control) . text-scale)))
+ (setq make-pointer-invisible t
+ mouse-wheel-progressive-speed t
+ mouse-wheel-follow-mouse t)
+ :hook (after-init . mouse-wheel-mode))
+
+(provide 'config-mouse)
+;;; config-mouse.el ends here
tools/emacs/old-config/config-music.el
@@ -0,0 +1,40 @@
+;;; config-music.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Music configuration
+;;; Code:
+
+;; (use-package bongo
+;; :commands (bongo bongo-show)
+;; :bind (("C-c x b" . bongo)
+;; ("<C-XF86AudioPlay>" . bongo-pause/resume)
+;; ("<C-XF86AudioNext>" . bongo-next)
+;; ("<C-XF86AudioPrev>" . bongo-previous)
+;; ("<M-XF86AudioPlay>" . bongo-show)
+;; ("<S-XF86AudioNext>" . bongo-seek-forward-10)
+;; ("<S-XF86AudioPrev>" . bongo-seek-backward-10))
+;; :config
+;; (setq-default bongo-audio-file-name-extensions
+;; '("669" "aac" "amf" "apun" "au" "dsm" "far" "flac" "g18" "g36" "gdm"
+;; "imf" "it" "mdz" "med" "mid" "midi" "mka" "mod" "m4a" "mp2" "mp3"
+;; "mtm" "ogg" "oga ""opus" "okt" "r36" "ra" "rcp" "rmi" "s3m" "spx"
+;; "stm" "stx" "ult" "umx" "uni" "vqf" "wav" "wma" "xm")
+;; bongo-custom-backend-matchers
+;; '((mpv local-file "m4a")
+;; (mpv local-file "oga")
+;; (mpv local-file "opus"))
+;; bongo-default-directory "/net/sakhalin.home/export/gaia/music"
+;; bongo-prefer-library-buffers nil
+;; bongo-insert-whole-directory-trees t
+;; bongo-logo nil
+;; bongo-display-track-icons nil
+;; bongo-display-track-lengths nil
+;; bongo-display-header-icons nil
+;; bongo-display-playback-mode-indicator t
+;; bongo-display-inline-playback-progress nil
+;; bongo-join-inserted-tracks nil
+;; bongo-field-separator (propertize " · " 'face 'shadow))
+;; (bongo-mode-line-indicator-mode -1)
+;; (bongo-header-line-mode -1))
+
+(provide 'config-music)
+;;; config-music ends here
tools/emacs/config/config-org.el → tools/emacs/old-config/config-org.el
File renamed without changes
tools/emacs/old-config/config-projects.el
@@ -0,0 +1,77 @@
+;;; config-projects.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Project related configuration.
+;;; Code:
+
+(use-package project
+ :bind (("C-x p v" . vde-project-magit-status)
+ ("C-x p s" . vde-project-vterm)
+ ("C-x p X" . vde/run-in-project-vterm))
+ :config
+
+ (setq vde/project-local-identifier '(".project")) ;; "go.mod"
+ (setq project-switch-commands
+ '((?f "File" project-find-file)
+ (?g "Grep" project-find-regexp)
+ (?d "Dired" project-dired)
+ (?b "Buffer" project-switch-to-buffer)
+ (?q "Query replace" project-query-replace-regexp)
+ (?m "Magit" vde-project-magit-status)
+ (?e "Eshell" project-eshell)
+ (?s "Vterm" vde-project-vterm)))
+
+ (defun vde/project-try-local (dir)
+ "Determine if DIR is a non-VC project."
+ (if-let ((root (if (listp vde/project-local-identifier)
+ (seq-some (lambda (n)
+ (locate-dominating-file dir n))
+ vde/project-local-identifier)
+ (locate-dominating-file dir vde/project-local-identifier))))
+ (cons 'local root)))
+ (cl-defmethod project-root ((project (head local)))
+ (cdr project))
+
+ (cl-defmethod project-root ((project (eql nil))) nil)
+
+ (add-hook 'project-find-functions #'vde/project-try-local)
+
+ :init
+ (setq-default project-compilation-buffer-name-function 'project-prefixed-buffer-name)
+ (defun vde-project--project-current ()
+ "Return directory from `project-current' based on Emacs version."
+ (if (>= emacs-major-version 29)
+ (project-root (project-current))
+ (cdr (project-current))))
+ (defun vde-project-magit-status ()
+ "Run `magit-status' on project."
+ (interactive)
+ (magit-status (vde-project--project-current)))
+
+ (defun vde-project-vterm (&optional command)
+ "Run `vterm' on project.
+If a buffer already exists for running a vterm shell in the project's root,
+switch to it. Otherwise, create a new vterm shell."
+ (interactive)
+ (let* ((default-directory (vde-project--project-current))
+ (default-project-vterm-name (project-prefixed-buffer-name "vterm"))
+ (vterm-buffer (get-buffer default-project-vterm-name)))
+ (if (and vterm-buffer (not current-prefix-arg))
+ (pop-to-buffer-same-window vterm-buffer)
+ (let* ((cd-cmd (concat " cd " (shell-quote-argument default-directory))))
+ (vterm default-project-vterm-name)
+ (with-current-buffer vterm-buffer
+ (vterm-send-string cd-cmd)
+ (vterm-send-return))))
+ (when command
+ (vterm-send-string command)
+ (vterm-send-return))))
+ (defun vde/run-in-project-vterm ()
+ (interactive)
+ (let* ((default-directory (vde-project--project-current))
+ (default-project-vterm-name (project-prefixed-buffer-name "vterm"))
+ (vterm-buffer (get-buffer default-project-vterm-name)))
+ (vde-project-vterm (read-string "Command: "))))
+ )
+
+(provide 'config-projects)
+;;; config-projects.el ends here
tools/emacs/old-config/config-search.el
@@ -0,0 +1,111 @@
+;;; config-search.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Search related configuration
+;;; Code:
+
+;; UseISearch
+(use-package isearch
+ :unless noninteractive
+ :config
+ (setq-default search-whitespace-regexp ".*?"
+ isearch-lax-whitespace t
+ isearch-regexp-lax-whitespace nil)
+ (defun stribb/isearch-region (&optional not-regexp no-recursive-edit)
+ "If a region is active, make this the isearch default search
+pattern."
+ (interactive "P\np")
+ (when (use-region-p)
+ (let ((search (buffer-substring-no-properties
+ (region-beginning)
+ (region-end))))
+ (message "stribb/ir: %s %d %d" search (region-beginning) (region-end))
+ (setq deactivate-mark t)
+ (isearch-yank-string search))))
+ (advice-add 'isearch-forward-regexp :after 'stribb/isearch-region)
+ (advice-add 'isearch-forward :after 'stribb/isearch-region)
+ (advice-add 'isearch-backward-regexp :after 'stribb/isearch-region)
+ (advice-add 'isearch-backward :after 'stribb/isearch-region)
+
+ (defun contrib/isearchp-remove-failed-part-or-last-char ()
+ "Remove failed part of search string, or last char if successful.
+Do nothing if search string is empty to start with."
+ (interactive)
+ (if (equal isearch-string "")
+ (isearch-update)
+ (if isearch-success
+ (isearch-delete-char)
+ (while (isearch-fail-pos) (isearch-pop-state)))
+ (isearch-update)))
+
+ (defun contrib/isearch-done-opposite-end (&optional nopush edit)
+ "End current search in the opposite side of the match.
+Particularly useful when the match does not fall within the
+confines of word boundaries (e.g. multiple words)."
+ (interactive)
+ (funcall #'isearch-done nopush edit)
+ (when isearch-other-end (goto-char isearch-other-end)))
+ :bind (("M-s M-o" . multi-occur)
+ :map isearch-mode-map
+ ("DEL" . contrib/isearchp-remove-failed-part-or-last-char)
+ ("<C-return>" . contrib/isearch-done-opposite-end)))
+;; -UseISearch
+
+;; UseGrep
+(use-package grep
+ :commands (find-grep grep find-grep-dired find-name-dired)
+ :bind (("M-s n" . find-name-dired)
+ ("M-s F" . find-grep)
+ ("M-s G" . grep)
+ ("M-s d" . find-grep-dired))
+ :hook ((hook-mode . toggle-truncate-lines))
+ :config
+ (setq-default grep-template (string-join '("ugrep"
+ "--color=always"
+ "--ignore-binary"
+ "--ignore-case"
+ "--include=<F>"
+ "--line-number"
+ "--null"
+ "--recursive"
+ "--regexp=<R>")
+ " "))
+ (add-to-list 'grep-find-ignored-directories "auto")
+ (add-to-list 'grep-find-ignored-directories "elpa"))
+;; -UseGrep
+
+;; UseWgrep
+(use-package wgrep
+ :unless noninteractive
+ :commands (wgrep-change-to-wgrep-mode)
+ :defer 2
+ :custom
+ (wgrep-auto-save-buffer t)
+ (wgrep-change-readonly-file t))
+;; -UseWgrep
+
+;; UseRG
+(use-package rg
+ :if *rg*
+ :commands (rg rg-project rg-dwim)
+ :bind (("M-s r r" . rg)
+ ("M-s r p" . rg-project)
+ ("M-s r s" . rg-dwim))
+ :config
+ (setq rg-group-result t)
+ (setq rg-hide-command t)
+ (setq rg-show-columns nil)
+ (setq rg-show-header t)
+ (setq rg-default-alias-fallback "all")
+ (cl-pushnew '("tmpl" . "*.tmpl") rg-custom-type-aliases)
+ (cl-pushnew '("gotest" . "*_test.go") rg-custom-type-aliases)
+ (defun vde/rg-buffer-name ()
+ "Generate a rg buffer name from projectile if bound"
+ (cond ((boundp 'projectile-project-name) (if (string-equal (projectile-project-name) "-")
+ "rg"
+ (format "rg: %s" (projectile-project-name))))
+ (t "rg")))
+ (setq rg-buffer-name #'vde/rg-buffer-name))
+;; -UseRG
+
+(provide 'config-search)
+;;; config-search.el ends here
tools/emacs/old-config/config-shells.el
@@ -0,0 +1,401 @@
+;;; config-shells.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Shell scripting
+;;; Code:
+
+(use-package shell
+ :commands (shell)
+ :bind (("<f1>" . shell)
+ (:map shell-mode-map
+ ("<tab>" . completion-at-point)))
+ :config
+ (setq-default explicit-shell-file-name "zsh"
+ shell-file-name "zsh")
+ (unbind-key "C-c C-l" shell-mode-map)
+ (bind-key "C-c C-l" #'counsel-shell-history shell-mode-map))
+
+;; TODO: understand and rework eshell completion
+(use-package eshell
+ :commands (eshell eshell-here)
+ :bind* ("C-x m t" . eshell-here)
+ :config
+ (defun eshell-here ()
+ "Open EShell in the directory associated with the current buffer's file.
+The EShell is renamed to match that directory to make multiple windows easier."
+ (interactive)
+ (let* ((parent (if (buffer-file-name)
+ (file-name-directory (buffer-file-name))
+ default-directory))
+ (name (car (last (split-string parent "/" t)))))
+ (eshell "new")
+ (rename-buffer (concat "*eshell: " name "*"))))
+
+ ;; Handy aliases
+ (defalias 'ff 'find-file)
+ (defalias 'emacs 'find-file)
+ (defalias 'e 'find-file)
+ (defalias 'ec 'find-file)
+ (defalias 'd 'dired)
+
+ (defun eshell/gs (&rest args)
+ (magit-status (pop args) nil)
+ (eshell/echo)) ; The echo command suppresses output
+
+ (defun eshell/cdg ()
+ "Change directory to the project's root."
+ (eshell/cd (locate-dominating-file default-directory ".git")))
+
+ (defun eshell/extract (file)
+ "One universal command to extract FILE (for bz2, gz, rar, etc.)"
+ (eshell-command-result (format "%s %s" (cond ((string-match-p ".*\.tar.bz2" file)
+ "tar xzf")
+ ((string-match-p ".*\.tar.gz" file)
+ "tar xzf")
+ ((string-match-p ".*\.bz2" file)
+ "bunzip2")
+ ((string-match-p ".*\.rar" file)
+ "unrar x")
+ ((string-match-p ".*\.gz" file)
+ "gunzip")
+ ((string-match-p ".*\.tar" file)
+ "tar xf")
+ ((string-match-p ".*\.tbz2" file)
+ "tar xjf")
+ ((string-match-p ".*\.tgz" file)
+ "tar xzf")
+ ((string-match-p ".*\.zip" file)
+ "unzip")
+ ((string-match-p ".*\.jar" file)
+ "unzip")
+ ((string-match-p ".*\.Z" file)
+ "uncompress")
+ (t
+ (error "Don't know how to extract %s" file)))
+ file)))
+
+ ;; From https://karthinks.com/software/jumping-directories-in-eshell/
+ (defun eshell/j (&optional regexp)
+ "Navigate to a previously visited directory in eshell, or to
+any directory proferred by `consult-dir'."
+ (let ((eshell-dirs (delete-dups
+ (mapcar 'abbreviate-file-name
+ (ring-elements eshell-last-dir-ring)))))
+ (cond
+ ((and (not regexp) (featurep 'consult-dir))
+ (let* ((consult-dir--source-eshell `(:name "Eshell"
+ :narrow ?e
+ :category file
+ :face consult-file
+ :items ,eshell-dirs))
+ (consult-dir-sources (cons consult-dir--source-eshell
+ consult-dir-sources)))
+ (eshell/cd (substring-no-properties
+ (consult-dir--pick "Switch directory: ")))))
+ (t (eshell/cd (if regexp (eshell-find-previous-directory regexp)
+ (completing-read "cd: " eshell-dirs)))))))
+
+ (add-hook
+ 'eshell-mode-hook
+ (lambda ()
+ (let ((ls (if (executable-find "exa") "exa" "ls")))
+ (eshell/alias "ls" (concat ls " --color=always $*"))
+ (eshell/alias "ll" (concat ls " --color=always -l $*"))
+ (eshell/alias "l" (concat ls " --color=always -lah $*")))
+ (eshell-smart-initialize)
+ (eshell-dirs-initialize)
+ (bind-keys :map eshell-mode-map
+ ("C-c C-l" . counsel-esh-history)
+ ([remap eshell-pcomplete] . completion-at-point)
+ )))
+
+ ;; Use system su/sudo
+ (with-eval-after-load "em-unix"
+ '(progn
+ (unintern 'eshell/su nil)
+ (unintern 'eshell/sudo nil)))
+
+ (add-hook 'eshell-mode-hook #'with-editor-export-editor))
+
+(use-package em-prompt
+ :after eshell
+ :config
+ (defun vde/eshell-quit-or-delete-char (arg)
+ "Use C-d to either delete forward char or exit EShell."
+ (interactive "p")
+ (if (and (eolp) (looking-back eshell-prompt-regexp nil nil))
+ (progn
+ (eshell-life-is-too-much))
+ (delete-char arg)))
+
+ (add-hook 'eshell-mode-hook
+ (lambda ()
+ (bind-key "C-d"
+ #'vde/eshell-quit-or-delete-char eshell-mode-map))))
+
+(use-package esh-mode
+ :disabled
+ :after eshell
+ :bind (:map eshell-mode-map
+ ("<tab>" . vde/esh-mode-completion-at-point))
+ :config
+ (setq-default eshell-scroll-to-bottom-on-input 'all)
+ (defun vde/esh-mode-completion-at-point ()
+ "Same as `completion-at-point' except for some commands."
+ (interactive)
+ ;; unbinding pcomplete/make gives a chance to `bash-completion'
+ ;; to complete make rules. Bash-completion is indeed more
+ ;; powerfull than `pcomplete-make'.
+ (cl-letf (((symbol-function 'pcomplete/make) nil))
+ (completion-at-point))))
+
+(use-package em-smart
+ :after eshell)
+(use-package em-dirs
+ :after eshell)
+
+(use-package em-cmpl
+ :after eshell
+ :hook (eshell-mode . eshell-cmpl-initialize)
+ :config
+ (defun my/eshell-bash-completion ()
+ (let ((bash-completion-nospace t))
+ (while (pcomplete-here
+ (nth 2 (bash-completion-dynamic-complete-nocomint
+ (save-excursion (eshell-bol) (point))
+ (point)))))))
+ (when (require 'bash-completion nil t)
+ (setq eshell-default-completion-function #'my/eshell-bash-completion))
+
+ (add-to-list 'eshell-command-completions-alist
+ '("gunzip" "gz\\'"))
+ (add-to-list 'eshell-command-completions-alist
+ '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'")))
+
+(use-package em-hist
+ :after eshell
+ :config (setq eshell-hist-ignoredups t))
+
+(use-package em-tramp
+ :after eshell)
+
+(use-package em-term
+ :after eshell
+ :config
+ (add-to-list 'eshell-visual-commands "ssh")
+ (add-to-list 'eshell-visual-commands "htop")
+ (add-to-list 'eshell-visual-commands "top")
+ (add-to-list 'eshell-visual-commands "tail")
+ (add-to-list 'eshell-visual-commands "npm")
+ (add-to-list 'eshell-visual-commands "ncdu"))
+
+(use-package em-banner
+ :after eshell
+ :config
+ (setq eshell-banner-message "
+ Welcome to the Emacs
+
+ _/ _/ _/
+ _/_/ _/_/_/ _/_/_/ _/_/ _/ _/
+ _/_/_/_/ _/_/ _/ _/ _/_/_/_/ _/ _/
+ _/ _/_/ _/ _/ _/ _/ _/
+ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/ _/
+
+"))
+
+(use-package eshell-prompt-extras
+ :after eshell
+ :custom
+ (eshell-highlight-prompt nil)
+ (eshell-prompt-function 'vde-theme-lambda)
+ :config
+ (defun vde-kubernetes-current-context ()
+ "Return the current context"
+ (if (not (string-empty-p (getenv "KUBECONFIG")))
+ (epe-trim-newline (shell-command-to-string (concat
+ "env KUBECONFIG="
+ (getenv "KUBECONFIG")
+ " kubectl config current-context")))
+ (epe-trim-newline (shell-command-to-string "kubectl config current-context"))))
+ (defun vde-kubernetes-p ()
+ "If you have kubectl install and a config set,
+using either KUBECONFIG or ~/.kube/config"
+ (and (eshell-search-path "kubectl")
+ (not (string-empty-p (vde-kubernetes-current-context)))
+ (not (string-match-p "error: current-context is not set" (vde-kubernetes-current-context)))))
+ ;; From epe-theme-lambda
+ (defun vde-theme-lambda ()
+ "A eshell-prompt lambda theme."
+ (setq eshell-prompt-regexp "^[^#\nλ]*[#λ] ")
+ (concat
+ (when (epe-remote-p)
+ (epe-colorize-with-face
+ (concat (epe-remote-user) "@" (epe-remote-host) " ")
+ 'epe-remote-face))
+ (when (and epe-show-python-info (bound-and-true-p venv-current-name))
+ (epe-colorize-with-face (concat "(" venv-current-name ") ") 'epe-venv-face))
+ (let ((f (cond ((eq epe-path-style 'fish) 'epe-fish-path)
+ ((eq epe-path-style 'single) 'epe-abbrev-dir-name)
+ ((eq epe-path-style 'full) 'abbreviate-file-name))))
+ (epe-colorize-with-face (funcall f (eshell/pwd)) 'epe-dir-face))
+ (when (epe-git-p)
+ (concat
+ (epe-colorize-with-face ":" 'epe-dir-face)
+ (epe-colorize-with-face
+ (concat (epe-git-branch)
+ (epe-git-dirty)
+ (epe-git-untracked)
+ (let ((unpushed (epe-git-unpushed-number)))
+ (unless (= unpushed 0)
+ (concat ":" (number-to-string unpushed)))))
+ 'epe-git-face)))
+ (when (vde-kubernetes-p)
+ (concat (epe-colorize-with-face " (" 'epe-dir-face)
+ (epe-colorize-with-face (vde-kubernetes-current-context) 'epe-dir-face)
+ (epe-colorize-with-face ")" 'epe-dir-face)))
+ (epe-colorize-with-face " λ" 'epe-symbol-face)
+ (epe-colorize-with-face (if (= (user-uid) 0) "#" "") 'epe-sudo-symbol-face)
+ " ")))
+
+(use-package esh-autosuggest
+ :after eshell
+ :hook (eshell-mode . esh-autosuggest-mode))
+
+(use-package xterm-color
+ :after eshell
+ :init
+ ;; (setq comint-output-filter-functions
+ ;; (remove 'ansi-color-process-output comint-output-filter-functions))
+ (add-hook 'shell-mode-hook
+ (lambda ()
+ ;; Disable font-locking in this buffer to improve performance
+ (font-lock-mode -1)
+ ;; Prevent font-locking from being re-enabled in this buffer
+ (make-local-variable 'font-lock-function)
+ (setq font-lock-function (lambda (_) nil))
+ (add-hook 'comint-preoutput-filter-functions 'xterm-color-filter nil t)))
+ (add-hook 'eshell-before-prompt-hook
+ (lambda ()
+ (setenv "TERM" "xterm-256color")
+ (setq xterm-color-preserve-properties t)))
+ (add-to-list 'eshell-preoutput-filter-functions 'xterm-color-filter)
+ (setq eshell-output-filter-functions (remove 'eshell-handle-ansi-color eshell-output-filter-functions))
+ (setq compilation-environment '("TERM=xterm-256color")))
+
+(use-package vterm
+ :commands (vterm vde/vterm-toggle)
+ :bind (("C-c t v" . vde/vterm-toggle)
+ ("C-c t r" . vde/run-in-vterm))
+ :custom
+ (vterm-kill-buffer-on-exit t)
+ :config
+ (defun vde/vterm-tramp-get-method-parameter (method param)
+ "Return the method parameter PARAM.
+If the `tramp-methods' entry does not exist, return NIL."
+ (let ((entry (assoc param (assoc method tramp-methods))))
+ (when entry (cadr entry))))
+ (add-hook 'vterm-set-title-functions 'vterm--rename-buffer-as-title)
+ ;; TODO: hook into projectile-run-vterm instead
+ ;; Also, look into vterm-toggle way of doing things.. I thing it is trying to be too smart about it..
+ ;; I prefer an easy projectile integration (or projects integration)
+ (defun vde/vterm ()
+ ""
+ (interactive)
+ (let* ((dir (expand-file-name default-directory))
+ cd-cmd cur-host vterm-dir vterm-host cur-user cur-port remote-p cur-method login-cmd)
+ (if (ignore-errors (file-remote-p dir))
+ (with-parsed-tramp-file-name dir nil
+ (setq remote-p t)
+ (setq cur-host host)
+ (setq cur-method (tramp-find-method method user cur-host))
+ (setq cur-user (or (tramp-find-user cur-method user cur-host) ""))
+ (setq cur-port (or port ""))
+ (setq dir localname))
+ (setq cur-host (system-name)))
+ (setq login-cmd (vde/vterm-tramp-get-method-parameter cur-method 'tramp-login-program))
+ (setq cd-cmd (concat " cd " (shell-quote-argument dir)))
+ (setq shell-buffer (format "vterm %s %s" cur-host dir))
+ (if (buffer-live-p shell-buffer)
+ (switch-to-buffer shell-buffer)
+ (progn
+ (message (format "buffer '%s' doesn't exists" shell-buffer))
+ (vterm shell-buffer)
+ (with-current-buffer shell-buffer
+ (message (format "%s" remote-p))
+ (when remote-p
+ (let* ((method (if (string-equal login-cmd "ssh") "ssh" cur-method))
+ (login-opts (vde/vterm-tramp-get-method-parameter method 'tramp-login-args))
+ (login-shell (vde/vterm-tramp-get-method-parameter method 'tramp-remote-shell))
+ (login-shell-args (tramp-get-sh-extra-args login-shell))
+ ;; (vterm-toggle-tramp-get-method-parameter cur-method 'tramp-remote-shell)
+ (spec (format-spec-make
+ ?h cur-host ?u cur-user ?p cur-port ?c ""
+ ?l (concat login-shell " " login-shell-args)))
+ (cmd
+ (concat login-cmd " "
+ (mapconcat
+ (lambda (x)
+ (setq x (mapcar (lambda (y) (format-spec y spec)) x))
+ (unless (member "" x) (string-join x " ")))
+ login-opts " "))))
+ (vterm-send-string cmd)
+ (vterm-send-return)))
+ (vterm-send-string cd-cmd)
+ (vterm-send-return))))))
+ (defun vde/vterm-toggle ()
+ "Toggle between the main vterm buffer and the current buffer.
+If you are in a vterm buffer, switch the window configuration
+back to your code buffers. Otherwise, create at least one vterm
+buffer if it doesn't exist already, and switch to it. On every
+toggle, the current window configuration is saved in a register."
+ (interactive)
+ (if (eq major-mode 'vterm-mode)
+ (jump-to-register ?W)
+ ;; Save current window config and jump to shell
+ (window-configuration-to-register ?W)
+ (condition-case nil
+ (jump-to-register ?Z)
+ (error
+ (vterm)
+ (when (= (length (window-list)) 2)
+ (other-window 1)
+ (vterm 1)
+ (other-window 1))))
+ (window-configuration-to-register ?Z)))
+ (buffer-name)
+ (defun vde/run-in-vterm ()
+ (interactive)
+ (with-current-buffer "vterm"
+ (vterm-send-string (read-string "Command: "))
+ (vterm-send-C-j))))
+
+(use-package multi-vterm
+ :commands (multi-vterm multi-vterm-projectile multi-vterm-dedicated-toggle)
+ :bind (("C-c t t" . multi-vterm-dedicated-toggle)
+ ("C-c t p" . multi-vterm-prev)
+ ("C-c t n" . multi-vterm-next)
+ ("C-c t s" . multi-vterm)))
+;; for fish in ansi-term
+(add-hook 'term-mode-hook 'toggle-truncate-lines)
+
+(use-package tramp
+ :defer t
+ :config
+ (setq-default tramp-use-ssh-controlmaster-options nil ; Don't override SSH config.
+ tramp-default-method "ssh") ; ssh is faster than scp and supports ports.
+ (add-to-list 'tramp-remote-path "/run/current-system/sw/bin")
+ (add-to-list 'tramp-remote-path "/etc/profiles/per-user/root/bin/")
+ (add-to-list 'tramp-remote-path "/etc/profiles/per-user/vincent/bin/")
+ (add-to-list 'tramp-remote-path "~/.nix-profile/bin")
+ (add-to-list 'tramp-remote-path "~/bin")
+ (add-to-list 'tramp-remote-path 'tramp-own-remote-path))
+
+(defun generic-term-init ()
+ (visual-line-mode -1)
+ (setq-local global-hl-line-mode nil)
+ (setq-local scroll-margin 0))
+
+(add-hook 'term-mode-hook #'generic-term-init)
+(add-hook 'shell-mode-hook #'generic-term-init)
+(add-hook 'eshell-mode-hook #'generic-term-init)
+
+(provide 'setup-shells)
tools/emacs/old-config/config-vcs.el
@@ -0,0 +1,207 @@
+;;; config-vcs.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Version control configuration
+;;; Code:
+
+(use-package vc
+ :config
+ (setq-default vc-find-revision-no-save t
+ vc-follow-symlinks t)
+ :bind (("C-x v f" . vc-log-incoming) ; git fetch
+ ("C-x v F" . vc-update)
+ ("C-x v d" . vc-diff)))
+
+(use-package vc-dir
+ :config
+ (defun vde/vc-dir-project ()
+ "Unconditionally display `vc-diff' for the current project."
+ (interactive)
+ (vc-dir (vc-root-dir)))
+
+ (defun vde/vc-dir-jump ()
+ "Jump to present directory in a `vc-dir' buffer."
+ (interactive)
+ (vc-dir default-directory))
+ :bind (("C-x v p" . vde/vc-dir-project)
+ ("C-x v j" . vde/vc-dir-jump) ; similar to `dired-jump'
+ :map vc-dir-mode-map
+ ("f" . vc-log-incoming) ; replaces `vc-dir-find-file' (use RET)
+ ("F" . vc-update) ; symmetric with P: `vc-push'
+ ("d" . vc-diff) ; align with D: `vc-root-diff'
+ ("k" . vc-dir-clean-files)))
+
+(use-package vc-git
+ :config
+ (setq vc-git-diff-switches "--patch-with-stat")
+ (setq vc-git-print-log-follow t))
+
+(use-package vc-annotate
+ :config
+ (setq vc-annotate-display-mode 'scale)
+ :bind (("C-x v a" . vc-annotate)
+ :map vc-annotate-mode-map
+ ("t" . vc-annotate-toggle-annotation-visibility)))
+
+(use-package ediff
+ :commands (ediff ediff-files ediff-merge ediff3 ediff-files3 ediff-merge3)
+ :config
+ (setq ediff-window-setup-function 'ediff-setup-windows-plain)
+ (setq ediff-split-window-function 'split-window-horizontally)
+ (setq ediff-diff-options "-w")
+ (add-hook 'ediff-after-quit-hook-internal 'winner-undo))
+
+(use-package diff
+ :config
+ (setq diff-default-read-only nil)
+ (setq diff-advance-after-apply-hunk t)
+ (setq diff-update-on-the-fly t)
+ (setq diff-refine 'font-lock)
+ (setq diff-font-lock-prettify nil)
+ (setq diff-font-lock-syntax nil))
+
+(use-package magit-popup)
+
+(use-package magit
+ :unless noninteractive
+ :commands (magit-status magit-clone magit-pull magit-blame magit-log-buffer-file magit-log)
+ :bind (("C-c v c" . magit-clone)
+ ("C-c v C" . magit-checkout)
+ ("C-c v b" . magit-branch)
+ ("C-c v d" . magit-dispatch)
+ ("C-c v f" . magit-fetch)
+ ("C-c v g" . magit-blame)
+ ("C-c v l" . magit-log-buffer-file)
+ ("C-c v p" . magit-pull)
+ ("C-c v P" . magit-push)
+ ("C-c v r" . magit-rebase)
+ ("C-c v v" . magit-status))
+ :config
+ (setq-default magit-save-repository-buffers 'dontask
+ magit-refs-show-commit-count 'all
+ magit-branch-prefer-remote-upstream '("main")
+ magit-display-buffer-function #'magit-display-buffer-traditional)
+
+ (magit-define-popup-option 'magit-rebase-popup
+ ?S "Sign using gpg" "--gpg-sign=" #'magit-read-gpg-secret-key)
+ (magit-define-popup-switch 'magit-log-popup
+ ?m "Omit merge commits" "--no-merges")
+ ;; cargo-culted from https://github.com/magit/magit/issues/3717#issuecomment-734798341
+ ;; valid gitlab options are defined in https://docs.gitlab.com/ee/user/project/push_options.html
+ ;;
+ ;; the second argument to transient-append-suffix is where to append
+ ;; to, not sure what -u is, but this works
+ (transient-append-suffix 'magit-push "-u"
+ '(1 "=s" "Skip gitlab pipeline" "--push-option=ci.skip"))
+ (transient-append-suffix 'magit-push "=s"
+ '(1 "=m" "Create gitlab merge-request" "--push-option=merge_request.create"))
+ (transient-append-suffix 'magit-push "=m"
+ '(1 "=o" "Set push option" "--push-option=")) ;; Will prompt, can only set one extra
+
+ (defun vde/fetch-and-rebase-from-upstream ()
+ ""
+ (interactive)
+ (magit-fetch-all "--quiet")
+ (magit-git-rebase (concat "upstream/" (vc-git--symbolic-ref (buffer-file-name))) "-sS"))
+
+ ;; Hide "Recent Commits"
+ (magit-add-section-hook 'magit-status-sections-hook
+ 'magit-insert-modules
+ 'magit-insert-unpushed-to-upstream
+ 'magit-insert-unpulled-from-upstream)
+ ;; No need for tag in the status header
+ (remove-hook 'magit-status-sections-hook 'magit-insert-tags-header)
+ (setq-default magit-module-sections-nested nil)
+
+ ;; Show refined hunks during diffs
+ (set-default 'magit-diff-refine-hunk t)
+
+ ;; Refresh `magit-status' after saving a buffer
+ (add-hook 'after-save-hook #'magit-after-save-refresh-status))
+
+(use-package magit-annex
+ :unless noninteractive
+ :after magit)
+
+(use-package git-annex
+ :after dired
+ :defer t)
+
+(use-package git-commit
+ :after magit
+ :commands (git-commit-mode)
+ :hook (git-commit-mode . vde/git-commit-mode-hook)
+ :config
+ (defun vde/git-commit-mode-hook ()
+ "git-commit mode hook")
+ (setq-default git-commit-summary-max-length 50
+ git-commit-known-pseudo-headers
+ '("Signed-off-by"
+ "Acked-by"
+ "Modified-by"
+ "Cc"
+ "Suggested-by"
+ "Reported-by"
+ "Tested-by"
+ "Reviewed-by")
+ git-commit-style-convention-checks
+ '(non-empty-second-line
+ overlong-summary-line)))
+
+(use-package gitconfig-mode
+ :commands (gitconfig-mode)
+ :mode (("/\\.gitconfig\\'" . gitconfig-mode)
+ ("/\\.git/config\\'" . gitconfig-mode)
+ ("/git/config\\'" . gitconfig-mode)
+ ("/\\.gitmodules\\'" . gitconfig-mode)))
+
+(use-package gitignore-mode
+ :commands (gitignore-mode)
+ :mode (("/\\.gitignore\\'" . gitignore-mode)
+ ("/\\.git/info/exclude\\'" . gitignore-mode)
+ ("/git/ignore\\'" . gitignore-mode)))
+
+(use-package gitattributes-mode
+ :commands (gitattributes-mode)
+ :mode (("/\\.gitattributes" . gitattributes-mode)))
+
+(use-package dired-git-info
+ :disabled
+ :bind (:map dired-mode-map
+ (")" . dired-git-info-mode))
+ :defer 2)
+
+(defun git-blame-line ()
+ "Runs `git blame` on the current line and
+ adds the commit id to the kill ring"
+ (interactive)
+ (let* ((line-number (save-excursion
+ (goto-char (point-at-bol))
+ (+ 1 (count-lines 1 (point)))))
+ (line-arg (format "%d,%d" line-number line-number))
+ (commit-buf (generate-new-buffer "*git-blame-line-commit*")))
+ (call-process "git" nil commit-buf nil
+ "blame" (buffer-file-name) "-L" line-arg)
+ (let* ((commit-id (with-current-buffer commit-buf
+ (buffer-substring 1 9)))
+ (log-buf (generate-new-buffer "*git-blame-line-log*")))
+ (kill-new commit-id)
+ (call-process "git" nil log-buf nil
+ "log" "-1" "--pretty=%h %an %s" commit-id)
+ (with-current-buffer log-buf
+ (message "Line %d: %s" line-number (buffer-string)))
+ (kill-buffer log-buf))
+ (kill-buffer commit-buf)))
+
+(use-package git-gutter
+ :hook (prog-mode . git-gutter-mode)
+ :config
+ (setq git-gutter:update-interval 0.2))
+
+(use-package git-gutter-fringe
+ :config
+ (define-fringe-bitmap 'git-gutter-fr:added [224] nil nil '(center repeated))
+ (define-fringe-bitmap 'git-gutter-fr:modified [224] nil nil '(center repeated))
+ (define-fringe-bitmap 'git-gutter-fr:deleted [128 192 224 240] nil nil 'bottom))
+
+(provide 'config-vcs)
+;;; config-vcs.el ends here
tools/emacs/old-config/config-web.el
@@ -0,0 +1,87 @@
+;;; config-web.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Web related configuration, notably the built-in web browser.
+;;; Code:
+
+(use-package shr
+ :config
+ (setq shr-use-fonts nil)
+ (setq shr-use-colors nil)
+ (setq shr-bullet "• ")
+ (setq shr-folding-mode t)
+
+ (setq shr-max-image-proportion 0.7)
+ (setq shr-image-animate nil)
+ (setq shr-width (current-fill-column)))
+
+(use-package shr-tag-pre-highlight
+ :after shr
+ :config
+ (add-to-list 'shr-external-rendering-functions
+ '(pre . shr-tag-pre-highlight))
+ (when (version< emacs-version "26")
+ (with-eval-after-load 'eww
+ (advice-add 'eww-display-html :around
+ 'eww-display-html--override-shr-external-rendering-functions))))
+
+(use-package eww
+ :commands (eww
+ eww-browse-url
+ eww-search-words
+ eww-open-in-new-buffer
+ eww-open-file
+ vde/eww-visit-history)
+ :config
+ (setq eww-restore-desktop nil)
+ (setq eww-desktop-remove-duplicates t)
+ (setq eww-header-line-format "%u")
+ (setq eww-search-prefix "https://duckduckgo.com/html/?q=")
+ (setq url-privacy-level '(email agent cookies lastloc))
+ (setq eww-download-directory "~/desktop/downloads/")
+ (setq eww-suggest-uris
+ '(eww-links-at-point
+ thing-at-point-url-at-point))
+ (setq eww-bookmarks-directory "~/.emacs.d/eww-bookmarks/")
+ (setq eww-history-limit 150)
+ (setq eww-use-external-browser-for-content-type
+ "\\`\\(video/\\|audio/\\|application/pdf\\)")
+ (setq eww-browse-url-new-window-is-tab nil)
+ (setq eww-form-checkbox-selected-symbol "[X]")
+ (setq eww-form-checkbox-symbol "[ ]")
+
+ ;; eww-view-source
+
+ (defvar vde/eww-mode-global-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "s" 'eww-search-words)
+ (define-key map "o" 'eww-open-in-new-buffer)
+ (define-key map "f" 'eww-open-file)
+ map)
+ "Key map to scope `eww' bindings for global usage.
+The idea is to bind this to a prefix sequence, so that its
+defined keys follow the pattern of <PREFIX> <KEY>.")
+ :bind-keymap ("C-x w" . vde/eww-mode-global-map)
+ :bind (:map eww-mode-map
+ ("n" . next-line)
+ ("p" . previous-line)
+ ("f" . forward-char)
+ ("b" . backward-char)
+ ("B" . eww-back-url)
+ ("N" . eww-next-url)
+ ("P" . eww-previous-url)))
+
+(use-package browse-url
+ :after eww
+ :config
+ (setq browse-url-generic-program "google-chrome-stable")
+ (setq browse-url-handlers '(("^https://gitlab.com.*" . browse-url-firefox)
+ ("^https://github.com.*" . browse-url-generic)
+ ("^https://issues.redhat.com.*" . browse-url-generic)
+ ("^https://.*redhat.com.*" . browse-url-generic)
+ ("^https://docs.jboss.org.*" . browse-url-generic)
+ (".*" . eww-browse-url)))
+ (setq browse-url-browser-function #'eww-browse-url)
+ )
+
+(provide 'config-web)
+;;; config-web.el ends here
tools/emacs/old-config/config-windows.el
@@ -0,0 +1,61 @@
+;;; config-windows.el --- -*- lexical-binding: t; -*-
+;; Commentary:
+;;; Windows configuration
+;; Code:
+
+(setq switch-to-buffer-obey-display-actions t)
+
+;; Winner
+(use-package winner
+ :unless noninteractive
+ :defer 5
+ :config
+ (winner-mode 1))
+;; -UseWinner
+
+;; UseAceWindow
+(use-package ace-window
+ :unless noninteractive
+ :commands (ace-window ace-swap-window)
+ :bind (("C-x o" . ace-window)
+ ("C-c w w" . ace-window)
+ ("C-c w s" . ace-swap-window))
+ :config
+ (setq-default aw-keys '(?a ?u ?i ?e ?, ?c ?t ?r ?m)
+ aw-scope 'frame
+ aw-dispatch-always t
+ aw-dispatch-alist
+ '((?s aw-swap-window "Swap Windows")
+ (?2 aw-split-window-vert "Split Window Vertically")
+ (?3 aw-split-window-horz "Split Window Horizontally")
+ (?? aw-show-dispatch-help))
+ aw-minibuffer-flag t
+ aw-ignore-current nil
+ aw-display-mode-overlay t
+ aw-background t))
+;; -UseAceWindow
+
+;; UseWindmove
+(use-package windmove
+ :unless noninteractive
+ :commands (windmove-left windmove-right windmove-down windmove-up)
+ :bind (("C-M-<up>" . windmove-up)
+ ("C-M-<right>" . windmove-right)
+ ("C-M-<down>" . windmove-down)
+ ("C-M-<left>" . windmove-left)))
+;; -UseWindmove
+
+;; UseWindow
+(use-package window
+ :unless noninteractive
+ :commands (shrink-window-horizontally shrink-window enlarge-window-horizontally enlarge-window)
+ :bind (("S-C-<left>" . shrink-window-horizontally)
+ ("S-C-<right>" . enlarge-window-horizontally)
+ ("S-C-<down>" . shrink-window)
+ ("S-C-<up>" . enlarge-window)))
+;; -UseWindow
+
+;; TODO: Move display-buffer-alist here
+
+(provide 'config-windows)
+;;; config-windows ends here
tools/emacs/old-config/programming-config.el
@@ -0,0 +1,18 @@
+;;; programming-config.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Configuration files mode configuration
+;;; Code:
+
+(use-package yaml-mode
+ :mode "\\.ya?ml\\'"
+ :hook ((yaml-mode . highlight-indentation-mode)
+ (yaml-mode . highlight-indentation-current-column-mode)))
+
+(use-package conf-mode
+ :mode ("\\.to?ml\\'" . conf-toml-mode))
+
+(use-package adoc-mode
+ :mode ("\\.adoc\\'" . conf-toml-mode))
+
+(provide 'programming-config)
+;;; programming-config.el ends here
tools/emacs/old-config/programming-containers.el
@@ -0,0 +1,31 @@
+;;; programming-containers.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Containers configuration
+;;; Code:
+(use-package dockerfile-mode
+ :mode ("Dockerfile\\'" . dockerfile-mode))
+
+;; I have a bunch of different 'profiles' for kubernetes by different cluster so
+;; i don't mess between things
+;; This allow me to set the KUBECONFIG variable between those easily
+;; TODO: add the current profile in modeline
+(defun my-switch-kubeconfig-env (&optional kubeconfig)
+ "Set KUBECONFIG environment variable for the current session"
+ (interactive
+ (list
+ (completing-read
+ "Kubeconfig: "
+ (mapcar
+ (lambda (x)
+ (replace-regexp-in-string
+ "^config\." ""
+ (file-name-nondirectory(directory-file-name x))))
+ (directory-files-recursively
+ (expand-file-name "~/.kube") "^config\.")) nil t )))
+ (setq kubeconfig (expand-file-name (format "~/.kube/config.%s" kubeconfig)))
+ (if (file-exists-p kubeconfig)
+ (setenv "KUBECONFIG" kubeconfig)
+ (error "Cannot find kubeconfig: %s" kubeconfig)))
+
+(provide 'programming-containers)
+;;; programming-containers.el ends here
tools/emacs/old-config/programming-cue.el
@@ -0,0 +1,9 @@
+;;; programming-cue.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Cue "data" language configuration
+;;; Code:
+(use-package cue-mode
+ :commands (cue-mode)
+ :mode "\\.cue$")
+
+(provide 'programming-cue)
tools/emacs/config/programming-elisp.el → tools/emacs/old-config/programming-elisp.el
File renamed without changes
tools/emacs/old-config/programming-go.el
@@ -0,0 +1,33 @@
+;;; programming-go.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Go programming language configuration
+;;; Code:
+;; (use-package go-mode
+;; :commands (go-mode)
+;; :mode "\\.go$"
+;; :interpreter "go"
+;; :config
+;; ;(setq gofmt-command "goimports")
+;; (if (not (executable-find "goimports"))
+;; (warn "go-mode: couldn't find goimports; no code formatting/fixed imports on save")
+;; (add-hook 'before-save-hook 'gofmt-before-save))
+;; (if (not (string-match "go" compile-command)) ; set compile command default
+;; (set (make-local-variable 'compile-command)
+;; "go build -v && go test -v && go vet")))
+;;
+;; (use-package gotest
+;; :after go-mode)
+;;
+;; (use-package gotest-ui
+;; :commands (gotest-ui-current-test gotest-ui-current-file gotest-ui-current-project)
+;; :after (go-mode gotest)
+;; :bind (:map go-mode-map
+;; ("C-c t t" . gotest-ui-current-test)
+;; ("C-c t f" . gotest-ui-current-file)
+;; ("C-c t p" . gotest-ui-current-project)))
+;;
+;; (use-package go-stacktracer
+;; :commands (go-stacktracer-region))
+
+(provide 'programming-go)
+;;; programming-go.el ends here
tools/emacs/old-config/programming-lsp.el
@@ -0,0 +1,44 @@
+;;; programming-lsp.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; LSP configuration
+;;; Code:
+;; (use-package lsp-mode
+;; :commands (lsp lsp-deferred)
+;; :hook ((python-mode . lsp)
+;; (go-mode . lsp))
+;; :init
+;; (setq lsp-keymap-prefix "C-c l")
+;; :config
+;; ;; (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\vendor\\'")
+;; :custom
+;; ;; turn this on to capture client/server comms before
+;; ;; submitting bug reports with `lsp-workspace-show-log`
+;; (lsp-enable-file-watchers nil)
+;; (lsp-completion-provider :none)
+;; (lsp-log-io nil)
+;; ;; (lsp-lens-enable t)
+;; (lsp-eldoc-enable-hover t)
+;; ;; (lsp-enable-indentation nil)
+;; (lsp-prefer-flymake t)
+;; (lsp-ui-sideline-enable nil)
+;; (lsp-ui-doc-enable nil)
+;; (lsp-ui-imenu-enable t)
+;; (lsp-ui-sideline-ignore-duplicate t)
+;; (lsp-enable-folding t)
+;; (lsp-enable-dap-auto-configure nil) ; Don't try to auto-enable dap: this creates a lot of binding clashes
+;; (lsp-headerline-breadcrumb-enable nil)
+;; (lsp-modeline-code-actions-enable nil)
+;; (lsp-modeline-diagnostics-enable nil)
+;; (lsp-idle-delay .01)
+;; (lsp-keymap-prefix nil)
+;; (lsp-eldoc-render-all nil)
+;; (lsp-file-watch-threshold 4000)
+;; (lsp-gopls-complete-unimported t t)
+;; (lsp-yaml-format-enable t)
+;; (lsp-gopls-staticcheck t t))
+;;
+;; (use-package consult-lsp
+;; :after (lsp))
+
+(provide 'programming-lsp)
+;;; programming-lsp.el ends here
tools/emacs/old-config/programming-nix.el
@@ -0,0 +1,27 @@
+;;; programming-nix.el --- -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Nix configuration
+;;; Code:
+(use-package nix-mode
+ :if *nix*
+ :after (lsp)
+ :mode ("\\.nix\\'" "\\.nix.in\\'"))
+
+(use-package nix-drv-mode
+ :if *nix*
+ :after nix-mode
+ :mode "\\.drv\\'")
+
+(use-package nix-shell
+ :if *nix*
+ :after nix-mode
+ :commands (nix-shell-unpack nix-shell-configure nix-shell-build))
+
+(use-package nixpkgs-fmt
+ :if *nix*
+ :after nix-mode
+ :config
+ (add-hook 'nix-mode-hook 'nixpkgs-fmt-on-save-mode))
+
+(provide 'programming-nix)
+;;; programming-nix.el ends here
tools/emacs/old-config/programming-web.el
@@ -0,0 +1,41 @@
+;;; programming-web.el --- -*- lexical-binding: t -*-
+;;; Commentary:
+;;; Programming the Web related configuration
+;;; Code:
+
+(use-package web-mode
+ :commands (web-mode)
+ :mode
+ ("\\.html\\'" . web-mode)
+ ("\\.phtml\\'" . web-mode)
+ ("\\.[agj]sp\\'" . web-mode)
+ ("\\.as[cp]x\\'" . web-mode)
+ ("\\.erb\\'" . web-mode)
+ ("\\.mustache\\'" . web-mode)
+ ("\\.djhtml\\'" . web-mode)
+ ("\\.jsp\\'" . web-mode)
+ ("\\.eex\\'" . web-mode)
+ ("\\.tsx\\'" . web-mode)
+ :config
+ (setq web-mode-attr-indent-offset 2)
+ (setq web-mode-code-indent-offset 2)
+ (setq web-mode-css-indent-offset 2)
+ (setq web-mode-indent-style 2)
+ (setq web-mode-markup-indent-offset 2)
+ (setq web-mode-sql-indent-offset 2)
+ (eval-after-load 'smartparens
+ (lambda ()
+ (setq web-mode-enable-auto-pairing nil)
+ (sp-with-modes '(web-mode)
+ (sp-local-pair "%" "%"
+ :unless '(sp-in-string-p)
+ :post-handlers '(((lambda (&rest _ignored)
+ (just-one-space)
+ (save-excursion (insert " ")))
+ "SPC" "=" "#")))
+ (sp-local-tag "%" "<% " " %>")
+ (sp-local-tag "=" "<%= " " %>")
+ (sp-local-tag "#" "<%# " " %>")))))
+
+(provide 'programming-web)
+;;; programming-web.el ends here
tools/emacs/config/README.org → tools/emacs/old-config/README.org
File renamed without changes
tools/emacs/config/setup-style.el → tools/emacs/old-config/setup-style.el
File renamed without changes
tools/emacs/config/writing.el → tools/emacs/old-config/writing.el
File renamed without changes
tools/emacs/early-init.el
@@ -1,6 +1,6 @@
;;; early-init.el --- Early init configuration file -*- lexical-binding: t; -*-
-;; Copyright (c) 2020-2021 Vincent Demeester <vincent@sbr.pm>
+;; Copyright (c) 2020-2023 Vincent Demeester <vincent@sbr.pm>
;; Author: Vincent Demeester <vincent@sbr.pm>
;; URL: https://git.sr.ht/~vdemeester/home
tools/emacs/init.el
@@ -1,3 +1,33 @@
+;;; init.el --- init configuration file -*- lexical-binding: t; -*-
+
+;; Copyright (c) 2020-2023 Vincent Demeester <vincent@sbr.pm>
+
+;; Author: Vincent Demeester <vincent@sbr.pm>
+;; URL: https://git.sr.ht/~vdemeester/home
+;; Version: 0.1.0
+;; Package-Requires: ((emacs "27.1"))
+
+;; This file is NOT part of GNU Emacs.
+
+;; This file is free software: you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by the
+;; Free Software Foundation, either version 3 of the License, or (at
+;; your option) any later version.
+;;
+;; This file is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this file. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; See my dotfiles: https://git.sr.ht/~vdemeester/home
+
+;;; Code:
+
(defconst emacs-start-time (current-time))