diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | config/emacs/gtd.el | 64 | ||||
| -rw-r--r-- | config/emacs/init.el | 50 | ||||
| -rw-r--r-- | config/emacs/sanemacs.el | 52 | ||||
| -rw-r--r-- | config/nvim/lua/ft/rust.lua | 2 |
5 files changed, 120 insertions, 49 deletions
@@ -1,2 +1,3 @@ +config/emacs/bookmarks config/emacs/eln-cache/ config/nvim/plugin/packer_compiled.lua diff --git a/config/emacs/gtd.el b/config/emacs/gtd.el new file mode 100644 index 0000000..72e6037 --- /dev/null +++ b/config/emacs/gtd.el @@ -0,0 +1,64 @@ +;;; +;;; GTD Org-mode Setup <https://www.labri.fr/perso/nrougier/GTD/index.html> +;;; + +(require 'org) + +;;; Configure Org-mode +(setq org-directory "~/Documents/Org") + +;;; Org capture templates +(setq + org-capture-templates `( + ("i" "Inbox" entry (file "inbox.org") + ,(concat "* TODO %?\n" + "/Entered on/ %U")))) +(defun gtd-org-capture-inbox () + (interactive) + (org-capture nil "i")) + +;;; Org agenda +(setq + org-agenda-files (list "inbox.org" "projects.org") + org-agenda-hide-tags-regexp "." + org-agenda-prefix-format '((agenda . " %i %-12:c%?-12t% s") + (todo . " ") + (tags . " %i %-12:c") + (search . " %i %-12:c")) + org-agenda-custom-commands '( + ("g" "Get Things Done (GTD)" + ((agenda "" + ((org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline)) + (org-deadline-warning-days 0))) + (todo "NEXT" + ((org-agenda-skip-function '(org-agenda-skip-entry-if 'deadline)) + (org-agenda-prefix-format " %i %-12:c [%e] ") + (org-agenda-overriding-header "\nTasks\n"))) + (tags-todo "inbox" + ((org-agenda-prefix-format " %?-12t% s") + (org-agenda-overriding-header "\nInbox\n"))) + (tags "CLOSED>=\"<today>\"" + ((org-agenda-overriding-header "\nCompleted today\n"))))))) +(add-hook 'org-agenda-mode-hook 'delete-other-windows) + +;;; Org refiling +(setq + org-refile-targets '(("projects.org" :regexp . "\\(?:\\(?:Note\\|Task\\)s\\)")) + org-refile-use-outline-path 'file + org-outline-path-complete-in-steps nil) + +;;; Org todo +(setq + org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "HOLD(h)" "|" "DONE(d)")) + org-log-done 'time) +(defun gtd-log-todo-next-creation-date (&rest ignore) + "Log NEXT creation time in the property drawer under the key 'ACTIVATED'" + (when (and (string= (org-get-todo-state) "NEXT") + (not (org-entry-get nil "ACTIVATED"))) + (org-entry-put nil "ACTIVATED" (format-time-string "[%Y-%m-%d]")))) +(add-hook 'org-after-todo-state-change-hook #'gtd-log-todo-next-creation-date) + +;;; Key bindings +(define-key global-map (kbd "C-c c") 'org-capture) +(define-key global-map (kbd "C-c i") 'gtd-org-capture-inbox) +(define-key global-map (kbd "C-c a") 'org-agenda) diff --git a/config/emacs/init.el b/config/emacs/init.el index 024e255..0532f21 100644 --- a/config/emacs/init.el +++ b/config/emacs/init.el @@ -1,51 +1,5 @@ -;;; Customize Emacs -(if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) -(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) -(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) -(column-number-mode) -(fset 'yes-or-no-p 'y-or-n-p) -(setq - inhibit-startup-screen t - initial-scratch-message "" - sentence-end-double-space nil) -(setq-default - cursor-type 'bar - show-trailing-whitespace t - tab-width 4) - -;;; Write auto-saves and backups to `.cache` directory -(setq - auto-save-list-file-prefix "~/.cache/emacs/auto-save/" - auto-save-file-name-transforms '((".*" "~/.cache/emacs/auto-save/" t)) - backup-by-copying t - backup-directory-alist '((".*" . "~/.cache/emacs/backup/")) - create-lockfiles nil) - -;;; Setup `package.el` -(require 'package) -(setq - package-enable-at-startup nil - package-user-dir "~/.cache/emacs/elpa/" - package-gnupghome-dir "~/.cache/emacs/elpa/gnupg") -(add-to-list 'package-archives - '("melpa" . "https://melpa.org/packages/")) -(unless package--initialized (package-initialize)) - -;;; Setup `use-package` -(unless (package-installed-p 'use-package) - (package-refresh-contents) - (package-install 'use-package)) -(eval-when-compile (require 'use-package)) -(setq use-package-always-ensure t) - -;;; Setup Modus theme -(load-theme 'modus-operandi) - -;;; Use separate file for custom variables -(setq custom-file "~/.cache/emacs/custom.el") -(unless (file-exists-p custom-file) - (write-region "" nil custom-file)) -(load custom-file nil t) +(load "~/.config/emacs/sanemacs.el" nil t) +(load "~/.config/emacs/gtd.el" nil t) ;;; TODO(nlordell): ;;; 1. Setup `which-keys` for command discoverability diff --git a/config/emacs/sanemacs.el b/config/emacs/sanemacs.el new file mode 100644 index 0000000..ab89bc9 --- /dev/null +++ b/config/emacs/sanemacs.el @@ -0,0 +1,52 @@ +;;; +;;; Sanemacs <https://sanemacs.com> +;;; + +;;; Customize Emacs +(if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) +(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) +(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) +(column-number-mode) +(fset 'yes-or-no-p 'y-or-n-p) +(setq + inhibit-startup-screen t + initial-scratch-message "" + sentence-end-double-space nil) +(setq-default + cursor-type 'bar + show-trailing-whitespace t + tab-width 4) + +;;; Write auto-saves and backups to `.cache` directory +(setq + auto-save-list-file-prefix "~/.cache/emacs/auto-save/" + auto-save-file-name-transforms '((".*" "~/.cache/emacs/auto-save/" t)) + backup-by-copying t + backup-directory-alist '((".*" . "~/.cache/emacs/backup/")) + create-lockfiles nil) + +;;; Setup `package.el` +(require 'package) +(setq + package-enable-at-startup nil + package-user-dir "~/.cache/emacs/elpa/" + package-gnupghome-dir "~/.cache/emacs/elpa/gnupg") +(add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/")) +(unless package--initialized (package-initialize)) + +;;; Setup `use-package` +(unless (package-installed-p 'use-package) + (package-refresh-contents) + (package-install 'use-package)) +(eval-when-compile (require 'use-package)) +(setq use-package-always-ensure t) + +;;; Setup Modus theme +(load-theme 'modus-operandi) + +;;; Use separate file for custom variables +(setq custom-file "~/.cache/emacs/custom.el") +(unless (file-exists-p custom-file) + (write-region "" nil custom-file)) +(load custom-file nil t) diff --git a/config/nvim/lua/ft/rust.lua b/config/nvim/lua/ft/rust.lua index 6d15417..46e6306 100644 --- a/config/nvim/lua/ft/rust.lua +++ b/config/nvim/lua/ft/rust.lua @@ -7,7 +7,7 @@ keys.register({ b = {"<cmd>!cargo build<cr>", "Build"}, c = {"<cmd>!cargo clippy<cr>", "Check"}, C = {"<cmd>!cargo clippy --workspace --all-features --all-targets<cr>", "Check Workspace"}, - F = {"<cmd>!cargo +nightly fmt --all<cr>", "Format Workspace"}, + F = {"<cmd>!cargo +nightly fmt --version 2>/dev/null && cargo +nightly fmt --all || cargo fmt --all<cr>", "Format Workspace"}, r = {"<cmd>!cargo run<cr>", "Run"}, t = {"<cmd>!cargo test<cr>", "Test"}, T = {"<cmd>!cargo test --workspace --all-features<cr>", "Test Workspace"}, |
