From b44cc3faac5b651a4a2fc9565d8200cdbea5f904 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Tue, 11 Apr 2023 09:40:53 -0500 Subject: [PATCH] adding some tweaks and dired-sidebar --- README.org | 56 ++++++++++++++++++++++++++++++++++++++++++++++++------ init.el | 48 +++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 93 insertions(+), 11 deletions(-) diff --git a/README.org b/README.org index c9957b9b..24d9e818 100644 --- a/README.org +++ b/README.org @@ -529,7 +529,9 @@ This evil-collection package includes a lot of other evil based things. "C-S-l" 'evil-window-increase-width "C-S-j" 'evil-window-decrease-height "C-S-k" 'evil-window-increase-height - "C-S-h" 'evil-window-decrease-width) + "C-S-h" 'evil-window-decrease-width + "zi" 'text-scale-increase + "zd" 'text-scale-decrease) (general-def 'normal Info-mode-map "RET" 'Info-follow-nearest-node "p" 'Info-prev @@ -1016,6 +1018,16 @@ We also need to setup some capture templates to use some specific setups with my :file-name "%<%Y-%m-%d>-bib" :target (file+head "%<%Y-%m-%d>-bib.org" "#+TITLE: %<%Y-%m-%d> - Biblical\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n\n* Notes") :unnarrowed t))) + (defun chris/org-roam-node-create () + "Create an org roam node underneath this org node" + (interactive) + (+org/insert-item-below 1) + (org-id-get-create)) + (defun chris/org-roam-node-id-create () + "Make the basic org node and org roam one by adding an id and creating an alias" + (interactive) + (org-id-get-create) + (org-roam-alias-add)) ;; (set-face-attribute 'magit-section-highlight nil :inherit 'variable-pitch) (org-roam-setup) :general @@ -1024,11 +1036,14 @@ We also need to setup some capture templates to use some specific setups with my :keymaps 'override "nf" '(org-roam-node-find :which-key "org roam ff") "nr" 'org-roam-buffer-toggle - "ni" 'org-roam-node-insert + "ni" 'chris/org-roam-node-create + "nl" 'org-roam-node-insert "nc" 'org-roam-capture "nt" 'org-roam-dailies-goto-today "ng" 'org-roam-graph - "in" 'org-roam-node-insert) + "na" 'org-roam-alias-add + "in" 'org-roam-node-insert + "nA" 'chris/org-roam-node-id-create) (chris/leader-keys :states 'visual :keymaps 'override @@ -1549,7 +1564,7 @@ Made for `org-tab-first-hook' in evil-mode." `org-cycle's standard behavior is to cycle between three levels: collapsed, subtree and whole document. This is slow, especially in larger org buffer. Most of the time I just want to peek into the current subtree -- at most, expand -*only* the current subtree. +,*only* the current subtree. All my (performant) foldings needs are met between this and `org-show-subtree' (on zO for evil users), and `org-cycle' on shift-TAB if I need it." @@ -1596,6 +1611,15 @@ All my (performant) foldings needs are met between this and `org-show-subtree' (add-hook 'before-save-hook #'org-update-parent-todo-statistics nil t)) #+end_src +Here we can add those functions to the proper keys in both normal and insert mode. + +#+begin_src emacs-lisp +(general-def 'normal org-mode-map + "C-" '+org/insert-item-below) +(general-def 'insert org-mode-map + "C-" '+org/insert-item-below) +#+end_src + #+RESULTS: : +org-enable-auto-update-cookies-h @@ -2404,6 +2428,10 @@ Ace link provides an avy like search for links. Upon using the keybindings prese (display-buffer-in-side-window) (side . right) (window-width . 0.4)) + ("*dired-side*" + (display-buffer-in-side-window) + (side . left) + (window-width . 0.3)) ("*org-roam*" (display-buffer-in-side-window) (side . right) @@ -2772,7 +2800,8 @@ Fish is my preferred shell and made some scripts in it so I keep this to be able It's probably smart to have markdown. #+begin_src emacs-lisp (use-package markdown-mode - :mode ("\\.md\\'" . markdown-mode) + :mode (("\\.md\\'" . markdown-mode) + ("\\.rmd\\'". markdown-mode)) :config (setq markdown-fontify-code-blocks-natively t) (add-hook 'markdown-mode-hook 'chris/org-mode-setup) @@ -2891,6 +2920,12 @@ I'm making a small function in here to open files in the appropriate program usi (visual-line-mode nil) (dired-hide-details-mode t)) + (defun chris/open-dired-sidewindow () + "Open dired as a side window to the main window on the left" + (interactive) + (with-current-buffer (get-buffer-create "dired-side") + (dired-jump))) + (setq dired-dwim-target t delete-by-moving-to-trash t dired-mouse-drag-files t) @@ -2922,6 +2957,15 @@ We need a function to copy the full filename to kill-ring (clipboard-kill-ring-save nil nil file))) #+end_src +#+begin_src emacs-lisp +(use-package dired-sidebar + :ensure t + :commands (dired-sidebar-toggle-sidebar) + :general + (general-def 'normal + "gD" 'dired-sidebar-toggle-sidebar)) +#+end_src + #+begin_src emacs-lisp (use-package all-the-icons-dired :hook (dired-mode . all-the-icons-dired-mode)) @@ -3143,7 +3187,7 @@ Ledger mode (setq mu4e-bookmarks '((:name "Unread messages" - :query "flag:unread AND NOT flag:trashed AND NOT maildir:\"/outlook/Junk\" AND NOT maildir:\"/office/Junk Email\" AND NOT maildir:\"/outlook/Deleted\" AND NOT maildir:\"/office/Deleted Items\" AND NOT maildir:\"/office/Archive\" AND NOT maildir:\"/outlook/Archive\" AND NOT maildir:\"/cochrun/Archive\"" + :query "flag:unread AND NOT flag:trashed AND NOT maildir:\"/outlook/Junk\" AND NOT maildir:\"/office/Junk Email\" AND NOT maildir:\"/outlook/Deleted\" AND NOT maildir:\"/office/Deleted Items\" AND NOT maildir:\"/office/Archive\" AND NOT maildir:\"/outlook/Archive\" AND NOT maildir:\"/cochrun/Archive\" AND NOT maildir:\"/cochrun/Junk\"" :key 117) (:name "Today's messages" :query "date:today..now" diff --git a/init.el b/init.el index bd104739..1967a065 100644 --- a/init.el +++ b/init.el @@ -271,7 +271,9 @@ "C-S-l" 'evil-window-increase-width "C-S-j" 'evil-window-decrease-height "C-S-k" 'evil-window-increase-height - "C-S-h" 'evil-window-decrease-width) + "C-S-h" 'evil-window-decrease-width + "zi" 'text-scale-increase + "zd" 'text-scale-decrease) (general-def 'normal Info-mode-map "RET" 'Info-follow-nearest-node "p" 'Info-prev @@ -719,6 +721,16 @@ much faster. The hope is to also make this a faster version of imenu." :file-name "%<%Y-%m-%d>-bib" :target (file+head "%<%Y-%m-%d>-bib.org" "#+TITLE: %<%Y-%m-%d> - Biblical\n#+AUTHOR: Chris Cochrun\n#+CREATED: %<%D - %I:%M %p>\n\n* Notes") :unnarrowed t))) + (defun chris/org-roam-node-create () + "Create an org roam node underneath this org node" + (interactive) + (+org/insert-item-below 1) + (org-id-get-create)) + (defun chris/org-roam-node-id-create () + "Make the basic org node and org roam one by adding an id and creating an alias" + (interactive) + (org-id-get-create) + (org-roam-alias-add)) ;; (set-face-attribute 'magit-section-highlight nil :inherit 'variable-pitch) (org-roam-setup) :general @@ -727,11 +739,14 @@ much faster. The hope is to also make this a faster version of imenu." :keymaps 'override "nf" '(org-roam-node-find :which-key "org roam ff") "nr" 'org-roam-buffer-toggle - "ni" 'org-roam-node-insert + "ni" 'chris/org-roam-node-create + "nl" 'org-roam-node-insert "nc" 'org-roam-capture "nt" 'org-roam-dailies-goto-today "ng" 'org-roam-graph - "in" 'org-roam-node-insert) + "na" 'org-roam-alias-add + "in" 'org-roam-node-insert + "nA" 'chris/org-roam-node-id-create) (chris/leader-keys :states 'visual :keymaps 'override @@ -1266,6 +1281,11 @@ All my (performant) foldings needs are met between this and `org-show-subtree' (add-hook 'evil-insert-state-exit-hook #'org-update-parent-todo-statistics nil t)) (add-hook 'before-save-hook #'org-update-parent-todo-statistics nil t)) +(general-def 'normal org-mode-map + "C-" '+org/insert-item-below) +(general-def 'insert org-mode-map + "C-" '+org/insert-item-below) + (use-package org-re-reveal :ensure nil :config @@ -1771,6 +1791,10 @@ targets." (display-buffer-in-side-window) (side . right) (window-width . 0.4)) + ("*dired-side*" + (display-buffer-in-side-window) + (side . left) + (window-width . 0.3)) ("*org-roam*" (display-buffer-in-side-window) (side . right) @@ -1998,7 +2022,8 @@ targets." :mode ("\\.fish\\'" . fish-mode)) (use-package markdown-mode - :mode ("\\.md\\'" . markdown-mode) + :mode (("\\.md\\'" . markdown-mode) + ("\\.rmd\\'". markdown-mode)) :config (setq markdown-fontify-code-blocks-natively t) (add-hook 'markdown-mode-hook 'chris/org-mode-setup) @@ -2087,6 +2112,12 @@ targets." (visual-line-mode nil) (dired-hide-details-mode t)) + (defun chris/open-dired-sidewindow () + "Open dired as a side window to the main window on the left" + (interactive) + (with-current-buffer (get-buffer-create "dired-side") + (dired-jump))) + (setq dired-dwim-target t delete-by-moving-to-trash t dired-mouse-drag-files t) @@ -2114,6 +2145,13 @@ targets." (let* ((file (dired-get-filename))) (clipboard-kill-ring-save nil nil file))) +(use-package dired-sidebar + :ensure t + :commands (dired-sidebar-toggle-sidebar) + :general + (general-def 'normal + "gD" 'dired-sidebar-toggle-sidebar)) + (use-package all-the-icons-dired :hook (dired-mode . all-the-icons-dired-mode)) @@ -2264,7 +2302,7 @@ targets." (setq mu4e-bookmarks '((:name "Unread messages" - :query "flag:unread AND NOT flag:trashed AND NOT maildir:\"/outlook/Junk\" AND NOT maildir:\"/office/Junk Email\" AND NOT maildir:\"/outlook/Deleted\" AND NOT maildir:\"/office/Deleted Items\" AND NOT maildir:\"/office/Archive\" AND NOT maildir:\"/outlook/Archive\" AND NOT maildir:\"/cochrun/Archive\"" + :query "flag:unread AND NOT flag:trashed AND NOT maildir:\"/outlook/Junk\" AND NOT maildir:\"/office/Junk Email\" AND NOT maildir:\"/outlook/Deleted\" AND NOT maildir:\"/office/Deleted Items\" AND NOT maildir:\"/office/Archive\" AND NOT maildir:\"/outlook/Archive\" AND NOT maildir:\"/cochrun/Archive\" AND NOT maildir:\"/cochrun/Junk\"" :key 117) (:name "Today's messages" :query "date:today..now"