tangle config
This commit is contained in:
parent
9cd051ab51
commit
c40505f41d
4 changed files with 890 additions and 409 deletions
686
config.el
Executable file → Normal file
686
config.el
Executable file → Normal file
|
@ -1,107 +1,8 @@
|
|||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
(setq doom-theme 'ef-spring) ;;春天来了!
|
||||
|
||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
||||
;; sync' after modifying this file!
|
||||
|
||||
|
||||
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
||||
;; clients, file templates and snippets. It is optional.
|
||||
(setq user-full-name "SouthFox"
|
||||
user-mail-address "master@southfox.me")
|
||||
|
||||
;; Doom exposes five (optional) variables for controlling fonts in Doom:
|
||||
;;
|
||||
;; - `doom-font' -- the primary font to use
|
||||
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
|
||||
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
||||
;; presentations or streaming.
|
||||
;; - `doom-unicode-font' -- for unicode glyphs
|
||||
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
|
||||
;;
|
||||
;; See 'C-h v doom-font' for documentation and more examples of what they
|
||||
;; accept. For example:
|
||||
;;
|
||||
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
|
||||
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
|
||||
;;
|
||||
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
|
||||
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
|
||||
;; refresh your font settings. If Emacs still can't find your font, it likely
|
||||
;; wasn't installed correctly. Font issues are rarely Doom issues!
|
||||
|
||||
|
||||
|
||||
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
||||
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
||||
;;
|
||||
;; (after! PACKAGE
|
||||
;; (setq x y))
|
||||
;;
|
||||
;; The exceptions to this rule:
|
||||
;;
|
||||
;; - Setting file/directory variables (like `org-directory')
|
||||
;; - Setting variables which explicitly tell you to set them before their
|
||||
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
|
||||
;; - Setting doom variables (which start with 'doom-' or '+').
|
||||
;;
|
||||
;; Here are some additional functions/macros that will help you configure Doom.
|
||||
;;
|
||||
;; - `load!' for loading external *.el files relative to this one
|
||||
;; - `use-package!' for configuring packages
|
||||
;; - `after!' for running code after a package has loaded
|
||||
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
||||
;; this file. Emacs searches the `load-path' when you load packages with
|
||||
;; `require' or `use-package'.
|
||||
;; - `map!' for binding new keys
|
||||
;;
|
||||
;; To get information about any of these functions/macros, move the cursor over
|
||||
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
||||
;; This will open documentation for it, including demos of how they are used.
|
||||
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
|
||||
;; etc).
|
||||
;;
|
||||
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
||||
;; they are implemented.
|
||||
|
||||
;;; doom
|
||||
;; There are two ways to load a theme. Both assume the theme is installed and
|
||||
;; available. You can either set `doom-theme' or manually load a theme with the
|
||||
;; `load-theme' function. This is the default:
|
||||
(setq doom-theme 'ef-spring)
|
||||
(cnfonts-mode 1)
|
||||
(beacon-mode 1)
|
||||
(good-scroll-mode 1)
|
||||
(setq word-wrap-by-category t)
|
||||
|
||||
(load! "secrets")
|
||||
(setq-default custom-file (expand-file-name "secrets.el" doom-user-dir))
|
||||
(when (file-exists-p custom-file)
|
||||
(load custom-file))
|
||||
|
||||
(defun my-add-to-multiple-hooks (function hooks)
|
||||
(mapc (lambda (hook)
|
||||
(add-hook hook function))
|
||||
hooks))
|
||||
|
||||
;;clippy
|
||||
(map! :leader
|
||||
(:prefix ("c h" . "Help info from Clippy")
|
||||
:desc "Clippy describes function under point" "f" #'clippy-describe-function
|
||||
:desc "Clippy describes variable under point" "v" #'clippy-describe-variable))
|
||||
|
||||
;;shell
|
||||
(setq shell-file-name "/bin/zsh"
|
||||
vterm-max-scrollback 5000)
|
||||
|
||||
;;font
|
||||
(add-to-list 'default-frame-alist '(height . 35))
|
||||
(add-to-list 'default-frame-alist '(width . 102))
|
||||
|
||||
;; (setq doom-font (font-spec :size 16)
|
||||
;; doom-big-font (font-spec :size 24)
|
||||
;; doom-variable-pitch-font (font-spec :size 16))
|
||||
|
||||
;; dashboard banner
|
||||
(defun doom-dashboard-draw-ascii-emacs-banner-fn ()
|
||||
(let* ((banner
|
||||
'(" , "
|
||||
|
@ -137,117 +38,202 @@
|
|||
;(unless (display-graphic-p) ; for some reason this messes up the graphical splash screen atm
|
||||
(setq +doom-dashboard-ascii-banner-fn #'doom-dashboard-draw-ascii-emacs-banner-fn) ;)
|
||||
|
||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||
(setq display-line-numbers-type t)
|
||||
(after! org
|
||||
(setq org-directory "~/org/"
|
||||
org-image-actual-width '(400)
|
||||
org-link-search-must-match-exact-headline nil
|
||||
org-log-done 'time
|
||||
org-log-into-drawer t))
|
||||
|
||||
;; debuger
|
||||
(after! dap-mode
|
||||
(setq dap-python-debugger 'debugpy))
|
||||
(setq org-agenda-files '("~/Nextcloud/gtd/inbox.org"
|
||||
"~/Nextcloud/gtd/gtd.org"
|
||||
"~/Nextcloud/gtd/tickler.org"))
|
||||
|
||||
(map! :map dap-mode-map
|
||||
:leader
|
||||
:prefix ("d" . "dap")
|
||||
;;; basics
|
||||
:desc "dap next" "n" #'dap-next
|
||||
:desc "dap step in" "i" #'dap-step-in
|
||||
:desc "dap step out" "o" #'dap-step-out
|
||||
:desc "dap continue" "c" #'dap-continue
|
||||
:desc "dap hydra" "h" #'dap-hydra
|
||||
:desc "dap debug restart" "r" #'dap-debug-restart
|
||||
:desc "dap debug" "s" #'dap-debug
|
||||
(after! org
|
||||
(setq org-capture-templates '(("t" "Todo [inbox]" entry
|
||||
(file "~/Nextcloud/gtd/inbox.org")
|
||||
"* TODO %i%? \n SCHEDULED: %t")
|
||||
("T" "Tickler" entry
|
||||
(file+headline "~/Nextcloud/gtd/tickler.org" "Tickler")
|
||||
"* %i%? \n %U"))))
|
||||
|
||||
;;; debug
|
||||
:prefix ("dd" . "Debug")
|
||||
:desc "dap debug recent" "r" #'dap-debug-recent
|
||||
:desc "dap debug last" "l" #'dap-debug-last
|
||||
(setq org-roam-directory "~/Nextcloud/Note/org-roam")
|
||||
(setq org-roam-capture-templates
|
||||
'(("m" "main" plain
|
||||
"%?"
|
||||
:if-new (file+head "main/%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
"#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("r" "references" plain "%?"
|
||||
:if-new
|
||||
(file+head "references/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("t" "ttk" plain "%?"
|
||||
:if-new
|
||||
(file+head "ttk/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("a" "article" plain "%?"
|
||||
:if-new
|
||||
(file+head "articles/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+filetags: :article: :publish:\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)))
|
||||
|
||||
;;; eval
|
||||
:prefix ("de" . "Eval")
|
||||
:desc "eval" "e" #'dap-eval
|
||||
:desc "eval region" "r" #'dap-eval-region
|
||||
:desc "eval thing at point" "s" #'dap-eval-thing-at-point
|
||||
:desc "add expression" "a" #'dap-ui-expressions-add
|
||||
:desc "remove expression" "d" #'dap-ui-expressions-remove
|
||||
(setq org-roam-dailies-capture-templates
|
||||
'(("d" "default" entry
|
||||
"* %?"
|
||||
:target (file+head "%<%Y-%m-%d>.org"
|
||||
"#+title: %<%Y-%m-%d>\n#+date: %T\n#+hugo_auto_set_lastmod: t\n"))))
|
||||
|
||||
:prefix ("db" . "Breakpoint")
|
||||
:desc "dap breakpoint toggle" "b" #'dap-breakpoint-toggle
|
||||
:desc "dap breakpoint condition" "c" #'dap-breakpoint-condition
|
||||
:desc "dap breakpoint hit count" "h" #'dap-breakpoint-hit-condition
|
||||
:desc "dap breakpoint log message" "l" #'dap-breakpoint-log-message)
|
||||
(use-package! websocket
|
||||
:after org-roam)
|
||||
|
||||
;; mastodon
|
||||
(map! :leader
|
||||
:prefix ("o")
|
||||
:desc "Mastodon" "M" #'mastodon)
|
||||
(use-package! org-roam-ui
|
||||
:after org-roam ;; or :after org
|
||||
; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
|
||||
; a hookable mode anymore, you're advised to pick something yourself
|
||||
; if you don't care about startup time, use
|
||||
; :hook (after-init . org-roam-ui-mode)
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
|
||||
(map! :after mastodon
|
||||
:map mastodon-mode-map
|
||||
:n "[ [" #'mastodon-tl--goto-prev-toot
|
||||
:n "] ]" #'mastodon-tl--goto-next-toot
|
||||
:n "g k" #'mastodon-tl--previous-tab-item
|
||||
:n "g j" #'mastodon-tl--next-tab-item
|
||||
(use-package! org-fragtog
|
||||
:hook (org-mode . org-fragtog-mode))
|
||||
|
||||
:n "q" #'kill-current-buffer
|
||||
:n "Q" #'kill-buffer-and-window
|
||||
(setq org-hugo-base-dir "~/Documents/roam-publish/")
|
||||
|
||||
;;; timelines
|
||||
:n "#" #'mastodon-tl--get-tag-timeline
|
||||
:n "A" #'mastodon-profile--get-toot-author
|
||||
:n "F" #'mastodon-tl--get-federated-timeline
|
||||
:n "H" #'mastodon-tl--get-home-timeline
|
||||
:n "L" #'mastodon-tl--get-local-timeline
|
||||
:n "N" #'mastodon-notifications-get
|
||||
:n "O" #'mastodon-profile--my-profile
|
||||
:n "P" #'mastodon-profile--show-user
|
||||
:n "T" #'mastodon-tl--thread
|
||||
(defun my/org-roam-filter-by-tag (tag-name)
|
||||
(lambda (node)
|
||||
(member tag-name (org-roam-node-tags node))))
|
||||
|
||||
;;; toot actions
|
||||
:n "K" #'mastodon-toot--bookmark-toot-toggle
|
||||
:n "R" #'mastodon-toot--toggle-boost
|
||||
:n "c" #'mastodon-tl--toggle-spoiler-text-in-toot
|
||||
:n "C" #'mastodon-toot--copy-toot-url
|
||||
:n "o" #'mastodon-url-lookup
|
||||
:n "d" #'mastodon-toot--delete-toot
|
||||
:n "D" #'mastodon-toot--delete-draft-toot
|
||||
:n "f" #'mastodon-toot--toggle-favourite
|
||||
:n "r" #'mastodon-toot--reply
|
||||
:n "u" #'mastodon-tl--update
|
||||
:n "v" #'mastodon-tl--poll-vote
|
||||
(defun my/org-roam-list-notes-by-tag (tag-name)
|
||||
(mapcar #'org-roam-node-file
|
||||
(seq-filter
|
||||
(daviwil/org-roam-filter-by-tag tag-name)
|
||||
(org-roam-node-list))))
|
||||
|
||||
;;; toot!
|
||||
:n "t" #'mastodon-toot
|
||||
(defun my/org-roam-export-all ()
|
||||
"Re-exports all Org-roam files to Hugo markdown."
|
||||
(interactive)
|
||||
(dolist (org-file (my/org-roam-list-notes-by-tag "publish"))
|
||||
;(dolist (org-file (directory-files-recursively org-roam-directory "\.org$"))
|
||||
(with-current-buffer (find-file org-file)
|
||||
(org-hugo-export-wim-to-md))))
|
||||
|
||||
;;; mastodon additions
|
||||
:n "S" #'mastodon-search--search-query
|
||||
:n "V F" #'mastodon-profile--view-favourites
|
||||
:n "V B" #'mastodon-profile--view-bookmarks
|
||||
:n "V L" #'mastodon-tl--view-list-timeline
|
||||
)
|
||||
(defun my/org-roam-publish ()
|
||||
"Publish current file"
|
||||
(interactive)
|
||||
(org-roam-set-keyword "filetags" ":publish:")
|
||||
(save-buffer)
|
||||
(org-hugo-export-wim-to-md))
|
||||
|
||||
;; mail
|
||||
(set-email-account! "southfox.me"
|
||||
'((mu4e-sent-folder . "/southfox.me/Sent Mail")
|
||||
(mu4e-drafts-folder . "/southfox.me/Drafts")
|
||||
(mu4e-trash-folder . "/southfox.me/Trash")
|
||||
(mu4e-refile-folder . "/southfox.me/All Mail")
|
||||
(smtpmail-smtp-user . "master@southfox.me")
|
||||
(mu4e-compose-signature . "---\nFor mu4e"))
|
||||
t)
|
||||
(defun my/org-roam-creat-node ()
|
||||
"creat node and add IS_NODE property"
|
||||
(interactive)
|
||||
(org-id-get-create)
|
||||
(org-set-tags ":NODE:")
|
||||
(save-buffer)
|
||||
(org-hugo-export-wim-to-md))
|
||||
|
||||
;; guess-word
|
||||
(use-package! guess-word)
|
||||
(setq guess-word-org-file (f-expand "~/Nextcloud/Documents/my-esl.org"))
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((restclient . t)))
|
||||
|
||||
(cnfonts-mode 1)
|
||||
(good-scroll-mode 1)
|
||||
(setq word-wrap-by-category t)
|
||||
|
||||
(add-to-list 'default-frame-alist '(height . 35))
|
||||
(add-to-list 'default-frame-alist '(width . 102))
|
||||
|
||||
(setq shell-file-name "/bin/zsh"
|
||||
vterm-max-scrollback 5000)
|
||||
|
||||
(parrot-mode 1)
|
||||
(define-key evil-normal-state-map (kbd "[r") 'parrot-rotate-prev-word-at-point)
|
||||
(define-key evil-normal-state-map (kbd "]r") 'parrot-rotate-next-word-at-point)
|
||||
|
||||
(setq parrot-rotate-dict
|
||||
'(
|
||||
(:rot ("yes" "no") :caps t :upcase t)
|
||||
(:rot ("&" "|"))
|
||||
(:rot ("begin" "end") :caps t :upcase t)
|
||||
(:rot ("enable" "disable") :caps t :upcase t)
|
||||
(:rot ("enter" "exit") :caps t :upcase t)
|
||||
(:rot ("forward" "backward") :caps t :upcase t)
|
||||
(:rot ("front" "rear" "back") :caps t :upcase t)
|
||||
(:rot ("get" "set") :caps t :upcase t)
|
||||
(:rot ("high" "low") :caps t :upcase t)
|
||||
(:rot ("in" "out") :caps t :upcase t)
|
||||
(:rot ("left" "right") :caps t :upcase t)
|
||||
(:rot ("min" "max") :caps t :upcase t)
|
||||
(:rot ("on" "off") :caps t :upcase t)
|
||||
(:rot ("start" "stop") :caps t :upcase t)
|
||||
(:rot ("true" "false") :caps t :upcase t)
|
||||
(:rot ("&&" "||"))
|
||||
(:rot ("==" "!="))
|
||||
(:rot ("if" "else" "elif"))
|
||||
(:rot ("ifdef" "ifndef"))
|
||||
))
|
||||
|
||||
(defun my-add-to-multiple-hooks (function hooks)
|
||||
(mapc (lambda (hook)
|
||||
(add-hook hook function))
|
||||
hooks))
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq parrot-num-rotations 10)
|
||||
(parrot-set-parrot-type 'emacs)))
|
||||
|
||||
(defun my-parrot-thumbsup-play ()
|
||||
(parrot-set-parrot-type 'thumbsup)
|
||||
(parrot-start-animation))
|
||||
|
||||
(defun my-parrot-emacs-play ()
|
||||
(parrot-set-parrot-type 'emacs)
|
||||
(parrot-start-animation))
|
||||
|
||||
(defun my-parrot-rotating-play ()
|
||||
(parrot-set-parrot-type 'rotating)
|
||||
(parrot-start-animation))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-thumbsup-play
|
||||
'(org-after-todo-state-change-hook
|
||||
org-clock-in-hook
|
||||
org-timer-done-hook
|
||||
git-commit-post-finish-hook))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-emacs-play
|
||||
'(after-save-hook
|
||||
find-file-hook))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-rotating-play
|
||||
'(elfeed-search-mode-hook
|
||||
mu4e-main-mode-hook))
|
||||
|
||||
(load! "secrets")
|
||||
(setq-default custom-file (expand-file-name "secrets.el" doom-user-dir))
|
||||
(when (file-exists-p custom-file)
|
||||
(load custom-file))
|
||||
|
||||
;;calibre
|
||||
(setq calibredb-root-dir "~/Nextcloud/Ebook")
|
||||
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
|
||||
(setq calibredb-ref-default-bibliography (concat (file-name-as-directory calibredb-root-dir) "catalog.bib"))
|
||||
(setq bibtex-completion-pdf-field "File")
|
||||
(setq bibtex-completion-bibliography '("~/Nextcloud/Ebook/catalog.bib"))
|
||||
(setq citar-bibliography '("~/Nextcloud/Ebook/catalog.bib"))
|
||||
|
||||
(setq calibredb-root-dir "~/Nextcloud/Ebook")
|
||||
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
|
||||
(setq calibredb-ref-default-bibliography (concat (file-name-as-directory calibredb-root-dir) "catalog.bib"))
|
||||
(setq calibredb-format-all-the-icons t)
|
||||
|
||||
(map! :map calibredb-show-mode-map
|
||||
:n "?" #'calibredb-entry-dispatch
|
||||
:n "o" #'calibredb-find-file
|
||||
|
@ -310,18 +296,111 @@
|
|||
:n "M-T" #'calibredb-set-metadata--title
|
||||
:n "M-c" #'calibredb-set-metadata--comments)
|
||||
|
||||
;;sdcv
|
||||
(setq sdcv-say-word-p t)
|
||||
|
||||
(setq sdcv-dictionary-data-dir (expand-file-name "~/.stardict/dic/"))
|
||||
;; sdcv-dictionary-simple-list (list "懒虫简明英汉词典"
|
||||
;; "KDic11万英汉词典")
|
||||
;; sdcv-dictionary-complete-list (list "懒虫简明英汉词典"
|
||||
;; "KDic11万英汉词典"))
|
||||
|
||||
(map! :leader :desc "sdvc" "z" #'sdcv-search-pointer+)
|
||||
|
||||
;; rime
|
||||
(map! :leader
|
||||
(:prefix ("c h" . "Help info from Clippy")
|
||||
:desc "Clippy describes function under point" "f" #'clippy-describe-function
|
||||
:desc "Clippy describes variable under point" "v" #'clippy-describe-variable))
|
||||
|
||||
(map! :leader
|
||||
:prefix ("o")
|
||||
:desc "Mastodon" "M" #'mastodon)
|
||||
|
||||
(map! :after mastodon
|
||||
:map mastodon-mode-map
|
||||
:n "[ [" #'mastodon-tl--goto-prev-toot
|
||||
:n "] ]" #'mastodon-tl--goto-next-toot
|
||||
:n "g k" #'mastodon-tl--previous-tab-item
|
||||
:n "g j" #'mastodon-tl--next-tab-item
|
||||
|
||||
:n "q" #'kill-current-buffer
|
||||
:n "Q" #'kill-buffer-and-window
|
||||
|
||||
;;; timelines
|
||||
:n "#" #'mastodon-tl--get-tag-timeline
|
||||
:n "A" #'mastodon-profile--get-toot-author
|
||||
:n "F" #'mastodon-tl--get-federated-timeline
|
||||
:n "H" #'mastodon-tl--get-home-timeline
|
||||
:n "L" #'mastodon-tl--get-local-timeline
|
||||
:n "N" #'mastodon-notifications-get
|
||||
:n "O" #'mastodon-profile--my-profile
|
||||
:n "P" #'mastodon-profile--show-user
|
||||
:n "T" #'mastodon-tl--thread
|
||||
|
||||
;;; toot actions
|
||||
:n "K" #'mastodon-toot--bookmark-toot-toggle
|
||||
:n "R" #'mastodon-toot--toggle-boost
|
||||
:n "c" #'mastodon-tl--toggle-spoiler-text-in-toot
|
||||
:n "C" #'mastodon-toot--copy-toot-url
|
||||
:n "o" #'mastodon-url-lookup
|
||||
:n "d" #'mastodon-toot--delete-toot
|
||||
:n "D" #'mastodon-toot--delete-draft-toot
|
||||
:n "f" #'mastodon-toot--toggle-favourite
|
||||
:n "r" #'mastodon-toot--reply
|
||||
:n "u" #'mastodon-tl--update
|
||||
:n "v" #'mastodon-tl--poll-vote
|
||||
|
||||
;;; toot!
|
||||
:n "t" #'mastodon-toot
|
||||
|
||||
;;; mastodon additions
|
||||
:n "S" #'mastodon-search--search-query
|
||||
:n "V F" #'mastodon-profile--view-favourites
|
||||
:n "V B" #'mastodon-profile--view-bookmarks
|
||||
:n "V L" #'mastodon-tl--view-list-timeline
|
||||
)
|
||||
|
||||
(beacon-mode 1)
|
||||
|
||||
(setq ement-save-sessions t
|
||||
ement-room-message-format-spec "%B%r%R%t")
|
||||
(map! :map ement-room-mode-map
|
||||
:n "c e" #'ement-room-edit-message
|
||||
:n "c m" #'ement-room-send-message
|
||||
:n "c r" #'ement-room-send-reaction
|
||||
:n "c i" #'ement-room-send-image
|
||||
:n "c f" #'ement-room-send-file
|
||||
:n "q" #'kill-current-buffer
|
||||
)
|
||||
|
||||
(after! dap-mode
|
||||
(setq dap-python-debugger 'debugpy))
|
||||
|
||||
(map! :map dap-mode-map
|
||||
:leader
|
||||
:prefix ("d" . "dap")
|
||||
;;; basics
|
||||
:desc "dap next" "n" #'dap-next
|
||||
:desc "dap step in" "i" #'dap-step-in
|
||||
:desc "dap step out" "o" #'dap-step-out
|
||||
:desc "dap continue" "c" #'dap-continue
|
||||
:desc "dap hydra" "h" #'dap-hydra
|
||||
:desc "dap debug restart" "r" #'dap-debug-restart
|
||||
:desc "dap debug" "s" #'dap-debug
|
||||
|
||||
;;; debug
|
||||
:prefix ("dd" . "Debug")
|
||||
:desc "dap debug recent" "r" #'dap-debug-recent
|
||||
:desc "dap debug last" "l" #'dap-debug-last
|
||||
|
||||
;;; eval
|
||||
:prefix ("de" . "Eval")
|
||||
:desc "eval" "e" #'dap-eval
|
||||
:desc "eval region" "r" #'dap-eval-region
|
||||
:desc "eval thing at point" "s" #'dap-eval-thing-at-point
|
||||
:desc "add expression" "a" #'dap-ui-expressions-add
|
||||
:desc "remove expression" "d" #'dap-ui-expressions-remove
|
||||
|
||||
:prefix ("db" . "Breakpoint")
|
||||
:desc "dap breakpoint toggle" "b" #'dap-breakpoint-toggle
|
||||
:desc "dap breakpoint condition" "c" #'dap-breakpoint-condition
|
||||
:desc "dap breakpoint hit count" "h" #'dap-breakpoint-hit-condition
|
||||
:desc "dap breakpoint log message" "l" #'dap-breakpoint-log-message)
|
||||
|
||||
(use-package! rime
|
||||
:custom
|
||||
(default-input-method "rime")
|
||||
|
@ -335,99 +414,17 @@
|
|||
rime-predicate-current-uppercase-letter-p
|
||||
rime-predicate-punctuation-line-begin-p)))
|
||||
|
||||
;; ace-pinyin
|
||||
(use-package! ace-pinyin
|
||||
:config
|
||||
(ace-pinyin-global-mode +1))
|
||||
(set-email-account! "southfox.me"
|
||||
'((mu4e-sent-folder . "/southfox.me/Sent Mail")
|
||||
(mu4e-drafts-folder . "/southfox.me/Drafts")
|
||||
(mu4e-trash-folder . "/southfox.me/Trash")
|
||||
(mu4e-refile-folder . "/southfox.me/All Mail")
|
||||
(smtpmail-smtp-user . "master@southfox.me")
|
||||
(mu4e-compose-signature . "---\nFor mu4e"))
|
||||
t)
|
||||
|
||||
;; parrot
|
||||
(parrot-mode 1)
|
||||
(define-key evil-normal-state-map (kbd "[r") 'parrot-rotate-prev-word-at-point)
|
||||
(define-key evil-normal-state-map (kbd "]r") 'parrot-rotate-next-word-at-point)
|
||||
(add-hook! 'elfeed-search-mode-hook 'elfeed-update)
|
||||
|
||||
(setq parrot-rotate-dict
|
||||
'(
|
||||
(:rot ("yes" "no") :caps t :upcase t)
|
||||
(:rot ("&" "|"))
|
||||
(:rot ("begin" "end") :caps t :upcase t)
|
||||
(:rot ("enable" "disable") :caps t :upcase t)
|
||||
(:rot ("enter" "exit") :caps t :upcase t)
|
||||
(:rot ("forward" "backward") :caps t :upcase t)
|
||||
(:rot ("front" "rear" "back") :caps t :upcase t)
|
||||
(:rot ("get" "set") :caps t :upcase t)
|
||||
(:rot ("high" "low") :caps t :upcase t)
|
||||
(:rot ("in" "out") :caps t :upcase t)
|
||||
(:rot ("left" "right") :caps t :upcase t)
|
||||
(:rot ("min" "max") :caps t :upcase t)
|
||||
(:rot ("on" "off") :caps t :upcase t)
|
||||
(:rot ("start" "stop") :caps t :upcase t)
|
||||
(:rot ("true" "false") :caps t :upcase t)
|
||||
(:rot ("&&" "||"))
|
||||
(:rot ("==" "!="))
|
||||
(:rot ("if" "else" "elif"))
|
||||
(:rot ("ifdef" "ifndef"))
|
||||
))
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq parrot-num-rotations 10)
|
||||
(parrot-set-parrot-type 'emacs)))
|
||||
|
||||
(defun my-parrot-thumbsup-play ()
|
||||
(parrot-set-parrot-type 'thumbsup)
|
||||
(parrot-start-animation))
|
||||
|
||||
(defun my-parrot-emacs-play ()
|
||||
(parrot-set-parrot-type 'emacs)
|
||||
(parrot-start-animation))
|
||||
|
||||
(defun my-parrot-rotating-play ()
|
||||
(parrot-set-parrot-type 'rotating)
|
||||
(parrot-start-animation))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-thumbsup-play
|
||||
'(org-after-todo-state-change-hook
|
||||
org-clock-in-hook
|
||||
org-timer-done-hook
|
||||
git-commit-post-finish-hook))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-emacs-play
|
||||
'(after-save-hook
|
||||
find-file-hook))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-rotating-play
|
||||
'(elfeed-search-mode-hook
|
||||
mu4e-main-mode-hook))
|
||||
|
||||
;;; org
|
||||
;; If you use `org' and don't want your org files in the default location below,
|
||||
;; change `org-directory'. It must be set before org loads!
|
||||
;; (defun org-summary-todo (n-done n-not-done)
|
||||
;; "Switch entry to DONE when all subentries are done, to TODO otherwise."
|
||||
;; (let (org-log-done org-log-states) ; turn off logging
|
||||
;; (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
|
||||
|
||||
;; (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
|
||||
(after! org
|
||||
(setq org-directory "~/org/"
|
||||
org-image-actual-width '(400)
|
||||
org-link-search-must-match-exact-headline nil
|
||||
org-log-done 'time
|
||||
org-log-into-drawer t))
|
||||
|
||||
(add-hook 'org-pomodoro-finished-hook
|
||||
(lambda()
|
||||
(org-roam-dailies-capture-today)))
|
||||
|
||||
;; ob-restclient
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((restclient . t)))
|
||||
|
||||
;; elfeed
|
||||
(after! elfeed
|
||||
(setq elfeed-search-filter "@6-month-ago +unread")
|
||||
(setq rmh-elfeed-org-files '("~/Nextcloud/rss/rss.org"))
|
||||
|
@ -435,114 +432,3 @@
|
|||
"--proxy" "socks5://127.0.0.1:10808"
|
||||
"--retry" "2"
|
||||
"--insecure")))
|
||||
|
||||
(add-hook! 'elfeed-search-mode-hook 'elfeed-update)
|
||||
|
||||
;; org-fragtog
|
||||
(use-package! org-fragtog
|
||||
:hook (org-mode . org-fragtog-mode))
|
||||
|
||||
;; org-capture
|
||||
(setq org-agenda-files '("~/Nextcloud/gtd/inbox.org"
|
||||
"~/Nextcloud/gtd/gtd.org"
|
||||
"~/Nextcloud/gtd/tickler.org"))
|
||||
|
||||
(after! org
|
||||
(setq org-capture-templates '(("t" "Todo [inbox]" entry
|
||||
(file "~/Nextcloud/gtd/inbox.org")
|
||||
"* TODO %i%? \n SCHEDULED: %t")
|
||||
("T" "Tickler" entry
|
||||
(file+headline "~/Nextcloud/gtd/tickler.org" "Tickler")
|
||||
"* %i%? \n %U"))))
|
||||
;; roam-hugo
|
||||
(setq org-hugo-base-dir "~/Documents/roam-publish/")
|
||||
|
||||
(defun my/org-roam-filter-by-tag (tag-name)
|
||||
(lambda (node)
|
||||
(member tag-name (org-roam-node-tags node))))
|
||||
|
||||
(defun my/org-roam-list-notes-by-tag (tag-name)
|
||||
(mapcar #'org-roam-node-file
|
||||
(seq-filter
|
||||
(daviwil/org-roam-filter-by-tag tag-name)
|
||||
(org-roam-node-list))))
|
||||
|
||||
(defun my/org-roam-export-all ()
|
||||
"Re-exports all Org-roam files to Hugo markdown."
|
||||
(interactive)
|
||||
(dolist (org-file (my/org-roam-list-notes-by-tag "publish"))
|
||||
;(dolist (org-file (directory-files-recursively org-roam-directory "\.org$"))
|
||||
(with-current-buffer (find-file org-file)
|
||||
(org-hugo-export-wim-to-md))))
|
||||
|
||||
(defun my/org-roam-creat-node ()
|
||||
"creat node and add IS_NODE property"
|
||||
(interactive)
|
||||
(org-id-get-create)
|
||||
(org-set-tags ":NODE:")
|
||||
(save-buffer)
|
||||
(org-hugo-export-wim-to-md))
|
||||
|
||||
;; org-roam
|
||||
(setq org-roam-directory "~/Nextcloud/Note/org-roam")
|
||||
(setq org-id-extra-files (org-roam--list-files org-roam-directory))
|
||||
(setq org-roam-capture-templates
|
||||
'(("m" "main" plain
|
||||
"%?"
|
||||
:if-new (file+head "main/%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
"#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("r" "references" plain "%?"
|
||||
:if-new
|
||||
(file+head "references/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("t" "ttk" plain "%?"
|
||||
:if-new
|
||||
(file+head "ttk/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("a" "article" plain "%?"
|
||||
:if-new
|
||||
(file+head "articles/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+filetags: :article: :publish:\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)))
|
||||
|
||||
(setq org-roam-dailies-capture-templates
|
||||
'(("d" "default" entry
|
||||
"* %?"
|
||||
:target (file+head "%<%Y-%m-%d>.org"
|
||||
"#+title: %<%Y-%m-%d>\n#+date: %T\n#+hugo_auto_set_lastmod: t\n"))))
|
||||
|
||||
;; org-roam-ui
|
||||
(use-package! websocket
|
||||
:after org-roam)
|
||||
|
||||
(use-package! org-roam-ui
|
||||
:after org-roam ;; or :after org
|
||||
; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
|
||||
; a hookable mode anymore, you're advised to pick something yourself
|
||||
; if you don't care about startup time, use
|
||||
; :hook (after-init . org-roam-ui-mode)
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
|
||||
|
||||
(setq epa-file-cache-passphrase-for-symmetric-encryption t)
|
||||
(setq-local epa-file-encrypt-to '("master@southfox.me"))
|
||||
|
||||
;; ement
|
||||
(setq ement-save-sessions t
|
||||
ement-room-message-format-spec "%B%r%R%t")
|
||||
(map! :map ement-room-mode-map
|
||||
:n "c e" #'ement-room-edit-message
|
||||
:n "c m" #'ement-room-send-message
|
||||
:n "c r" #'ement-room-send-reaction
|
||||
:n "c i" #'ement-room-send-image
|
||||
:n "c f" #'ement-room-send-file
|
||||
:n "q" #'kill-current-buffer
|
||||
)
|
||||
|
|
602
config.org
Normal file
602
config.org
Normal file
|
@ -0,0 +1,602 @@
|
|||
#+title: Config
|
||||
#+PROPERTY: header-args :tangle config.el
|
||||
|
||||
现在我用的主题是……
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq doom-theme 'ef-spring) ;;春天来了!
|
||||
#+end_src
|
||||
|
||||
* 启动
|
||||
今日方知我是我:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq user-full-name "SouthFox"
|
||||
user-mail-address "master@southfox.me")
|
||||
#+end_src
|
||||
|
||||
** 横幅
|
||||
替换 =Doom Emacs= 的横幅,用一只狐狸!
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun doom-dashboard-draw-ascii-emacs-banner-fn ()
|
||||
(let* ((banner
|
||||
'(" , "
|
||||
" _.-=;~ /_ "
|
||||
" _-~ ' ;. "
|
||||
" _.-~ ' .-~-~`-._ "
|
||||
" _.--~~:. --.____88 "
|
||||
" ____.........--~~~. .' . . _..-------~~ "
|
||||
" _..--~~~~ .' .' ,' "
|
||||
" _.-~ . . ` ,' "
|
||||
" .' :. ./ "
|
||||
" .: ,/ ` ::. ,' "
|
||||
" .:' ,( ;. ::. ,-' "
|
||||
" .' ./'.`. . . /:::._______.... _/:.o/ "
|
||||
" / ./'. . .) . _.,' `88;?88| "
|
||||
" ,' . .,/'._,-~ /_.o8P' 88P ?8b "
|
||||
" _,'' . .,/',-~ d888P' 88' 88| "
|
||||
" _.'~ . .,:oP' ?88b _..--- 88.--'8b.--..__ "
|
||||
": ...' 88o __,------.88o ...__..._.=~- . `~~ `~~ ~-._ Fox! _. "
|
||||
"`.;;;:=' ~~ ~~~ ~- - - - "))
|
||||
(longest-line (apply #'max (mapcar #'length banner))))
|
||||
(put-text-property
|
||||
(point)
|
||||
(dolist (line banner (point))
|
||||
(insert (+doom-dashboard--center
|
||||
+doom-dashboard--width
|
||||
(concat
|
||||
line (make-string (max 0 (- longest-line (length line)))
|
||||
32)))
|
||||
"\n"))
|
||||
'face 'doom-dashboard-banner)))
|
||||
|
||||
;(unless (display-graphic-p) ; for some reason this messes up the graphical splash screen atm
|
||||
(setq +doom-dashboard-ascii-banner-fn #'doom-dashboard-draw-ascii-emacs-banner-fn) ;)
|
||||
#+end_src
|
||||
|
||||
* org-mode
|
||||
将 =org-log-into-drawer= 设为 =t= 后,完成任务后的时间戳将会收起,
|
||||
这样一些每天完成的任务就不会被相关时间戳占满。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(after! org
|
||||
(setq org-directory "~/org/"
|
||||
org-image-actual-width '(400)
|
||||
org-link-search-must-match-exact-headline nil
|
||||
org-log-done 'time
|
||||
org-log-into-drawer t))
|
||||
|
||||
#+end_src
|
||||
|
||||
** org-capture
|
||||
一些捕获模板和路径设置,但说实在自从用了 =org-roam= 那边这边就没怎么管了。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-agenda-files '("~/Nextcloud/gtd/inbox.org"
|
||||
"~/Nextcloud/gtd/gtd.org"
|
||||
"~/Nextcloud/gtd/tickler.org"))
|
||||
|
||||
(after! org
|
||||
(setq org-capture-templates '(("t" "Todo [inbox]" entry
|
||||
(file "~/Nextcloud/gtd/inbox.org")
|
||||
"* TODO %i%? \n SCHEDULED: %t")
|
||||
("T" "Tickler" entry
|
||||
(file+headline "~/Nextcloud/gtd/tickler.org" "Tickler")
|
||||
"* %i%? \n %U"))))
|
||||
#+end_src
|
||||
|
||||
** org-roam
|
||||
主要是一些捕获模板设置,文件命名加上时间还是因为导出到数字花园时会放在一个文件夹里,
|
||||
而为了避免重名。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-roam-directory "~/Nextcloud/Note/org-roam")
|
||||
(setq org-roam-capture-templates
|
||||
'(("m" "main" plain
|
||||
"%?"
|
||||
:if-new (file+head "main/%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
"#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("r" "references" plain "%?"
|
||||
:if-new
|
||||
(file+head "references/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("t" "ttk" plain "%?"
|
||||
:if-new
|
||||
(file+head "ttk/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)
|
||||
("a" "article" plain "%?"
|
||||
:if-new
|
||||
(file+head "articles/%<%Y%m%d%H%M%S>-${title}.org" "#+title: ${title}\n#+date: %T\n#+filetags: :article: :publish:\n#+hugo_auto_set_lastmod: t\n")
|
||||
:immediate-finish t
|
||||
:unnarrowed t)))
|
||||
|
||||
(setq org-roam-dailies-capture-templates
|
||||
'(("d" "default" entry
|
||||
"* %?"
|
||||
:target (file+head "%<%Y-%m-%d>.org"
|
||||
"#+title: %<%Y-%m-%d>\n#+date: %T\n#+hugo_auto_set_lastmod: t\n"))))
|
||||
#+end_src
|
||||
|
||||
** org-roam-ui
|
||||
非常酷炫的一个网页 =roam= 笔记查看,可惜如果能够只查看某个节点就好了,
|
||||
数据量一大我怕打开会直接卡死。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! websocket
|
||||
:after org-roam)
|
||||
|
||||
(use-package! org-roam-ui
|
||||
:after org-roam ;; or :after org
|
||||
; normally we'd recommend hooking orui after org-roam, but since org-roam does not have
|
||||
; a hookable mode anymore, you're advised to pick something yourself
|
||||
; if you don't care about startup time, use
|
||||
; :hook (after-init . org-roam-ui-mode)
|
||||
:config
|
||||
(setq org-roam-ui-sync-theme t
|
||||
org-roam-ui-follow t
|
||||
org-roam-ui-update-on-save t
|
||||
org-roam-ui-open-on-start t))
|
||||
#+end_src
|
||||
|
||||
** org-fragtog
|
||||
好像是 =latex= 相关的预览包……?
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! org-fragtog
|
||||
:hook (org-mode . org-fragtog-mode))
|
||||
#+end_src
|
||||
|
||||
** roam-publish
|
||||
一些从世界各地拼出来的代码,还有一些自己单纯堆叠调用的函数,
|
||||
我真该系统学学 =elisp= +1 。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq org-hugo-base-dir "~/Documents/roam-publish/")
|
||||
|
||||
(defun my/org-roam-filter-by-tag (tag-name)
|
||||
(lambda (node)
|
||||
(member tag-name (org-roam-node-tags node))))
|
||||
|
||||
(defun my/org-roam-list-notes-by-tag (tag-name)
|
||||
(mapcar #'org-roam-node-file
|
||||
(seq-filter
|
||||
(daviwil/org-roam-filter-by-tag tag-name)
|
||||
(org-roam-node-list))))
|
||||
|
||||
(defun my/org-roam-export-all ()
|
||||
"Re-exports all Org-roam files to Hugo markdown."
|
||||
(interactive)
|
||||
(dolist (org-file (my/org-roam-list-notes-by-tag "publish"))
|
||||
;(dolist (org-file (directory-files-recursively org-roam-directory "\.org$"))
|
||||
(with-current-buffer (find-file org-file)
|
||||
(org-hugo-export-wim-to-md))))
|
||||
|
||||
(defun my/org-roam-publish ()
|
||||
"Publish current file"
|
||||
(interactive)
|
||||
(org-roam-set-keyword "filetags" ":publish:")
|
||||
(save-buffer)
|
||||
(org-hugo-export-wim-to-md))
|
||||
|
||||
(defun my/org-roam-creat-node ()
|
||||
"creat node and add IS_NODE property"
|
||||
(interactive)
|
||||
(org-id-get-create)
|
||||
(org-set-tags ":NODE:")
|
||||
(save-buffer)
|
||||
(org-hugo-export-wim-to-md))
|
||||
#+end_src
|
||||
|
||||
** ob-restclient
|
||||
在代码块中发送 =HTTP= 请求,感觉十分利好一些 =api= 文档啊。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((restclient . t)))
|
||||
#+end_src
|
||||
|
||||
* 杂项
|
||||
=cnfonts= 是一个可以分别设置中英文字体的 bk ,方便对其表格。
|
||||
|
||||
=word-wrap-by-category= 是中文优化,当一行有英文和中文时不折行。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(cnfonts-mode 1)
|
||||
(good-scroll-mode 1)
|
||||
(setq word-wrap-by-category t)
|
||||
|
||||
(add-to-list 'default-frame-alist '(height . 35))
|
||||
(add-to-list 'default-frame-alist '(width . 102))
|
||||
#+end_src
|
||||
|
||||
** Shell
|
||||
将使用的终端切换到 =zsh= 。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq shell-file-name "/bin/zsh"
|
||||
vterm-max-scrollback 5000)
|
||||
#+end_src
|
||||
|
||||
** TODO 派对鹦鹉
|
||||
快捷键和词典,但说实在没用过这功能,毕竟这个包的重点当然是在动图上。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(parrot-mode 1)
|
||||
(define-key evil-normal-state-map (kbd "[r") 'parrot-rotate-prev-word-at-point)
|
||||
(define-key evil-normal-state-map (kbd "]r") 'parrot-rotate-next-word-at-point)
|
||||
|
||||
(setq parrot-rotate-dict
|
||||
'(
|
||||
(:rot ("yes" "no") :caps t :upcase t)
|
||||
(:rot ("&" "|"))
|
||||
(:rot ("begin" "end") :caps t :upcase t)
|
||||
(:rot ("enable" "disable") :caps t :upcase t)
|
||||
(:rot ("enter" "exit") :caps t :upcase t)
|
||||
(:rot ("forward" "backward") :caps t :upcase t)
|
||||
(:rot ("front" "rear" "back") :caps t :upcase t)
|
||||
(:rot ("get" "set") :caps t :upcase t)
|
||||
(:rot ("high" "low") :caps t :upcase t)
|
||||
(:rot ("in" "out") :caps t :upcase t)
|
||||
(:rot ("left" "right") :caps t :upcase t)
|
||||
(:rot ("min" "max") :caps t :upcase t)
|
||||
(:rot ("on" "off") :caps t :upcase t)
|
||||
(:rot ("start" "stop") :caps t :upcase t)
|
||||
(:rot ("true" "false") :caps t :upcase t)
|
||||
(:rot ("&&" "||"))
|
||||
(:rot ("==" "!="))
|
||||
(:rot ("if" "else" "elif"))
|
||||
(:rot ("ifdef" "ifndef"))
|
||||
))
|
||||
|
||||
#+end_src
|
||||
|
||||
定义一个可以钩住多个 =hook= 的函数,我感觉我不学 =elisp= 的话真不行了啊……
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun my-add-to-multiple-hooks (function hooks)
|
||||
(mapc (lambda (hook)
|
||||
(add-hook hook function))
|
||||
hooks))
|
||||
#+end_src
|
||||
|
||||
之后将在完成一个番茄钟播放点赞动画,保存一个文件时播放 =emacs= 动画等等,
|
||||
感觉真该学学 =elisp= 了啊,必须得重构这段了。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(setq parrot-num-rotations 10)
|
||||
(parrot-set-parrot-type 'emacs)))
|
||||
|
||||
(defun my-parrot-thumbsup-play ()
|
||||
(parrot-set-parrot-type 'thumbsup)
|
||||
(parrot-start-animation))
|
||||
|
||||
(defun my-parrot-emacs-play ()
|
||||
(parrot-set-parrot-type 'emacs)
|
||||
(parrot-start-animation))
|
||||
|
||||
(defun my-parrot-rotating-play ()
|
||||
(parrot-set-parrot-type 'rotating)
|
||||
(parrot-start-animation))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-thumbsup-play
|
||||
'(org-after-todo-state-change-hook
|
||||
org-clock-in-hook
|
||||
org-timer-done-hook
|
||||
git-commit-post-finish-hook))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-emacs-play
|
||||
'(after-save-hook
|
||||
find-file-hook))
|
||||
|
||||
(my-add-to-multiple-hooks
|
||||
'my-parrot-rotating-play
|
||||
'(elfeed-search-mode-hook
|
||||
mu4e-main-mode-hook))
|
||||
#+end_src
|
||||
|
||||
** 其它文件
|
||||
存放一些 =token= 的秘密文件,应该注意不能随 =git= 上传或者同步。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(load! "secrets")
|
||||
(setq-default custom-file (expand-file-name "secrets.el" doom-user-dir))
|
||||
(when (file-exists-p custom-file)
|
||||
(load custom-file))
|
||||
#+end_src
|
||||
|
||||
* 文献管理
|
||||
** Citar
|
||||
#+begin_src emacs-lisp
|
||||
(setq bibtex-completion-pdf-field "File")
|
||||
(setq bibtex-completion-bibliography '("~/Nextcloud/Ebook/catalog.bib"))
|
||||
(setq citar-bibliography '("~/Nextcloud/Ebook/catalog.bib"))
|
||||
#+end_src
|
||||
|
||||
** Calibre
|
||||
#+begin_src emacs-lisp
|
||||
(setq calibredb-root-dir "~/Nextcloud/Ebook")
|
||||
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
|
||||
(setq calibredb-ref-default-bibliography (concat (file-name-as-directory calibredb-root-dir) "catalog.bib"))
|
||||
(setq calibredb-format-all-the-icons t)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(map! :map calibredb-show-mode-map
|
||||
:n "?" #'calibredb-entry-dispatch
|
||||
:n "o" #'calibredb-find-file
|
||||
:n "O" #'calibredb-find-file-other-frame
|
||||
:n "V" #'calibredb-open-file-with-default-tool
|
||||
:n "s" #'calibredb-set-metadata-dispatch
|
||||
:n "e" #'calibredb-export-dispatch
|
||||
:n "q" #'calibredb-entry-quit
|
||||
:n "." #'calibredb-open-dired
|
||||
:n [tab] #'calibredb-toggle-view-at-point
|
||||
:n "M-t" #'calibredb-set-metadata--tags
|
||||
:n "M-a" #'calibredb-set-metadata--author_sort
|
||||
:n "M-A" #'calibredb-set-metadata--authors
|
||||
:n "M-T" #'calibredb-set-metadata--title
|
||||
:n "M-c" #'calibredb-set-metadata--comments)
|
||||
(map! :map calibredb-search-mode-map
|
||||
:n [mouse-3] #'calibredb-search-mouse
|
||||
:n "RET" #'calibredb-find-file
|
||||
:n "?" #'calibredb-dispatch
|
||||
:n "a" #'calibredb-add
|
||||
:n "A" #'calibredb-add-dir
|
||||
:n "c" #'calibredb-clone
|
||||
:n "d" #'calibredb-remove
|
||||
:n "D" #'calibredb-remove-marked-items
|
||||
:n "j" #'calibredb-next-entry
|
||||
:n "k" #'calibredb-previous-entry
|
||||
:n "l" #'calibredb-virtual-library-list
|
||||
:n "L" #'calibredb-library-list
|
||||
:n "n" #'calibredb-virtual-library-next
|
||||
:n "N" #'calibredb-library-next
|
||||
:n "p" #'calibredb-virtual-library-previous
|
||||
:n "P" #'calibredb-library-previous
|
||||
:n "s" #'calibredb-set-metadata-dispatch
|
||||
:n "S" #'calibredb-switch-library
|
||||
:n "o" #'calibredb-find-file
|
||||
:n "O" #'calibredb-find-file-other-frame
|
||||
:n "v" #'calibredb-view
|
||||
:n "V" #'calibredb-open-file-with-default-tool
|
||||
:n "." #'calibredb-open-dired
|
||||
:n "b" #'calibredb-catalog-bib-dispatch
|
||||
:n "e" #'calibredb-export-dispatch
|
||||
:n "r" #'calibredb-search-refresh-and-clear-filter
|
||||
:n "R" #'calibredb-search-clear-filter
|
||||
:n "q" #'calibredb-search-quit
|
||||
:n "m" #'calibredb-mark-and-forward
|
||||
:n "f" #'calibredb-toggle-favorite-at-point
|
||||
:n "x" #'calibredb-toggle-archive-at-point
|
||||
:n "h" #'calibredb-toggle-highlight-at-point
|
||||
:n "u" #'calibredb-unmark-and-forward
|
||||
:n "i" #'calibredb-edit-annotation
|
||||
:n "DEL" #'calibredb-unmark-and-backward
|
||||
:n [backtab] #'calibredb-toggle-view
|
||||
:n [tab] #'calibredb-toggle-view-at-point
|
||||
:n "M-n" #'calibredb-show-next-entry
|
||||
:n "M-p" #'calibredb-show-previous-entry
|
||||
:n "/" #'calibredb-search-live-filter
|
||||
:n "M-t" #'calibredb-set-metadata--tags
|
||||
:n "M-a" #'calibredb-set-metadata--author_sort
|
||||
:n "M-A" #'calibredb-set-metadata--authors
|
||||
:n "M-T" #'calibredb-set-metadata--title
|
||||
:n "M-c" #'calibredb-set-metadata--comments)
|
||||
|
||||
#+end_src
|
||||
|
||||
* 工具
|
||||
** SDCV
|
||||
翻译包,词典要自己下,同时不要忘了安装 =stardict= 和 =sdcv= 这两个软件。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq sdcv-say-word-p t)
|
||||
(setq sdcv-dictionary-data-dir (expand-file-name "~/.stardict/dic/"))
|
||||
|
||||
(map! :leader :desc "sdvc" "z" #'sdcv-search-pointer+)
|
||||
#+end_src
|
||||
|
||||
** Clippy
|
||||
一些远古的回忆……
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(map! :leader
|
||||
(:prefix ("c h" . "Help info from Clippy")
|
||||
:desc "Clippy describes function under point" "f" #'clippy-describe-function
|
||||
:desc "Clippy describes variable under point" "v" #'clippy-describe-variable))
|
||||
#+end_src
|
||||
|
||||
** Mastodon
|
||||
使用 [[https://codeberg.org/martianh/mastodon.el][mastodon.el]] 在无所事事时快速打开 =Mastodon= 进行一个鱼的摸!
|
||||
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(setq mastodon-instance-url "https://social.instance.org"
|
||||
mastodon-active-user "example_user")
|
||||
#+end_src
|
||||
|
||||
然后设置按键绑定,现在的设置还有一些问题,主要是要在不干扰 =evil= 快捷键的
|
||||
情况下塞入新的按键还是挺难的。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(map! :leader
|
||||
:prefix ("o")
|
||||
:desc "Mastodon" "M" #'mastodon)
|
||||
|
||||
(map! :after mastodon
|
||||
:map mastodon-mode-map
|
||||
:n "[ [" #'mastodon-tl--goto-prev-toot
|
||||
:n "] ]" #'mastodon-tl--goto-next-toot
|
||||
:n "g k" #'mastodon-tl--previous-tab-item
|
||||
:n "g j" #'mastodon-tl--next-tab-item
|
||||
|
||||
:n "q" #'kill-current-buffer
|
||||
:n "Q" #'kill-buffer-and-window
|
||||
|
||||
;;; timelines
|
||||
:n "#" #'mastodon-tl--get-tag-timeline
|
||||
:n "A" #'mastodon-profile--get-toot-author
|
||||
:n "F" #'mastodon-tl--get-federated-timeline
|
||||
:n "H" #'mastodon-tl--get-home-timeline
|
||||
:n "L" #'mastodon-tl--get-local-timeline
|
||||
:n "N" #'mastodon-notifications-get
|
||||
:n "O" #'mastodon-profile--my-profile
|
||||
:n "P" #'mastodon-profile--show-user
|
||||
:n "T" #'mastodon-tl--thread
|
||||
|
||||
;;; toot actions
|
||||
:n "K" #'mastodon-toot--bookmark-toot-toggle
|
||||
:n "R" #'mastodon-toot--toggle-boost
|
||||
:n "c" #'mastodon-tl--toggle-spoiler-text-in-toot
|
||||
:n "C" #'mastodon-toot--copy-toot-url
|
||||
:n "o" #'mastodon-url-lookup
|
||||
:n "d" #'mastodon-toot--delete-toot
|
||||
:n "D" #'mastodon-toot--delete-draft-toot
|
||||
:n "f" #'mastodon-toot--toggle-favourite
|
||||
:n "r" #'mastodon-toot--reply
|
||||
:n "u" #'mastodon-tl--update
|
||||
:n "v" #'mastodon-tl--poll-vote
|
||||
|
||||
;;; toot!
|
||||
:n "t" #'mastodon-toot
|
||||
|
||||
;;; mastodon additions
|
||||
:n "S" #'mastodon-search--search-query
|
||||
:n "V F" #'mastodon-profile--view-favourites
|
||||
:n "V B" #'mastodon-profile--view-bookmarks
|
||||
:n "V L" #'mastodon-tl--view-list-timeline
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** Beacon
|
||||
在快速滚动时也不跟丢光标。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(beacon-mode 1)
|
||||
#+end_src
|
||||
|
||||
** Matrix
|
||||
=ement= 是一个 =Matrix= 协议下的客户端,虽然一些功能很残缺,
|
||||
但在 =emacs= 里能聊上就够了。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq ement-save-sessions t
|
||||
ement-room-message-format-spec "%B%r%R%t")
|
||||
(map! :map ement-room-mode-map
|
||||
:n "c e" #'ement-room-edit-message
|
||||
:n "c m" #'ement-room-send-message
|
||||
:n "c r" #'ement-room-send-reaction
|
||||
:n "c i" #'ement-room-send-image
|
||||
:n "c f" #'ement-room-send-file
|
||||
:n "q" #'kill-current-buffer
|
||||
)
|
||||
#+end_src
|
||||
|
||||
将 =ement-save-sessions= 设为 =t= 则将帐号信息保存到磁盘里,要不然帐号
|
||||
会显示几百个设备了。
|
||||
|
||||
=ement-room-message-format-spec= 是聊天界面的布局,挑了一个预设里最顺眼的。
|
||||
** Debuger
|
||||
说来惭愧,其实没怎么用过,
|
||||
或者说还需要调优才能追上 =VS code= 的使用体验。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(after! dap-mode
|
||||
(setq dap-python-debugger 'debugpy))
|
||||
|
||||
(map! :map dap-mode-map
|
||||
:leader
|
||||
:prefix ("d" . "dap")
|
||||
;;; basics
|
||||
:desc "dap next" "n" #'dap-next
|
||||
:desc "dap step in" "i" #'dap-step-in
|
||||
:desc "dap step out" "o" #'dap-step-out
|
||||
:desc "dap continue" "c" #'dap-continue
|
||||
:desc "dap hydra" "h" #'dap-hydra
|
||||
:desc "dap debug restart" "r" #'dap-debug-restart
|
||||
:desc "dap debug" "s" #'dap-debug
|
||||
|
||||
;;; debug
|
||||
:prefix ("dd" . "Debug")
|
||||
:desc "dap debug recent" "r" #'dap-debug-recent
|
||||
:desc "dap debug last" "l" #'dap-debug-last
|
||||
|
||||
;;; eval
|
||||
:prefix ("de" . "Eval")
|
||||
:desc "eval" "e" #'dap-eval
|
||||
:desc "eval region" "r" #'dap-eval-region
|
||||
:desc "eval thing at point" "s" #'dap-eval-thing-at-point
|
||||
:desc "add expression" "a" #'dap-ui-expressions-add
|
||||
:desc "remove expression" "d" #'dap-ui-expressions-remove
|
||||
|
||||
:prefix ("db" . "Breakpoint")
|
||||
:desc "dap breakpoint toggle" "b" #'dap-breakpoint-toggle
|
||||
:desc "dap breakpoint condition" "c" #'dap-breakpoint-condition
|
||||
:desc "dap breakpoint hit count" "h" #'dap-breakpoint-hit-condition
|
||||
:desc "dap breakpoint log message" "l" #'dap-breakpoint-log-message)
|
||||
|
||||
#+end_src
|
||||
|
||||
** TODO Rime
|
||||
一个文本编辑器也可以内置输入法呢……
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! rime
|
||||
:custom
|
||||
(default-input-method "rime")
|
||||
:config
|
||||
(define-key rime-mode-map (kbd "C-i") 'rime-force-enable)
|
||||
(setq rime-show-candidate 'popup)
|
||||
(setq rime-disable-predicates
|
||||
'(rime-predicate-evil-mode-p
|
||||
rime-predicate-after-alphabet-char-p
|
||||
rime-predicate-space-after-cc-p
|
||||
rime-predicate-current-uppercase-letter-p
|
||||
rime-predicate-punctuation-line-begin-p)))
|
||||
#+end_src
|
||||
|
||||
- [ ] 优化中英文切换断言
|
||||
- [ ] 如何在一些输入中自动切换到中文?例如 =org-roam=
|
||||
- [ ] 改键,现在的 =C \= 确实有点折磨
|
||||
|
||||
* 信息
|
||||
更多信息请参考下面这篇文章:
|
||||
[[https://liujiacai.net/blog/2021/03/05/emacs-love-mail-feed/][使用 Emacs 阅读邮件与 RSS - Keep Coding]]
|
||||
** 邮件
|
||||
#+begin_src emacs-lisp
|
||||
(set-email-account! "southfox.me"
|
||||
'((mu4e-sent-folder . "/southfox.me/Sent Mail")
|
||||
(mu4e-drafts-folder . "/southfox.me/Drafts")
|
||||
(mu4e-trash-folder . "/southfox.me/Trash")
|
||||
(mu4e-refile-folder . "/southfox.me/All Mail")
|
||||
(smtpmail-smtp-user . "master@southfox.me")
|
||||
(mu4e-compose-signature . "---\nFor mu4e"))
|
||||
t)
|
||||
#+end_src
|
||||
|
||||
** Rss
|
||||
设置打开 =elfeed= 时同时刷新源,
|
||||
所需源用专门的 =rss.org= 进行管理,
|
||||
对于一些访问不佳的源还得设置 =curl= 参数进行代理。
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(add-hook! 'elfeed-search-mode-hook 'elfeed-update)
|
||||
|
||||
(after! elfeed
|
||||
(setq elfeed-search-filter "@6-month-ago +unread")
|
||||
(setq rmh-elfeed-org-files '("~/Nextcloud/rss/rss.org"))
|
||||
(setq elfeed-curl-extra-arguments '("-H Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36"
|
||||
"--proxy" "socks5://127.0.0.1:10808"
|
||||
"--retry" "2"
|
||||
"--insecure")))
|
||||
#+end_src
|
||||
|
2
init.el
2
init.el
|
@ -160,7 +160,7 @@
|
|||
+pretty
|
||||
+gnuplot) ; organize your plain life in plain text
|
||||
;;php ; perl's insecure younger brother
|
||||
;;plantuml ; diagrams for confusing people more
|
||||
plantuml ; diagrams for confusing people more
|
||||
;;purescript ; javascript, but functional
|
||||
(python
|
||||
+lsp
|
||||
|
|
|
@ -69,15 +69,8 @@
|
|||
(package! ox-hugo)
|
||||
(package! ob-restclient)
|
||||
|
||||
(package! ace-pinyin
|
||||
:recipe (:host github :repo "cute-jumper/ace-pinyin"))
|
||||
|
||||
(package! sdcv
|
||||
:recipe (:host github :repo "manateelazycat/sdcv"))
|
||||
;; (package! sdcv)
|
||||
(package! emacs-guess-word-game
|
||||
:recipe (:host github
|
||||
:repo "Qquanwei/emacs-guess-word-game" :files ("*")))
|
||||
(package! wallabag
|
||||
:recipe (:host github :repo "chenyanming/wallabag.el"
|
||||
:files ("*.el" "*.alist" "*.css")))
|
||||
|
|
Loading…
Reference in a new issue