将一大坨配置文件写在一个文件中实在是太丑陋啦(可读性低、组织混乱…)💥💩,好在 emacs 支持使用 org 来进行 literate config📒,因此 onion 打算基于 org 重新整理他的配置🤗
🍊一些 ui 配置
(setq display-line-numbers-type t)
🍈英文字体使用 Iosevka SS09,中文字体使用微软雅黑
(setq doom-font (font-spec :family "Iosevka SS09" :size 19)
doom-symbol-font (font-spec :family "微软雅黑"))
🍏目前在使用 doom-badger 主题,对于 doom-plain-dark 主题 dashboard 颜色太奇怪啦,更改了一下配色
(setq doom-theme 'doom-badger)
(custom-theme-set-faces! 'doom-plain-dark
'(doom-dashboard-banner :foreground "gray" :weight bold))
🍇高亮提示代码太长啦
(after! highlight-indent-guides
(setq highlight-indent-guides-method 'character
highlight-indent-guides-auto-character-face-perc 65))
✨一个通用的 emacs completion 前端,这里配置与 org 集成
(setq zot-bib '("~/.org/braindump/org/biblio.bib")
zot-pdf "~/zotfile"
org-literature "~/.org/braindump/org/reference")
(require 'org-ref)
(require 'org-ref-ivy)
(use-package! ivy-bibtex
:init
(setq bibtex-completion-notes-path org-literature
bibtex-completion-bibliography zot-bib
bibtex-completion-library-path zot-pdf))
😁我最爱的 org mode
(setq org-superstar-headline-bullets-list '("◉" "✿" "✸" "⁖" "○" )
org-ellipsis " ▼ "
org-directory "~/.org/"
org-preview-latex-image-directory "/tmp/ltximg/"
org-noter-notes-search-path '("~/.org/braindump/org/reference/")
org-noter-doc-split-fraction '(0.55 0.45))
(after! org
(setq org-capture-templates
`(("i" "Inbox" entry (file "gtd/inbox.org")
,(concat "* TODO %?\n"
"/Entered on/ %U"))
("s" "Slipbox" entry (file "braindump/org/inbox.org")
"* %?\n"))))
🥰org-roam 是一个借鉴了 Zettelkasten 方法的知识管理系统, 我在这儿配置了与 org-noter、ivy 的集成(利用 org-roam-bibtex),capture 模板,默认 tag 和一些快捷键
(use-package! org-roam-bibtex
:init
(map! :leader
:prefix "nr"
:desc "insert an literature note link" "k" #'orb-insert-link
:desc "some actions for orb-note" "A" #'orb-note-actions)
:after org-roam
:hook (org-roam-mode . org-roam-bibtex-mode)
:custom
(orb-insert-interface 'ivy-bibtex)
(orb-insert-link-description 'citekey)
(orb-preformat-keywords
'("citekey" "title" "url" "author-or-editor" "keywords" "file"))
(orb-process-file-keyword t)
(orb-attached-file-extensions '("pdf")))
(use-package! org-roam
:init
(setq org-roam-directory (concat org-directory "braindump/org/")
org-roam-db-location (concat org-roam-directory "db/org-roam.db")
org-roam-db-gc-threshold most-positive-fixnum
org-roam-database-connector 'sqlite-builtin)
:config
(org-roam-db-autosync-mode +1)
(setq org-roam-capture-templates
'(("m" "main" plain
"%?"
:if-new
(file+head "main/${slug}.org" "#+title: ${title}\n")
:immediate-finish t
:unnarrowed t)
("r" "reference" plain "%?"
:if-new
(file+head "reference/${title}.org" "#+title: ${title}\n")
:immediate-finish t
:unnarrowed t)
("p" "project" plain "%?"
:if-new
(file+head "project/${title}.org" "#+title: ${title}\n")
:immediate-finish t
:unnarrowed t)
("l" "literature" plain
"#+FILETAGS: reading research \n - tags :: %^{keywords} \n* %^{title}
:PROPERTIES:\n:Custom_ID: %^{citekey}\n:URL: %^{url}\n:AUTHOR: %^{author-or-editor}\n:NOTER_DOCUMENT: ~/zotfile/%^{citekey}.pdf\n:NOTER_PAGE:\n:END:"
:target
(file+head "reference/${citekey}.org" "#+title: ${title}\n"))
("a" "article" plain "%?"
:if-new
(file+head "articles/${title}.org" "#+title: ${title}\n#+filetags: :article:\n")
:immediate-finish t
:unnarrowed t))
)
(defun onion/tag-new-node-as-draft ()
(org-roam-tag-add '("draft")))
(add-hook 'org-roam-capture-new-node-hook #'onion/tag-new-node-as-draft)
)
🤩org 的议程管理系统
(require 'find-lisp)
(setq onion/org-agenda-directory
(expand-file-name "gtd/" org-directory))
(setq org-agenda-files
(find-lisp-find-files onion/org-agenda-directory "\.org$"))
😋org-download 用于在 org 文件中便捷地插入图片
(setq org-download-image-dir "./images"
org-download-heading-lvl nil)
(after! org-download
:custom
(setq org-download-method 'directory))
(defun onion/get_current_line ()
(buffer-substring
(line-beginning-position)
(line-end-position)))
(defun onion/extract-after-colon (str)
(when (string-match "\\[\\[.*?:\\(.*?\\)\\]\\]$" str)
(match-string 1 str)))
(defun onion/org-delete-img-and-imglink ()
(interactive)
(let* ((line (onion/get_current_line))
(img-file-path (concat org-download-image-dir "/" (onion/extract-after-colon line))))
(when (file-exists-p img-file-path)
(delete-file img-file-path)
(kill-whole-line))))
(map! "C-c i d" #'onion/org-delete-img-and-imglink)
🫳翻译!It’s sad that my english is poor
(use-package! go-translate
:config
(setq gts-translate-list '(("en" "zh"))
gts-default-translator
(gts-translator
:picker
(gts-prompt-picker)
:engines
(list
(gts-google-engine)
(gts-bing-engine)
(gts-google-rpc-engine))
:render
(gts-posframe-pop-render)
;; (gts-buffer-render)
))
)
(map!
:leader
:prefix "a"
:desc "do translate" "s" #'gts-do-translate)
💨talk is cheap, show me your code
🐍I’m a pythonista
(setq conda-anaconda-home "~/.conda"
conda-env-home-directory "~/.conda"
leetcode-directory "~/leetcode")
(after! python
(add-hook
'python-mode-hook
(lambda ()
(setq-local python-indent-offset 4))))
⏲️记录 coding(摸鱼)时长
(use-package! wakatime-mode
:config
(setq wakatime-api-key "waka_63364d61-6fac-4770-b9df-1e4c5fc79f63"
wakatime-cli-path "/usr/bin/wakatime-cli")
(global-wakatime-mode))
📧暂时还没有在使用 emacs 处理邮件
(setq user-full-name "onion"
user-mail-address "[email protected]")
📚使用 emacs 阅读 pdf,配置了 pdf 文件占用大小
(add-hook 'pdf-view-mode-hook 'pdf-view-fit-width-to-window)
👌一些其他的快捷键配置
(map! "C-s" #'save-buffer)