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 "restclient"))
 33         (not (string= lang "elisp"))
 34         (not (string= lang "python"))
 35         (not (string= lang "sh"))
 36         (not (string= lang "shell"))
 37         (not (string= lang "zsh"))
 38         (not (string= lang "bash"))))
 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                               (restclient . t)))
 95
 96  (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
 97  (setq org-confirm-elisp-link-function nil)
 98
 99  ;; export configuration
100  (setq org-ascii-text-width 100
101        org-export-with-section-numbers nil
102        org-export-with-creator t
103        org-export-with-email nil
104        org-html-validation-link nil
105        org-html-html5-fancy t
106        org-html-doctype "xhtml5"
107        org-html-viewport '((width "device-width")
108                            (initial-scale "1")))
109  (setq org-fold-core-style 'overlays) ;; expand when search
110  :bind
111  ("C-c a" . org-agenda)
112  ("C-c c" . org-capture)
113
114
115  (:map org-mode-map
116        ("C-j" . nil) ;; unbond org-return-and-maybe-indent, keep binding to god-mode
117        ("C-M-<return>" . org-insert-todo-heading)))
118
119(use-package org
120  :defer
121  :config
122  (setq org-ascii-text-width 100)
123
124  (setq org-html-validation-link nil
125  ;;       org-html-head-include-scripts nil
126  ;;       org-html-head-include-default-style nil
127        org-html-html5-fancy t
128        org-html-doctype "xhtml5"
129  ;;       org-html-head "<link rel=\"stylesheet\" href=\"https://io.lin.moe/css/simple.min.css\" />\n<link rel=\"icon\" href=\"data:,\">"
130  ;;       org-html-self-link-headlines nil
131        org-html-viewport '((width "device-width")
132                            (initial-scale "1")))
133
134  (setq  org-export-with-section-numbers nil
135         org-export-with-creator t
136         org-export-with-email nil))
137
138(use-package org-pomodoro
139  :commands (org-pomodoro)
140  :config
141  (require 'alert)
142  (setq alert-default-style 'libnotify
143        org-pomodoro-manual-break t))
144
145(use-package org
146  :bind
147  (:map org-mode-map
148        ("C-c p" . org-pomodoro)))
149
150(provide 'init-textfile)
151;;; init-textfile.el ends here