dotfiles

Alpine Linux dotfiles

git clone git://git.lin.moe/dotfiles.git

  1;;; package --- 文本文件编辑配置
  2;;; Commentary:
  3;;; Code:
  4
  5;; Yaml
  6(use-package yaml-mode
  7  :mode ("\\.yaml\\'" "\\.yml\\'"))
  8
  9;; Markdown
 10(use-package markdown-mode
 11  :commands (markdown-mode gfm-mode)
 12  :config
 13  (setq markdown-fontify-code-blocks-natively t
 14        markdown-enable-highlighting-syntax t)
 15  :mode (("README\\.md\\'" . gfm-mode)
 16         ("\\.md\\'" . markdown-mode)
 17         ("\\.markdown\\'" . markdown-mode)))
 18
 19(use-package org
 20  :mode (("\\.org$" . org-mode))
 21  :init
 22  ;; 定义 org 工作目录
 23  (defvar my-orgbase (getenv "ORGBASE" ))
 24  (if (not my-orgbase)
 25      (setq my-orgbase "~/orgs"))
 26
 27  (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"))
 29
 30  ;; 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"))))
 39
 40  ;; 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)))
 46
 47  (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  :config
 51  (require 'org-protocol)
 52  (add-to-list 'org-modules 'org-tempo t)
 53
 54  (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-templates
 62        '(
 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 )
 68
 69          ;; 任务
 70          ("t" "Task" entry (file+headline my-orginbox "Tasks") "* TODO %?\n%u")
 71
 72          ;; 问题
 73          ("q" "Question" entry (file+headline my-orginbox "Questions") "* %^{Title} \n %?")
 74
 75          ;; org-protocol
 76          ("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%?")))
 80
 81  ;; org 代码块缩进
 82  ;; (setq org-src-preserve-indentation nil
 83  ;; 	org-edit-src-content-indentation 0)
 84  ;;
 85  ;; (setq python-shell-completion-native-enable nil)
 86
 87  ;; org babel 语言
 88  (org-babel-do-load-languages
 89   '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)))
 97
 98  (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
 99  (setq org-confirm-elisp-link-function nil)
100
101  ;; export configuration
102  (setq org-ascii-text-width 100
103        org-export-with-section-numbers nil
104        org-export-with-creator t
105        org-export-with-email nil
106        org-html-validation-link nil
107        org-html-html5-fancy t
108        org-html-doctype "xhtml5"
109        org-html-viewport '((width "device-width")
110                            (initial-scale "1")))
111  (setq org-fold-core-style 'overlays) ;; expand when search
112  :bind
113  ("C-c a" . org-agenda)
114  ("C-c c" . org-capture)
115
116
117  (:map org-mode-map
118        ("C-j" . nil) ;; unbond org-return-and-maybe-indent, keep binding to god-mode
119        ("C-M-<return>" . org-insert-todo-heading)))
120
121(use-package org
122  :defer
123  :config
124  (setq org-ascii-text-width 100)
125
126  (setq org-html-validation-link nil
127  ;;       org-html-head-include-scripts nil
128  ;;       org-html-head-include-default-style nil
129        org-html-html5-fancy t
130        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 nil
133        org-html-viewport '((width "device-width")
134                            (initial-scale "1")))
135
136  (setq  org-export-with-section-numbers nil
137         org-export-with-creator t
138         org-export-with-email nil))
139
140(use-package org-pomodoro
141  :commands (org-pomodoro)
142  :config
143  (require 'alert)
144  (setq alert-default-style 'libnotify
145        org-pomodoro-manual-break t))
146
147(use-package org
148  :bind
149  (:map org-mode-map
150        ("C-c p" . org-pomodoro)))
151
152(use-package verb)
153
154(provide 'init-textfile)
155;;; init-textfile.el ends here