1;;; package --- 文本文件编辑配置2;;; Commentary:3;;; Code:45;; Yaml6(use-package yaml-mode7 :mode ("\\.yaml\\'" "\\.yml\\'"))89;; Markdown10(use-package markdown-mode11 :commands (markdown-mode gfm-mode)12 :config13 (setq markdown-fontify-code-blocks-natively t14 markdown-enable-highlighting-syntax t)15 :mode (("README\\.md\\'" . gfm-mode)16 ("\\.md\\'" . markdown-mode)17 ("\\.markdown\\'" . markdown-mode)))1819(use-package org20 :mode (("\\.org$" . org-mode))21 :init22 ;; 定义 org 工作目录23 (defvar my-orgbase (getenv "ORGBASE" ))24 (if (not my-orgbase)25 (setq my-orgbase "~/orgs"))2627 (defvar my-orginbox (concat (file-name-as-directory my-orgbase) "inbox.org"))28 (defvar my-orgdaily (concat (file-name-as-directory my-orgbase) "daily.org"))2930 ;; org-babel 执行确认函数,部分语言不需要确认31 (defun my-org-confirm-babel-evaluate (lang body)32 (and (not (string= lang "elisp"))33 (not (string= lang "python"))34 (not (string= lang "sh"))35 (not (string= lang "shell"))36 (not (string= lang "zsh"))37 (not (string= lang "bash"))38 (not (string= lang "verb"))))3940 ;; Org Agenda 的显示位置41 (add-to-list 'display-buffer-alist '("*Org Agenda*"42 (display-buffer-in-side-window)43 (side . right)44 (window-width . 0.3)45 (slot . 0)))4647 (setq initial-buffer-choice (lambda() (let ((dashboard (find-file-read-only (concat (file-name-as-directory my-orgbase) "dashboard.org"))))48 (cd "~/")49 (switch-to-buffer dashboard))))50 :config51 (require 'org-protocol)52 (add-to-list 'org-modules 'org-tempo t)5354 (setq org-todo-keywords '((sequence "TODO(t)" "DOING(i)" "|" "DONE(d)" "ABORT(a)"))55 org-todo-keyword-faces '(("TODO" . "red")56 ("DOING" . "yellow")57 ("ABORT" . "gray")58 ("DONE" . "green")))59 (setq org-default-notes-file my-orginbox)60 (setq org-archive-location "%s_archive::datetree/")61 (setq org-capture-templates62 '(63 ;; 单词64 ("v" "Vocabulary" entry (file+headline my-orginbox "Vocabulary")65 "* %^{Word} :drill:\n%^{Context} \n** The Answer \n%?")66 ;; 日志67 ("d" "Dairly Record" entry (file+olp+datetree my-orgdaily) "* %U %?" :tree-type week )6869 ;; 任务70 ("t" "Task" entry (file+headline my-orginbox "Tasks") "* TODO %?\n%u")7172 ;; 问题73 ("q" "Question" entry (file+headline my-orginbox "Questions") "* %^{Title} \n %?")7475 ;; org-protocol76 ("p" "Protocol" entry (file+headline my-orginbox "WebClip")77 "* %^{Title} :quote: \nSource: %u, %l\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n%?")78 ("L" "Protocol Link" entry (file+headline my-orginbox "WebClip")79 "* [[%:link][%:description]] :link:\nCaptured On: %U\n%?")))8081 ;; org 代码块缩进82 ;; (setq org-src-preserve-indentation nil83 ;; org-edit-src-content-indentation 0)84 ;;85 ;; (setq python-shell-completion-native-enable nil)8687 ;; org babel 语言88 (org-babel-do-load-languages89 'org-babel-load-languages '((shell . t)90 (C . t)91 (go . t)92 (emacs-lisp . t)93 (python . t)94 (scheme . t)95 (makefile . t)96 (verb . t)))9798 (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)99 (setq org-confirm-elisp-link-function nil)100101 ;; export configuration102 (setq org-ascii-text-width 100103 org-export-with-section-numbers nil104 org-export-with-creator t105 org-export-with-email nil106 org-html-validation-link nil107 org-html-html5-fancy t108 org-html-doctype "xhtml5"109 org-html-viewport '((width "device-width")110 (initial-scale "1")))111 (setq org-fold-core-style 'overlays) ;; expand when search112 :bind113 ("C-c a" . org-agenda)114 ("C-c c" . org-capture)115116117 (:map org-mode-map118 ("C-j" . nil) ;; unbond org-return-and-maybe-indent, keep binding to god-mode119 ("C-M-<return>" . org-insert-todo-heading)))120121(use-package org122 :defer123 :config124 (setq org-ascii-text-width 100)125126 (setq org-html-validation-link nil127 ;; org-html-head-include-scripts nil128 ;; org-html-head-include-default-style nil129 org-html-html5-fancy t130 org-html-doctype "xhtml5"131 ;; org-html-head "<link rel=\"stylesheet\" href=\"https://io.lin.moe/css/simple.min.css\" />\n<link rel=\"icon\" href=\"data:,\">"132 ;; org-html-self-link-headlines nil133 org-html-viewport '((width "device-width")134 (initial-scale "1")))135136 (setq org-export-with-section-numbers nil137 org-export-with-creator t138 org-export-with-email nil))139140(use-package org-pomodoro141 :commands (org-pomodoro)142 :config143 (require 'alert)144 (setq alert-default-style 'libnotify145 org-pomodoro-manual-break t))146147(use-package org148 :bind149 (:map org-mode-map150 ("C-c p" . org-pomodoro)))151152(use-package verb)153154(provide 'init-textfile)155;;; init-textfile.el ends here