diff options
author | gxlin <[email protected]> | 2021-07-06 22:00:15 +0800 |
---|---|---|
committer | gxlin <[email protected]> | 2021-07-06 22:00:15 +0800 |
commit | 43b356933766807cff3cce9dda6955469f4df49c (patch) | |
tree | b13768fdd9c3d4fd00571870639a9100b1086bbf /.emacs.d/lisp | |
parent | 20f2705342e1c444bda1b4c9a2077408ae14389a (diff) | |
download | dotfiles-43b356933766807cff3cce9dda6955469f4df49c.tar.gz dotfiles-43b356933766807cff3cce9dda6955469f4df49c.tar.bz2 dotfiles-43b356933766807cff3cce9dda6955469f4df49c.zip |
Reorganized emacs config
Diffstat (limited to '.emacs.d/lisp')
-rw-r--r-- | .emacs.d/lisp/init-evil.el | 28 | ||||
-rw-r--r-- | .emacs.d/lisp/init-lang.el | 33 | ||||
-rw-r--r-- | .emacs.d/lisp/init-misc.el | 52 | ||||
-rw-r--r-- | .emacs.d/lisp/init-mu4e.el | bin | 0 -> 2610 bytes | |||
-rw-r--r-- | .emacs.d/lisp/init-org.el | 128 | ||||
-rw-r--r-- | .emacs.d/lisp/init-package.el | 14 |
6 files changed, 255 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-evil.el b/.emacs.d/lisp/init-evil.el new file mode 100644 index 0000000..6e4a95c --- /dev/null +++ b/.emacs.d/lisp/init-evil.el @@ -0,0 +1,28 @@ +(use-package evil + :ensure t + :hook ((evil-org-mode . (lambda () (setq evil-want-C-i-jump nil))) + (after-init . (lambda () (evil-mode 1)))) + :init + (setq evil-want-integration t + evil-want-C-u-scroll t + evil-wannt-fine-undo t + evil-want-keybinding nil + evil-disable-insert-state-bindings t) + :config + (evil-set-leader 'normal ",") + (evil-set-undo-system 'undo-tree)) + +(use-package evil-collection + :after evil + :ensure t +; :custom (evil-collection-setup-minibuffer t) + :config + (evil-collection-init)) + +(use-package evil-easymotion + :ensure t + :after (evil avy) + :config + (evilem-default-keybindings "SPC")) + +(provide 'init-evil) diff --git a/.emacs.d/lisp/init-lang.el b/.emacs.d/lisp/init-lang.el new file mode 100644 index 0000000..f8e96b6 --- /dev/null +++ b/.emacs.d/lisp/init-lang.el @@ -0,0 +1,33 @@ +(use-package ledger-mode + :mode (("\\.journal$" . ledger-mode))) + +(use-package markdown-mode + :ensure t + :commands (markdown-mode gfm-mode) + :mode (("README\\.md\\'" . gfm-mode) + ("\\.md\\'" . markdown-mode) + ("\\.markdown\\'" . markdown-mode)) + :init + (evil-define-key 'normal markdown-mode-map + (kbd "<RET>") 'markdown-follow-link-at-point) + (setq markdown-command "multimarkdown")) + +(use-package go-mode + :ensure t + :commands (go-mode) + :mode (("\\.go\\'" . go-mode)) + :hook ((go-mode . (lambda () (setq tab-width 4))))) + +(use-package lsp-mode + :ensure t + :hook + ((go-mode . lsp-deferred) + (lsp-mode . lsp-enable-which-key-integration)) + :commands (lsp lsp-deferred) + :config + (evil-define-key 'normal lsp-mode-map + (kbd "gd") 'lsp-find-definition + (kbd "gr") 'lsp-find-references) + (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.git\\'")) + +(provide 'init-lang) diff --git a/.emacs.d/lisp/init-misc.el b/.emacs.d/lisp/init-misc.el new file mode 100644 index 0000000..07eef14 --- /dev/null +++ b/.emacs.d/lisp/init-misc.el @@ -0,0 +1,52 @@ +(setq tab-always-indent 'complete + completion-cycle-threshold t) + +(use-package recentf + :ensure nil + :config + (add-hook 'after-init-hook 'recentf-mode) + (setq-default + recentf-max-saved-items 1024 + recentf-exclude `("/tmp/"))) + +(use-package counsel + :after evil + :init + (evil-define-key 'normal ivy-mode-map + (kbd "<leader>fb") 'ivy-switch-buffer + (kbd "<leader>fm") 'counsel-recentf) + :config + (ivy-mode 1) + (setq ivy-use-virtual-buffers t) + (setq ivy-count-format "(%d/%d) ") + (setq ivy-re-builders-alist + '((read-file-name-internal . ivy--regex-fuzzy) + (t . ivy--regex-plus)))) + +(use-package vterm + :commands (vterm) + :config + (setq vterm-kill-buffer-on-exit t)) + +(use-package exec-path-from-shell + :if (memq window-system '(mac ns)) + :ensure t + :config + (exec-path-from-shell-initialize)) + +(use-package avy + :ensure t) + +(use-package company + :init + (setq company-global-modes + '(emacs-lisp-mode go-mode ledger-mode)) + :hook ((after-init . global-company-mode))) + +(use-package projectile + :init + (evil-define-key 'normal projectile-mode-map + (kbd "<leader>p") 'projectile-command-map) + :config + (setq projectile-cache-file (expand-file-name ".cache/projectile" user-emacs-directory)) + (projectile-mode 1)) diff --git a/.emacs.d/lisp/init-mu4e.el b/.emacs.d/lisp/init-mu4e.el Binary files differnew file mode 100644 index 0000000..8a2c5a6 --- /dev/null +++ b/.emacs.d/lisp/init-mu4e.el diff --git a/.emacs.d/lisp/init-org.el b/.emacs.d/lisp/init-org.el new file mode 100644 index 0000000..caadeec --- /dev/null +++ b/.emacs.d/lisp/init-org.el @@ -0,0 +1,128 @@ +(use-package org + :ensure t + :after evil + :commands (org-mode org-agenda org-store-link org-capture) + :mode (("\\.org$" . org-mode)) + :hook ((org-mode . (lambda () (setq tab-width 4)))) + :init + (setq org-src-tab-acts-natively t) + (evil-define-key 'normal 'global + (kbd "<leader>a") 'org-agenda + (kbd "<leader>l") 'org-store-link + (kbd "<leader>c") 'org-capture) + :config + (require 'org-tempo) + (setq org-directory "~/notes/") + (setq org-default-notes-file (concat org-directory "/inbox.org")) + (setq org-capture-templates + '(("t" "TODO" entry (file+headline org-default-notes-file "Tasks") + "* TODO %?\nCaptured on %U\n %i\n %a") + ("j" "Journal" entry (file+datetree org-default-notes-file) + "* %?\nCaptured on %U\n %i\n %a"))) + (add-hook 'org-mode-hook (lambda () (setq truncate-lines nil))) + (setq org-agenda-start-on-weekday 0) + (setq org-adapt-indentation nil) + (setq org-descriptive-links nil) + (evil-define-key 'normal org-mode-map + (kbd "TAB") 'org-cycle + (kbd "RET") 'org-open-at-point + (kbd "<leader>os") 'org-schedule + (kbd "<leader>od") 'org-deadline + (kbd "<leader>or") 'org-refile + (kbd "<leader>oil") 'org-insert-link + (kbd "<leader>oih") 'org-insert-heading + (kbd "<leader>oci") 'org-clock-in + (kbd "<leader>oco") 'org-clock-out + (kbd "<leader>sp") 'org-set-property) + (setq org-tags-exclude-from-inheritance + '("PROJECT")) + + ;; refile + (setq org-refile-targets '((nil :maxlevel . 9) + (org-agenda-files :maxlevel . 9)) + org-outline-path-complete-in-steps nil + org-refile-use-outline-path 'file) + + (setq org-stuck-projects + '("+PROJECT/-SOMEDAY-DONE-MAYBE" ("NEXT") ("@shop") + "\\<IGNORE\\>")) + + ;; todo + (setq org-todo-keywords + '((sequence "TODO(t)" ; to do later + "NEXT" ; doing now or to do soon + "WAITING(w)" "SOMEDAY(s)" + "|" "DONE(d)" "CANCELED(c)"))) + (setq org-log-done t) + + ;; tags + (setq org-tag-alist '((:startgroup . nil) + ("@work" . ?w) ("@home" . ?h) ("errants" . ?e) + (:endgroup . nil) + ("phone" . ?p) + ("FLAGGED" . ?f) + ("URGENT" . ?u) + ("PROJECT" . ?p))) + + ;; org babel + (org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t))) + + ;; org-habit + (add-to-list 'org-modules 'org-habit t)) + +(use-package org-agenda + :ensure nil + :after (org) + :commands (org-agenda) + :init + (setq org-agenda-dim-blocked-tasks nil) + (setq org-agenda-skip-deadline-prewarning-if-scheduled t) + + + (setq org-deadline-warning-days 10) + (setq org-agenda-compact-blocks t) + (setq org-agenda-custom-commands + '(("D" "Daily agenda and all TODOs" + ((agenda "" ((org-agenda-span 1))) + (tags-todo "+PRIORITY=\"A\"") + (tags-todo "computer|@office|phone") + (tags "PROJECT+CATEGORY=\"elephants\"") + (todo "WAITING")) + ((org-agenda-compact-blocks t))) + ("W" "Weekly Review" + ((agenda "" ((org-agenda-ndays-to-span 7))) + (stuck "") ; review stuck porjects as designated by org-stuck-projects + (todo "NEXT") + (todo "WAITING"))) + ("d" "Upcoming deadlines" agenda "" + ((org-agenda-time-grid nil) + (org-deadline-warning-days 365) + (org-agenda-entry-types '(:deadline)))) + ("c" "Weekly schedule" agenda "" + ((org-agenda-span 7) + (org-agenda-repeating-timestamp-show-all t) + (org-agenda-entry-types '(:deadline :scheduled)))) + ("g" . "GTD contexts") + ("gh" "Home" tags-todo "home") + ("p" . "Priorities") + ("pa" "A items" tags-todo "+PRIORITIES=\"A\"") + ("pb" "B items" tags-todo "+PRIORITIES=\"B\"") + ("pc" "C items" tags-todo "+PRIORITIES=\"C\"")))) + +(use-package evil-org + :ensure t + :after (org evil) + :hook (org-mode . (lambda () (evil-org-mode))) + :config + (evil-org-set-key-theme '(navigation insert textobjects additional calendar todo)) + (require 'evil-org-agenda) + (evil-org-agenda-set-keys) + (evil-define-key 'motion org-agenda-mode-map + (kbd "q") (lambda () + (interactive) + (org-save-all-org-buffers) + (org-agenda-quit)))) + +(provide 'init-org) diff --git a/.emacs.d/lisp/init-package.el b/.emacs.d/lisp/init-package.el new file mode 100644 index 0000000..5e6a0c7 --- /dev/null +++ b/.emacs.d/lisp/init-package.el @@ -0,0 +1,14 @@ +(require 'package) +(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/"))) +(setq package-enable-at-startup nil) +(package-initialize) + +(dolist (package '(use-package)) + (unless (package-installed-p package) + (package-refresh-contents) + (package-install package))) +(require 'use-package) +(setq use-package-always-ensure t) + +(provide 'init-package) |