This commit is contained in:
Andrea Ciceri 2024-11-29 11:16:06 +01:00
parent ff2c16e55e
commit 6efc109f1c
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg

View file

@ -33,8 +33,8 @@
(use-package consult-eglot (use-package consult-eglot
:after (consult eglot embark) :after (consult eglot embark)
:config :config
(require 'consult-eglot-embark) (require 'consult-eglot-embark)
(consult-eglot-embark-mode) (consult-eglot-embark-mode)
) )
(use-package emacs (use-package emacs
@ -156,8 +156,8 @@
(treemacs-load-theme "nerd-icons")) (treemacs-load-theme "nerd-icons"))
(use-package nerd-icons-dired (use-package nerd-icons-dired
:hook :hook
(dired-mode . nerd-icons-dired-mode)) (dired-mode . nerd-icons-dired-mode))
(use-package indent-bars (use-package indent-bars
:config :config
@ -169,7 +169,7 @@
(indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 0.4)) (indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 0.4))
(indent-bars-no-stipple-char (string-to-char "")) (indent-bars-no-stipple-char (string-to-char ""))
(indent-bars-prefer-character 't) ;; so it works also in terminal (indent-bars-prefer-character 't) ;; so it works also in terminal
) )
(use-package diredfl (use-package diredfl
:config (diredfl-global-mode)) :config (diredfl-global-mode))
@ -321,27 +321,27 @@
(call-interactively 'ccr/h-resize)) (call-interactively 'ccr/h-resize))
(t (push key unread-command-events)))) (t (push key unread-command-events))))
:bind (("C-c w k" . windmove-up) :bind (("C-c w k" . windmove-up)
("C-c w l" . windmove-right) ("C-c w l" . windmove-right)
("C-c w j" . windmove-down) ("C-c w j" . windmove-down)
("C-c w h" . windmove-left) ("C-c w h" . windmove-left)
("M-k" . windmove-up) ("M-k" . windmove-up)
("M-l" . windmove-right) ("M-l" . windmove-right)
("M-j" . windmove-down) ("M-j" . windmove-down)
("M-h" . windmove-left) ("M-h" . windmove-left)
("C-c w <up>" . windmove-up) ("C-c w <up>" . windmove-up)
("C-c w <right>" . windmove-right) ("C-c w <right>" . windmove-right)
("C-c w <down>" . windmove-down) ("C-c w <down>" . windmove-down)
("C-c w <left>" . windmove-left) ("C-c w <left>" . windmove-left)
("C-c w q" . delete-window) ("C-c w q" . delete-window)
("C-c w K" . windmove-delete-up) ("C-c w K" . windmove-delete-up)
("C-c w L" . windmove-delete-right) ("C-c w L" . windmove-delete-right)
("C-c w J" . windmove-delete-down) ("C-c w J" . windmove-delete-down)
("C-c w H" . windmove-delete-left) ("C-c w H" . windmove-delete-left)
("C-c w x" . kill-buffer-and-window) ("C-c w x" . kill-buffer-and-window)
("C-c w v" . split-window-right) ("C-c w v" . split-window-right)
("C-c w s" . split-window-below) ("C-c w s" . split-window-below)
("C-c w V" . ccr/v-resize) ("C-c w V" . ccr/v-resize)
("C-c w S" . ccr/h-resize))) ("C-c w S" . ccr/h-resize)))
(use-package vertico (use-package vertico
:custom :custom
@ -352,8 +352,8 @@
(vertico-cycle t) (vertico-cycle t)
(vertico-mode t) (vertico-mode t)
:bind (:map vertico-map :bind (:map vertico-map
(("DEL" . vertico-directory-delete-char) (("DEL" . vertico-directory-delete-char)
("C-DEL" . vertico-directory-delete-word)))) ("C-DEL" . vertico-directory-delete-word))))
;; (use-package vertico-posframe ;; (use-package vertico-posframe
;; :after vertico ;; :after vertico
@ -381,25 +381,24 @@
([remap goto-line] . consult-goto-line) ([remap goto-line] . consult-goto-line)
([remazp imenu] . consult-imenu) ([remazp imenu] . consult-imenu)
([remap project-switch-to-buffer] . consult-project-buffer) ([remap project-switch-to-buffer] . consult-project-buffer)
("C-c b b" . consult-project-buffer) ("C-c b b" . consult-project-buffer)
("C-c b B" . consult-buffer) ("C-c b B" . consult-buffer)
("C-c g l" . consult-goto-line) ("C-c g l" . consult-goto-line)
("C-c b i" . consult-imenu) ("C-c b i" . consult-imenu)
("C-c f f" . consult-find) ("C-c f f" . consult-find)
("C-c F" . consult-ripgrep) ("C-c F" . consult-ripgrep)
("C-c f" . consult-find) ("C-c f" . consult-find)
("C-c l" . consult-line) ("C-c l" . consult-line)
("C-c L" . consult-focus-lines) ("C-c L" . consult-focus-lines)
("C-c m" . consult-mark) ("C-c m" . consult-mark)
("C-c o o" . consult-outline) ("C-c o o" . consult-outline)
("C-c e" . consult-flymake)) ("C-c e" . consult-flymake))
:custom :custom
(xref-show-xrefs-function #'consult-xref) (xref-show-xrefs-function #'consult-xref)
(xref-show-definitions-function #'consult-xref)) (xref-show-definitions-function #'consult-xref))
(use-package orderless (use-package orderless
:custom :custom
(completion-styles '(orderless)))
(completion-styles '(orderless basic)) (completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion))))) (completion-category-overrides '((file (styles basic partial-completion)))))
@ -417,9 +416,9 @@
(tab-always-indent 'complete) (tab-always-indent 'complete)
(kind-icon-default-face 'corfu-default) (kind-icon-default-face 'corfu-default)
:bind (:map corfu-map :bind (:map corfu-map
(("M-d" . corfu-doc-toggle) (("M-d" . corfu-doc-toggle)
("M-l" . corfu-show-location) ("M-l" . corfu-show-location)
("SPC" . corfu-insert-separator))) ("SPC" . corfu-insert-separator)))
:init :init
(global-corfu-mode)) (global-corfu-mode))
@ -487,7 +486,7 @@
:feature 'function :feature 'function
:override t :override t
`((formal) @font-lock-type-face) `((formal) @font-lock-type-face)
:language 'nix :language 'nix
:feature 'function :feature 'function
`((attrpath) @font-lock-function-name-face) `((attrpath) @font-lock-function-name-face)
@ -509,8 +508,8 @@
(use-package typescript-ts-mode (use-package typescript-ts-mode
:hook ((typescript-ts-mode . (lambda () :hook ((typescript-ts-mode . (lambda ()
(require 'eglot) (require 'eglot)
(eglot-ensure)))) (eglot-ensure))))
:mode "\\.ts\\'") :mode "\\.ts\\'")
(use-package haskell-ts-mode (use-package haskell-ts-mode
@ -567,6 +566,7 @@
(use-package aggressive-indent (use-package aggressive-indent
:hook ((lisp-mode . aggressive-indent-mode) :hook ((lisp-mode . aggressive-indent-mode)
(emacs-lisp-mode . aggressive-indent-mode))) (emacs-lisp-mode . aggressive-indent-mode)))
(use-package eldoc (use-package eldoc
:delight) :delight)
@ -577,10 +577,10 @@
(eldoc-box-lighter "ElBox") (eldoc-box-lighter "ElBox")
:bind (("C-c h" . eldoc-box-help-at-point))) :bind (("C-c h" . eldoc-box-help-at-point)))
(use-package diff-hl (use-package diff-hl
:init :init
(global-diff-hl-mode 1) (global-diff-hl-mode 1)
(diff-hl-margin-mode 1)) (diff-hl-margin-mode 1))
(use-package envrc (use-package envrc
:config :config
@ -612,7 +612,7 @@
(use-package eshell (use-package eshell
:init (require 'eshell) ;; this slows down Emacs startup but it's needed when starting eshell with :init (require 'eshell) ;; this slows down Emacs startup but it's needed when starting eshell with
;; emacsclient --eval before opening another eshell buffer directly from inside Emacs ;; emacsclient --eval before opening another eshell buffer directly from inside Emacs
(eat-eshell-mode) (eat-eshell-mode)
(eat-eshell-visual-command-mode) (eat-eshell-visual-command-mode)
:custom ((eshell-prefer-lisp-functions t) :custom ((eshell-prefer-lisp-functions t)
@ -669,18 +669,19 @@
(use-package popper (use-package popper
:custom :custom
(popper-reference-buffers '("\*Messages\*" (popper-reference-buffers
"Output\*$" '("\*Messages\*"
"\\*Async Shell Command\\*" "Output\*$"
(completion-list-mode . hide) "\\*Async Shell Command\\*"
help-mode (completion-list-mode . hide)
compilation-mode help-mode
"^\\*Nix-REPL*\\*$" nix-repl-mode ;eshell as a popup compilation-mode
"^\\*.+-eshell.*\\*$" eshell-mode ;eshell as a popup "^\\*Nix-REPL*\\*$" nix-repl-mode
"^\\*shell.*\\*$" shell-mode ;shell as a popup "^\\*.+-eshell.*\\*$" eshell-mode
"^\\*term.*\\*$" term-mode ;term as a popup "^\\*shell.*\\*$" shell-mode
"^\\*eat.*\\*$" eat-mode ;eat as a popup "^\\*term.*\\*$" term-mode
)) "^\\*eat.*\\*$" eat-mode
))
(popper-window-height 0.33) (popper-window-height 0.33)
(popper-echo-lines 1) (popper-echo-lines 1)
(popper-mode-line nil) (popper-mode-line nil)
@ -768,18 +769,18 @@ This is meant to be an helper to be called from the window manager."
;; FIXME the following doesn't work when using the daemon, it should be executed only ;; FIXME the following doesn't work when using the daemon, it should be executed only
;; one time after the first frame is created ;; one time after the first frame is created
:hook (server-after-make-frame . (lambda () :hook (server-after-make-frame . (lambda ()
(set-face-font 'variable-pitch "Dejavu Serif-14") (set-face-font 'variable-pitch "Dejavu Serif-14")
(set-face-font 'fixed-pitch "Iosevka Comfy-14") (set-face-font 'fixed-pitch "Iosevka Comfy-14")
(set-face-font 'org-table "Iosevka Comfy-14") (set-face-font 'org-table "Iosevka Comfy-14")
(set-face-font 'org-meta-line "Iosevka Comfy-14") (set-face-font 'org-meta-line "Iosevka Comfy-14")
(set-face-font 'org-drawer "Iosevka Comfy-14") (set-face-font 'org-drawer "Iosevka Comfy-14")
(set-face-font 'org-special-keyword "Iosevka Comfy-14") (set-face-font 'org-special-keyword "Iosevka Comfy-14")
(set-face-font 'org-property-value "Iosevka Comfy-14") (set-face-font 'org-property-value "Iosevka Comfy-14")
(set-face-font 'org-block "Iosevka Comfy-14") (set-face-font 'org-block "Iosevka Comfy-14")
(set-face-font 'org-modern-tag "Iosevka Comfy-14") (set-face-font 'org-modern-tag "Iosevka Comfy-14")
(set-face-font 'org-modern-date-active "Iosevka Comfy-14") (set-face-font 'org-modern-date-active "Iosevka Comfy-14")
(set-face-font 'org-modern-date-inactive "Iosevka Comfy-14"))) (set-face-font 'org-modern-date-inactive "Iosevka Comfy-14")))
) )
(use-package org-roam (use-package org-roam
:custom :custom
@ -812,23 +813,23 @@ This is meant to be an helper to be called from the window manager."
(string-to-number (cdr (assoc "SPENT" (org-roam-node-properties node))))) (string-to-number (cdr (assoc "SPENT" (org-roam-node-properties node)))))
(defun org-roam-node-date (node) (defun org-roam-node-date (node)
"Return the org datestring when a node was created (obtained from the filename)" "Return the org datestring when a node was created (obtained from the filename)"
(format "<%s>" (file-name-sans-extension (file-name-nondirectory (org-roam-node-file node))))) (format "<%s>" (file-name-sans-extension (file-name-nondirectory (org-roam-node-file node)))))
(org-roam-ql-defpred (org-roam-ql-defpred
'date-range 'date-range
"Check if node was created in given time range" "Check if node was created in given time range"
#'org-roam-node-date #'org-roam-node-date
#'(lambda (node-date start-date end-date) #'(lambda (node-date start-date end-date)
(let ((node-date (condition-case nil (let ((node-date (condition-case nil
;; if the entry is not from the journal (i.e. the filename is not something like "2024-10-10.org") ;; if the entry is not from the journal (i.e. the filename is not something like "2024-10-10.org")
;; then it's always discarded (the epoch time is given to it) ;; then it's always discarded (the epoch time is given to it)
(encode-time (org-parse-time-string node-date)) (encode-time (org-parse-time-string node-date))
(error (encode-time (org-parse-time-string "<1970-01-01>"))))) (error (encode-time (org-parse-time-string "<1970-01-01>")))))
(start-date (encode-time (org-parse-time-string start-date))) (start-date (encode-time (org-parse-time-string start-date)))
(end-date (encode-time (org-parse-time-string end-date)))) (end-date (encode-time (org-parse-time-string end-date))))
(and (time-less-p start-date node-date) (and (time-less-p start-date node-date)
(time-less-p node-date end-date))) (time-less-p node-date end-date)))
)) ))
(defun ccr/org-roam-spent-hours (client &optional date-start date-end) (defun ccr/org-roam-spent-hours (client &optional date-start date-end)
"Return the total spent hours on something (usually a client)" "Return the total spent hours on something (usually a client)"
@ -868,13 +869,13 @@ This is meant to be an helper to be called from the window manager."
("C-c n s" . consult-org-roam-search)) ("C-c n s" . consult-org-roam-search))
(use-package org-roam-ui (use-package org-roam-ui
:after org-roam :after org-roam
:hook (after-init . org-roam-ui-mode) ;; don't care about startup time since I'm using Emacs daemonized :hook (after-init . org-roam-ui-mode) ;; don't care about startup time since I'm using Emacs daemonized
:config :config
(setq org-roam-ui-sync-theme t (setq org-roam-ui-sync-theme t
org-roam-ui-follow t org-roam-ui-follow t
org-roam-ui-update-on-save t org-roam-ui-update-on-save t
org-roam-ui-open-on-start nil)) org-roam-ui-open-on-start nil))
(use-package gptel (use-package gptel
:custom :custom