From cfd47f6ede0bf458c3c6d39e14eb345bbc6f89e0 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 23 Feb 2021 05:49:33 -0600 Subject: [PATCH] Adding tfc posts capture template and some other tweaks --- README.org | 94 +++++++++++++++++++++++++++++++++++--------------- eshell/history | 1 + init.el | 83 +++++++++++++++++++++++++++++--------------- 3 files changed, 123 insertions(+), 55 deletions(-) diff --git a/README.org b/README.org index 173362af..acd7e8dc 100644 --- a/README.org +++ b/README.org @@ -108,6 +108,10 @@ Also, real quick let's make sure that ~~ works as the same as ~~ (global-set-key (kbd "") 'keyboard-escape-quit) #+end_src +Let's also turn on =recentf-mode=. +#+begin_src emacs-lisp +(recentf-mode +1) +#+end_src ** Let's bootstrap straight.el #+begin_src emacs-lisp (defvar bootstrap-version) @@ -166,6 +170,13 @@ Also, real quick let's make sure that ~~ works as the same as ~~ (smartparens-global-mode +1)) #+end_src +#+begin_src emacs-lisp +(use-package aggressive-indent + :defer 1 + :config + (global-aggressive-indent-mode +1)) +#+end_src + #+begin_src emacs-lisp (use-package adaptive-wrap :defer t) @@ -255,6 +266,7 @@ This evil-collection package includes a lot of other evil based things. "bi" '(ibuffer :which-key "ibuffer") "tt" '(consult-theme :which-key "choose theme") "ff" '(find-file :which-key "find file") + "fb" '((find-file ~/org/bibles/) :which-key "find bible book") "fr" '(consult-recent-file :which-key "recent file") "fs" '(save-buffer :which-key "save") "hf" '(helpful-function :which-key "describe-function") @@ -316,8 +328,10 @@ I prefer selectrum over Ivy or Helm for completions. It is using the basic compl :init (selectrum-mode +1) :config - (general-define-key - :keymaps 'selectrum-minibuffer-map + (setq selectrum-max-window-height 10) + (add-hook 'selectrum-mode-hook 'selectrum-exhibit) + :general + ('selectrum-minibuffer-map "C-j" 'selectrum-next-candidate "C-k" 'selectrum-previous-candidate "C-S-j" 'selectrum-goto-end @@ -460,7 +474,6 @@ I use fennel to build my awesomewm config. So, we'll need that downloaded. #+end_src ** File Management - *** Dired #+begin_src emacs-lisp (use-package dired @@ -473,6 +486,15 @@ I use fennel to build my awesomewm config. So, we'll need that downloaded. "q" 'kill-this-buffer)) #+end_src +We need a function to copy the full filename to kill-ring +#+begin_src emacs-lisp +(defun chris/dired-yank-filename () + "Get the full filename from file at point and put into kill-ring" + (interactive) + (let* ((file (dired-get-filename))) + (clipboard-kill-ring-save nil nil file))) +#+end_src + #+begin_src emacs-lisp (use-package all-the-icons-dired :hook (dired-mode . all-the-icons-dired-mode)) @@ -501,6 +523,7 @@ I use fennel to build my awesomewm config. So, we'll need that downloaded. Let's start by creating a self contained function of what I'd like started on every org buffer. #+begin_src emacs-lisp (defun chris/org-mode-setup () + (interactive) (org-indent-mode +1) (toc-org-mode +1) (olivetti-mode +1) @@ -514,16 +537,15 @@ Part of this config includes some special capture templates for my work as a you (use-package org :config (setq org-startup-indented t - org-edit-src-content-indentation 0 + org-edit-src-content-indentation 0 org-agenda-sticky t) (add-hook 'org-mode-hook 'chris/org-mode-setup) - (org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . t) - (python . t) - (shell . t))) + (org-babel-do-load-languages 'org-babel-load-languages + '((emacs-lisp . t) + (python . t) + (shell . t))) (require 'org-tempo) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) @@ -547,6 +569,11 @@ Part of this config includes some special capture templates for my work as a you :prepend nil :jump-to-captured t :empty-lines 1) + ("P" "TFC Posts" entry + (file+headline "/home/chris/org/nvtfc_social_media.org" "Posts") + (file ".templates/posts.org") + :prepend t + :jump-to-captured t) ("r" "Templates for projects") ("rt" "Project-local todo" entry (file+headline +org-capture-project-todo-file "Inbox") @@ -555,7 +582,7 @@ Part of this config includes some special capture templates for my work as a you (file+headline +org-capture-project-notes-file "Inbox") "* %U %?\n%i\n%a" :prepend t) ("rc" "Project-local changelog" entry - (file+headline +org-capture-project-changelog-file "Unreleased") + (file+headline +org-capture-project-changelog-file "Unreleased") "* %U %?\n%i\n%a" :prepend t) ("o" "Centralized templates for projects") ("ot" "Project todo" entry #'+org-capture-central-project-todo-file @@ -564,7 +591,7 @@ Part of this config includes some special capture templates for my work as a you "* %U %?\n %i\n %a" :heading "Notes" :prepend t) ("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file "* %U %?\n %i\n %a" :heading "Changelog" :prepend t)) - org-capture-use-agenda-date t) + org-capture-use-agenda-date t) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) (setq org-imenu-depth 4) @@ -579,12 +606,24 @@ Part of this config includes some special capture templates for my work as a you (setq org-agenda-files - '("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org")) + '("/home/chris/org/DMPREADME.org" + "/home/chris/org/DMPTODO.org" + "/home/chris/org/inbox.org" + "/home/chris/org/notes.org" + "/home/chris/org/repetition.org" + "/home/chris/org/tasks.org" + "/home/chris/org/tfc_plans.org" + "/home/chris/org/ministry_team.org" + "/home/chris/org/todo.org" + "/home/chris/org/newsletter.org")) + (setq org-id-method 'ts) (defun chris/org-columns-view () "Turn on org-columns overlay and turn off olivetti-mode" (interactive) + (goto-char (point-min)) + (org-content) (org-columns) (olivetti-mode -1)) @@ -592,30 +631,25 @@ Part of this config includes some special capture templates for my work as a you "Remove the org-columns overlay and turn on olivetti-mode" (interactive) (org-columns-quit) + (visual-line-mode +1) (olivetti-mode +1)) - (defun chris/org-toggle-todo-and-mark-time () - "Mark the time of finishing task and mark it as done." - (interactive) - (save-excursion - (org-back-to-heading t) ;; Make sure command works even if point is - ;; below target heading - (cond ((looking-at "\*+ TODO") - (org-todo "DONE")) - ((looking-at "\*+ DONE") - (org-todo "TODO")) - (t (message "Can only toggle between TODO and DONE."))))) + (add-hook 'org-agenda-finalize-hook 'evil-normal-state) :general - (chris/leader-keys "o a" 'org-agenda + (chris/leader-keys + "o a" 'org-agenda "c" 'org-capture "so" 'consult-imenu) ('normal org-agenda-mode-map - "q" 'org-agenda-quit) + "q" 'org-agenda-quit + "r" 'org-agenda-redo) ('normal org-columns-map "j" 'outline-next-heading - "h" 'outline-previous-heading) + "h" 'outline-previous-heading + "q" 'chris/org-columns-quit) ('normal org-mode-map - "RET" 'chris/org-dwim-at-point)) + "RET" 'chris/org-dwim-at-point + "gC" 'chris/org-columns-view)) #+end_src We need to create a lesson capture function to find our lesson files differently each time we run our TFC plan capture. This is the most unique part of my capture template. This function uses =org-roam-find-file= to pick the lesson file that I need to add my lesson plan to. This way the lesson itself is created before the plan. @@ -650,6 +684,7 @@ We also need to add =evil-org= to make better keybindings. (use-package evil-org :after org) #+end_src + *** Org-Super-Agenda Super Agenda gives me a really nice way of making the agenda view look a lot better with some better information included. #+begin_src emacs-lisp @@ -672,6 +707,7 @@ Super Agenda gives me a really nice way of making the agenda view look a lot bet (org-super-agenda-mode) (setq org-super-agenda-header-map nil)) #+end_src + *** Org-Roam Here we are going to add org-roam. This is a note-takers paradise by adding an automatic backlinking function. @@ -736,12 +772,14 @@ In order to use it, I need to go to http://localhost:8080 (add-hook 'org-roam-mode-hook org-roam-server-mode t) #+END_SRC *** Org-Superstar +Org-Superstar makes the stars at the beginning of the line in =org-mode= a lot prettier. #+begin_src emacs-lisp (use-package org-superstar :after org :config (org-superstar-mode +1) - (setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756"))) + (setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756")) + (add-hook 'org-mode-hook 'org-superstar-mode)) #+end_src *** Org DWIM I've stolen most of this code from Doom Emacs but we want to create a dwim-at-point function for Org-Mode that will fit under the =RET= key. This allows us to do a bunch of different functions depending on the context of point. diff --git a/eshell/history b/eshell/history index a05f149a..835596fb 100644 --- a/eshell/history +++ b/eshell/history @@ -10,3 +10,4 @@ message hello 32 12 2 +ls diff --git a/init.el b/init.el index ce648e38..32e6dce3 100644 --- a/init.el +++ b/init.el @@ -38,6 +38,8 @@ (global-set-key (kbd "") 'keyboard-escape-quit) +(recentf-mode +1) + (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) @@ -81,6 +83,11 @@ :config (smartparens-global-mode +1)) +(use-package aggressive-indent + :defer 1 + :config + (global-aggressive-indent-mode +1)) + (use-package adaptive-wrap :defer t) @@ -154,6 +161,7 @@ "bi" '(ibuffer :which-key "ibuffer") "tt" '(consult-theme :which-key "choose theme") "ff" '(find-file :which-key "find file") + "fb" '((find-file ~/org/bibles/) :which-key "find bible book") "fr" '(consult-recent-file :which-key "recent file") "fs" '(save-buffer :which-key "save") "hf" '(helpful-function :which-key "describe-function") @@ -196,8 +204,10 @@ :init (selectrum-mode +1) :config - (general-define-key - :keymaps 'selectrum-minibuffer-map + (setq selectrum-max-window-height 10) + (add-hook 'selectrum-mode-hook 'selectrum-exhibit) + :general + ('selectrum-minibuffer-map "C-j" 'selectrum-next-candidate "C-k" 'selectrum-previous-candidate "C-S-j" 'selectrum-goto-end @@ -261,6 +271,12 @@ (general-def 'normal dired-mode-map "q" 'kill-this-buffer)) +(defun chris/dired-yank-filename () + "Get the full filename from file at point and put into kill-ring" + (interactive) + (let* ((file (dired-get-filename))) + (clipboard-kill-ring-save nil nil file))) + (use-package all-the-icons-dired :hook (dired-mode . all-the-icons-dired-mode)) @@ -276,6 +292,7 @@ :config (diredfl-global-mode +1)) (defun chris/org-mode-setup () + (interactive) (org-indent-mode +1) (toc-org-mode +1) (olivetti-mode +1) @@ -284,16 +301,15 @@ (use-package org :config (setq org-startup-indented t - org-edit-src-content-indentation 0 + org-edit-src-content-indentation 0 org-agenda-sticky t) (add-hook 'org-mode-hook 'chris/org-mode-setup) - (org-babel-do-load-languages - 'org-babel-load-languages - '((emacs-lisp . t) - (python . t) - (shell . t))) + (org-babel-do-load-languages 'org-babel-load-languages + '((emacs-lisp . t) + (python . t) + (shell . t))) (require 'org-tempo) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) @@ -317,6 +333,11 @@ :prepend nil :jump-to-captured t :empty-lines 1) + ("P" "TFC Posts" entry + (file+headline "/home/chris/org/nvtfc_social_media.org" "Posts") + (file ".templates/posts.org") + :prepend t + :jump-to-captured t) ("r" "Templates for projects") ("rt" "Project-local todo" entry (file+headline +org-capture-project-todo-file "Inbox") @@ -325,7 +346,7 @@ (file+headline +org-capture-project-notes-file "Inbox") "* %U %?\n%i\n%a" :prepend t) ("rc" "Project-local changelog" entry - (file+headline +org-capture-project-changelog-file "Unreleased") + (file+headline +org-capture-project-changelog-file "Unreleased") "* %U %?\n%i\n%a" :prepend t) ("o" "Centralized templates for projects") ("ot" "Project todo" entry #'+org-capture-central-project-todo-file @@ -334,7 +355,7 @@ "* %U %?\n %i\n %a" :heading "Notes" :prepend t) ("oc" "Project changelog" entry #'+org-capture-central-project-changelog-file "* %U %?\n %i\n %a" :heading "Changelog" :prepend t)) - org-capture-use-agenda-date t) + org-capture-use-agenda-date t) ;;(setq org-superstar-headline-bullets-list '("◉" "◈" "▸" "✬" "◎" "◇" "❉" "✙" "❖")) (setq org-imenu-depth 4) @@ -349,12 +370,24 @@ (setq org-agenda-files - '("/home/chris/org/DMPREADME.org" "/home/chris/org/DMPTODO.org" "/home/chris/org/inbox.org" "/home/chris/org/notes.org" "/home/chris/org/repetition.org" "/home/chris/org/tasks.org" "/home/chris/org/tfc_plans.org" "/home/chris/org/ministry_team.org" "/home/chris/org/todo.org" "/home/chris/org/newsletter.org")) + '("/home/chris/org/DMPREADME.org" + "/home/chris/org/DMPTODO.org" + "/home/chris/org/inbox.org" + "/home/chris/org/notes.org" + "/home/chris/org/repetition.org" + "/home/chris/org/tasks.org" + "/home/chris/org/tfc_plans.org" + "/home/chris/org/ministry_team.org" + "/home/chris/org/todo.org" + "/home/chris/org/newsletter.org")) + (setq org-id-method 'ts) (defun chris/org-columns-view () "Turn on org-columns overlay and turn off olivetti-mode" (interactive) + (goto-char (point-min)) + (org-content) (org-columns) (olivetti-mode -1)) @@ -362,30 +395,25 @@ "Remove the org-columns overlay and turn on olivetti-mode" (interactive) (org-columns-quit) + (visual-line-mode +1) (olivetti-mode +1)) - (defun chris/org-toggle-todo-and-mark-time () - "Mark the time of finishing task and mark it as done." - (interactive) - (save-excursion - (org-back-to-heading t) ;; Make sure command works even if point is - ;; below target heading - (cond ((looking-at "\*+ TODO") - (org-todo "DONE")) - ((looking-at "\*+ DONE") - (org-todo "TODO")) - (t (message "Can only toggle between TODO and DONE."))))) + (add-hook 'org-agenda-finalize-hook 'evil-normal-state) :general - (chris/leader-keys "o a" 'org-agenda + (chris/leader-keys + "o a" 'org-agenda "c" 'org-capture "so" 'consult-imenu) ('normal org-agenda-mode-map - "q" 'org-agenda-quit) + "q" 'org-agenda-quit + "r" 'org-agenda-redo) ('normal org-columns-map "j" 'outline-next-heading - "h" 'outline-previous-heading) + "h" 'outline-previous-heading + "q" 'chris/org-columns-quit) ('normal org-mode-map - "RET" 'chris/org-dwim-at-point)) + "RET" 'chris/org-dwim-at-point + "gC" 'chris/org-columns-view)) (defun chris/org-roam-capture-lesson-file () "Function to return the lesson file that is needed for TFC plan capture and move to correct position for plan insertion" @@ -484,7 +512,8 @@ :after org :config (org-superstar-mode +1) - (setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756"))) + (setq org-superstar-headline-bullets-list '("\u25c9" "\u25c8" "\u25b8" "\u25ce" "\u272c" "\u25c7" "\u2749" "\u2719" "\u2756")) + (add-hook 'org-mode-hook 'org-superstar-mode)) (defun chris/org-dwim-at-point (&optional arg) "Do-what-I-mean at point.