From b3b03e46ea9626ad12a74d6ea7f90ceca1bf1d4f Mon Sep 17 00:00:00 2001 From: mattkae Date: Thu, 22 Jun 2023 12:34:12 -0400 Subject: Using vertico isntead of helm now; created a way to archive all tasks in an org buffer; created better capture templates --- lisp/general.el | 57 +++++++++++++++++++++++-------------------- lisp/org-custom.el | 27 +++++++++++++++----- lisp/vc-annotate-lens-mode.el | 13 ++++------ 3 files changed, 56 insertions(+), 41 deletions(-) (limited to 'lisp') diff --git a/lisp/general.el b/lisp/general.el index e2acec0..79a85b3 100644 --- a/lisp/general.el +++ b/lisp/general.el @@ -83,7 +83,6 @@ ;; Initialization screen (setq fancy-splash-image "~/.emacs.d/images/true.png") - ;; Highlight todos (use-package hl-todo :ensure t @@ -94,19 +93,36 @@ ;; Delete highlighted selection (delete-selection-mode 1) -;; I am using the helm package, of course -(use-package helm +(use-package vertico :ensure t - :config - (helm-mode 1) - (setq helm-mode-fuzzy-match t) + :init + (vertico-mode) + + ;; Different scroll margin + ;; (setq vertico-scroll-margin 0) + + ;; Show more candidates + ;; (setq vertico-count 20) + + ;; Grow and shrink the Vertico minibuffer + ;; (setq vertico-resize t) + + ;; Optionally enable cycling for `vertico-next' and `vertico-previous'. + ;; (setq vertico-cycle t) ) -(use-package helm-posframe - :ensure t - :config - (helm-posframe-enable) - (setq helm-posframe-poshandler 'posframe-poshandler-frame-top-center)) +(use-package orderless + :ensure t + :init + ;; Configure a custom style dispatcher (see the Consult wiki) + ;; (setq orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch) + ;; orderless-component-separator #'orderless-escapable-split-on-space) + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) + +(use-package rg + :ensure t) ;; Projectile for project navigation (use-package projectile @@ -123,18 +139,10 @@ (add-to-list 'projectile-globally-ignored-directories "dist") (add-to-list 'projectile-project-root-files "package.json") (add-to-list 'projectile-globally-ignored-files "package-lock.json") - ) - -(use-package helm-projectile - :ensure t - :bind - :config - (setq projectile-completion-system 'helm) - (helm-projectile-on) (define-key projectile-mode-map (kbd "s-F") 'projectile-ripgrep) - (define-key projectile-mode-map [?\s-o] 'helm-projectile-switch-project) - (define-key projectile-mode-map [?\s-p] 'helm-projectile-find-file) - :after (projectile helm) + (define-key projectile-mode-map [?\s-o] 'projectile-switch-project) + (define-key projectile-mode-map [?\s-p] 'projectile-find-file) + ) ;; Don't ask to kill when we have an open line number @@ -191,13 +199,8 @@ :if (display-graphic-p)) ;; Global key binds - -(bind-key* (kbd "C-x C-f") 'helm-find-files) -;(bind-key* (kbd "C-s") 'helm-do-grep-ag) -(bind-key* (kbd "M-x") 'helm-M-x) (bind-key* (kbd "M-.") 'xref-find-definitions) (bind-key* (kbd "C-x k") 'kill-this-buffer) -(bind-key* (kbd "C-x b") 'electric-buffer-list) (bind-key* (kbd "C-;") 'treemacs) (defun my-create-file (filename) diff --git a/lisp/org-custom.el b/lisp/org-custom.el index 61b7532..1037771 100644 --- a/lisp/org-custom.el +++ b/lisp/org-custom.el @@ -38,8 +38,7 @@ (setq org-directory "~/OrgRoam") (setq org-agenda-files '("~/OrgRoam" "~/OrgRoam/daily")) - - +(setq org-default-notes-file (concat org-directory "/inbox.org")) (setq org-todo-keywords '((sequence "TODO" "PROGRESS" "VERIFY" "|" "DONE" "ABANDONED"))) @@ -58,9 +57,9 @@ :ensure t :config (org-alert-enable) - (setq org-alert-interval 6000 ; Once per hour! - org-alert-notify-cutoff 10 - org-alert-notify-after-event-cutoff nil + (setq org-alert-interval 3600 ; Once per hour! + org-alert-notify-cutoff 30 + org-alert-notify-after-event-cutoff 30 alert-default-style 'libnotify)) (use-package org-roam @@ -73,11 +72,27 @@ ("C-c n g" . org-roam-graph) ("C-c n j" . org-roam-dailies-capture-today) ("C-c n t" . org-roam-tag-add) - ("C-c n a" . org-roam-alias-add)) + ("C-c n a" . org-roam-alias-add) + ("C-c n c" . org-capture)) :config (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag))) (org-roam-setup) ) +(setq org-capture-templates + '(("t" "Todo" entry (file+headline org-default-notes-file "Tasks") + "* TODO %?\n DEADLINE: %t") + ("q" "Quick Notes" entry (file+headline org-default-notes-file "Quick Notes") + "* %?\Created on %U\n %i"))) + +(defun org-archive-done-tasks () + "Archive all done tasks in an org subtree" + (interactive) + (org-map-entries + (lambda () + (org-archive-subtree) + (setq org-map-continue-from (org-element-property :begin (org-element-at-point)))) + "/DONE" 'tree)) + (provide 'org-custom) ;;; org-custom.el ends here diff --git a/lisp/vc-annotate-lens-mode.el b/lisp/vc-annotate-lens-mode.el index 8580aef..b615a1b 100644 --- a/lisp/vc-annotate-lens-mode.el +++ b/lisp/vc-annotate-lens-mode.el @@ -26,19 +26,16 @@ (let ((git-info (shell-command-to-string (format "git log -u -L%d,%d:%s" vc-annotate-lens-cursor-position vc-annotate-lens-cursor-position buffer-file-name)))) (let (( git-info-split (split-string git-info "\n" ))) - (message "%s" 'git-info-split) - (let (( author-line (nth 1 git-info-split)) - ( date-line (nth 2 git-info-split))) - (overlay-put (make-overlay (point-at-eol) (+ 3 (point-at-eol))) 'display - author-line) + (let ( + ( commit-line (nth 0 git-info-split)) + ( author-line (nth 1 git-info-split)) + ( date-line (nth 2 git-info-split))) + (overlay-put (make-overlay (point-at-eol) (+ 3 (point-at-eol))) 'display (format " %s\n" author-line)) ) ) ) ) -(do-stuff-if-moved-post-command) - - (define-minor-mode vc-annotate-lens-mode "Show 'vc-annotate' information when you move to a line." -- cgit v1.2.1