mirror of
https://github.com/lliding/ld-emacs.git
synced 2026-02-04 06:42:26 +00:00
First release.
This commit is contained in:
10
site-lisp/init-config/init-ace-window.el
Normal file
10
site-lisp/init-config/init-ace-window.el
Normal file
@@ -0,0 +1,10 @@
|
||||
;;; Require
|
||||
(require 'ace-window)
|
||||
|
||||
;;; Code:
|
||||
;; 0-9 by default
|
||||
(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
|
||||
|
||||
(provide 'init-ace-window)
|
||||
|
||||
;;; init-ace-window.el ends here
|
||||
14
site-lisp/init-config/init-auto-save.el
Normal file
14
site-lisp/init-config/init-auto-save.el
Normal file
@@ -0,0 +1,14 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'auto-save)
|
||||
|
||||
;;; Code:
|
||||
;; auto save after n second(s)
|
||||
;; (setq auto-save-idle 1)
|
||||
(setq auto-save-delete-trailing-whitespace t)
|
||||
(setq auto-save-silent t)
|
||||
(auto-save-enable)
|
||||
|
||||
(provide 'init-auto-save)
|
||||
|
||||
;;; init-auto-save.el ends here
|
||||
19
site-lisp/init-config/init-avy.el
Normal file
19
site-lisp/init-config/init-avy.el
Normal file
@@ -0,0 +1,19 @@
|
||||
;;; Require
|
||||
(require 'avy)
|
||||
|
||||
;;; Code:
|
||||
;; Home row only (the default).
|
||||
(setq avy-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
|
||||
|
||||
;; Any lower-case letter a-z.
|
||||
; (setq avy-keys (number-sequence ?a ?z))
|
||||
|
||||
;; Any lower-case letter or number. Numbers are specified in the keyboard
|
||||
;; number-row order, so that the candidate following '9' will be '0'.
|
||||
; (setq avy-keys (nconc (number-sequence ?a ?z)
|
||||
; (number-sequence ?1 ?9)
|
||||
; '(?0)))
|
||||
|
||||
(provide 'init-avy)
|
||||
|
||||
;;; init-avy.el ends here
|
||||
10
site-lisp/init-config/init-citre.el
Normal file
10
site-lisp/init-config/init-citre.el
Normal file
@@ -0,0 +1,10 @@
|
||||
;;; Require
|
||||
(require 'citre)
|
||||
(require 'citre-config)
|
||||
|
||||
;;; Code:
|
||||
;; (remove-hook 'find-file-hook #'citre-auto-enable-citre-mode)
|
||||
|
||||
(provide 'init-citre)
|
||||
|
||||
;;; init-citre.el ends here
|
||||
34
site-lisp/init-config/init-coding-system.el
Normal file
34
site-lisp/init-config/init-coding-system.el
Normal file
@@ -0,0 +1,34 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
|
||||
;;; Code:
|
||||
(set-language-environment 'UTF-8)
|
||||
|
||||
(set-default-coding-systems 'utf-8)
|
||||
(set-buffer-file-coding-system 'utf-8)
|
||||
(set-file-name-coding-system 'utf-8)
|
||||
(set-keyboard-coding-system 'utf-8)
|
||||
(set-next-selection-coding-system 'utf-8)
|
||||
(set-terminal-coding-system 'utf-8)
|
||||
|
||||
(when *win64*
|
||||
(set-next-selection-coding-system 'utf-16-le)
|
||||
(set-selection-coding-system 'utf-16-le)
|
||||
(set-clipboard-coding-system 'utf-16-le))
|
||||
|
||||
(when (or *linux* *unix* *is-a-mac*)
|
||||
(set-clipboard-coding-system 'utf-8)
|
||||
(set-selection-coding-system 'utf-8))
|
||||
|
||||
;; the final one will be selected first
|
||||
(prefer-coding-system 'cp950)
|
||||
(prefer-coding-system 'gb2312)
|
||||
(prefer-coding-system 'cp936)
|
||||
(prefer-coding-system 'gb18030)
|
||||
(prefer-coding-system 'utf-16)
|
||||
(prefer-coding-system 'utf-8-dos)
|
||||
(prefer-coding-system 'utf-8-unix)
|
||||
|
||||
(provide 'init-coding-system)
|
||||
|
||||
;;; init-coding-system ends here
|
||||
13
site-lisp/init-config/init-company-mode.el
Normal file
13
site-lisp/init-config/init-company-mode.el
Normal file
@@ -0,0 +1,13 @@
|
||||
;;; Require
|
||||
(require 'company)
|
||||
(require 'company-ctags)
|
||||
|
||||
;;; Code:
|
||||
(global-company-mode)
|
||||
|
||||
(with-eval-after-load 'company
|
||||
(company-ctags-auto-setup))
|
||||
|
||||
(provide 'init-company-mode)
|
||||
|
||||
;;; init-company-mode.el ends here
|
||||
23
site-lisp/init-config/init-dired.el
Normal file
23
site-lisp/init-config/init-dired.el
Normal file
@@ -0,0 +1,23 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'dired-display-buffer)
|
||||
(require 'dired-narrow)
|
||||
(require 'dired-subtree)
|
||||
|
||||
;;; Code:
|
||||
(setq dired-listing-switches "-alh1v --group-directories-first")
|
||||
|
||||
;; dired-subtree
|
||||
(setq dired-subtree-line-prefix " ")
|
||||
(setq dired-subtree-cycle-depth 3) ;; default `3'
|
||||
(setq dired-subtree-use-backgrounds nil) ;; default `t'
|
||||
;; (set-face-attribute 'dired-subtree-depth-1-face nil :background "#ced9db")
|
||||
;; (set-face-attribute 'dired-subtree-depth-2-face nil :background "#bbc9cc")
|
||||
;; (set-face-attribute 'dired-subtree-depth-3-face nil :background "#a7babe")
|
||||
;; (set-face-attribute 'dired-subtree-depth-4-face nil :background "#94aaaf")
|
||||
;; (set-face-attribute 'dired-subtree-depth-5-face nil :background "#809ba2")
|
||||
;; (set-face-attribute 'dired-subtree-depth-6-face nil :background "#6c8b93")
|
||||
|
||||
(provide 'init-dired)
|
||||
|
||||
;;; init-dired.el ends here
|
||||
149
site-lisp/init-config/init-generic.el
Normal file
149
site-lisp/init-config/init-generic.el
Normal file
@@ -0,0 +1,149 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
|
||||
;;; Code:
|
||||
(setq package-archives
|
||||
'(("gnu" . "http://elpa.emacs-china.org/gnu/")
|
||||
("melpa" . "http://elpa.emacs-china.org/melpa/")))
|
||||
|
||||
;; disable some bars
|
||||
(if window-system
|
||||
(progn
|
||||
(tool-bar-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
(scroll-bar-mode -1))
|
||||
(menu-bar-mode -1))
|
||||
|
||||
;; map Win key and Hyper key to Super and Hyper for emacs on Windows.
|
||||
(when *win64*
|
||||
(setq w32-pass-lwindow-to-system nil)
|
||||
(setq w32-lwindow-modifier 'super) ; Left Windows key
|
||||
(setq w32-pass-rwindow-to-system nil)
|
||||
(setq w32-rwindow-modifier 'super) ; Right Windows key
|
||||
(w32-register-hot-key [s-])
|
||||
;; (setq w32-pass-apps-to-system nil)
|
||||
(setq w32-apps-modifier 'hyper) ; Menu/App key
|
||||
(w32-register-hot-key [H-]))
|
||||
|
||||
;; Restore emacs session.
|
||||
;(setq initial-buffer-choice t)
|
||||
;(run-with-timer 1 nil #'(lambda () (bury-buffer)))
|
||||
|
||||
;; turn on word-wrap in all buffers
|
||||
(global-visual-line-mode t)
|
||||
(setq word-wrap-by-category t) ;; enhanced CJK word wrap since Emacs28
|
||||
|
||||
;; line number and column number
|
||||
(global-display-line-numbers-mode t) ;; show line numbers in every mode
|
||||
(column-number-mode t) ;; show column number
|
||||
; Line numbers are not displayed when large files are used.
|
||||
(setq line-number-display-limit large-file-warning-threshold)
|
||||
(setq line-number-display-limit-width 1000)
|
||||
|
||||
;; parentheses config
|
||||
(show-paren-mode t) ;; show bracket pairing
|
||||
(electric-pair-mode t) ;; automatic completion of parentheses
|
||||
|
||||
;; highlight current line
|
||||
(global-hl-line-mode t)
|
||||
|
||||
;; auto reload file content
|
||||
(global-auto-revert-mode t)
|
||||
|
||||
;; delete selected text when input on it
|
||||
(delete-selection-mode t)
|
||||
|
||||
;; record recently opened files
|
||||
(recentf-mode 1)
|
||||
(setq recentf-max-menu-items 25)
|
||||
(setq recentf-max-saved-items 25)
|
||||
|
||||
;; treat OneWord or one_word as one word
|
||||
(global-subword-mode t)
|
||||
|
||||
;; disable cursor blink
|
||||
(blink-cursor-mode -1)
|
||||
|
||||
;; decompress a file when open it
|
||||
(auto-compression-mode t)
|
||||
|
||||
;; disable the ring bell
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
;; set `text-mode' as default major-mode
|
||||
(setq default-major-mode 'text-mode)
|
||||
|
||||
;; use Posix format for time string
|
||||
(setq system-time-locale "C")
|
||||
|
||||
;; replace yes/no with y/n
|
||||
;; but since emacs 28 user can use (use-short-answers t) to do it
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; do not show welcome page
|
||||
(setq inhibit-startup-screen t)
|
||||
|
||||
;; use single space as sentence end, default is two
|
||||
(setq sentence-end-double-space nil)
|
||||
|
||||
;; make key prompt faster
|
||||
(setq echo-keystrokes 0.1)
|
||||
|
||||
;; increase IO performance
|
||||
(setq process-adaptive-read-buffering nil)
|
||||
(setq read-process-output-max (* 1024 1024))
|
||||
|
||||
;; scrolling config
|
||||
(setq scroll-margin 3
|
||||
scroll-conservatively 101
|
||||
auto-window-vscroll nil)
|
||||
|
||||
;; clean scratch buffer content
|
||||
; a non-clean scratch buffer will disturb session restore
|
||||
(setq initial-scratch-message "")
|
||||
|
||||
;; exit emacs without confirmation to kill running processes
|
||||
(setq confirm-kill-processes nil)
|
||||
|
||||
;; resize frame in pixel
|
||||
(setq frame-resize-pixelwise t)
|
||||
|
||||
;; show a big square when cursor is on 'tab'
|
||||
(setq x-stretch-cursor t)
|
||||
|
||||
;; delete duplicate minibuffer history
|
||||
(setq history-delete-duplicates t)
|
||||
|
||||
;; allow scroll in isearch
|
||||
(setq isearch-allow-scroll t)
|
||||
|
||||
;; don't ask me when close emacs with running process
|
||||
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
|
||||
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
|
||||
(cl-flet ((process-list ())) ad-do-it))
|
||||
|
||||
;; don't ask when kill process buffer
|
||||
(setq kill-buffer-query-functions
|
||||
(remq 'process-kill-buffer-query-function
|
||||
kill-buffer-query-functions))
|
||||
|
||||
;; (setq byte-compile-warnings
|
||||
;; (quote (
|
||||
;; ;; 显示的警告
|
||||
;; free-vars ;不在当前范围的引用变量
|
||||
;; unresolved ;不知道的函数
|
||||
;; callargs ;函数调用的参数和定义的不匹配
|
||||
;; obsolete ;荒废的变量和函数
|
||||
;; noruntime ;函数没有定义在运行时期
|
||||
;; interactive-only ;正常不被调用的命令
|
||||
;; make-local ;调用 `make-variable-buffer-local' 可能会不正确的
|
||||
;; mapcar ;`mapcar' 调用
|
||||
;; ;;
|
||||
;; ;; 抑制的警告
|
||||
;; (not redefine) ;重新定义的函数 (比如参数数量改变)
|
||||
;; (not cl-functions) ;`CL' 包中的运行时调用的函数
|
||||
;; )))
|
||||
|
||||
(provide 'init-generic)
|
||||
|
||||
;;; init-generic.el ends here
|
||||
11
site-lisp/init-config/init-highlight-parentheses.el
Normal file
11
site-lisp/init-config/init-highlight-parentheses.el
Normal file
@@ -0,0 +1,11 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'highlight-parentheses)
|
||||
|
||||
;;; Code:
|
||||
(setq hl-paren-colors '("DarkOrange" "DeepSkyBlue" "DarkRed"))
|
||||
(add-hook 'find-file-hook 'highlight-parentheses-mode t)
|
||||
|
||||
(provide 'init-highlight-parentheses)
|
||||
|
||||
;;; init-highlight-parentheses.el ends here
|
||||
59
site-lisp/init-config/init-indent.el
Normal file
59
site-lisp/init-config/init-indent.el
Normal file
@@ -0,0 +1,59 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
|
||||
;;; Code:
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq-default tab-width 4)
|
||||
|
||||
(defun adjust-languages-indent (n)
|
||||
(setq-local tab-width n)
|
||||
|
||||
(when (or (derived-mode-p 'c-mode))
|
||||
(setq-local c-basic-offset n))
|
||||
|
||||
(when (or (derived-mode-p 'js-mode)
|
||||
(derived-mode-p 'js2-mode)
|
||||
(derived-mode-p 'web-mode))
|
||||
(setq-local javascript-indent-level n)
|
||||
(setq-local js-indent-level n)
|
||||
(setq-local js2-basic-offset n)
|
||||
|
||||
(setq-local css-indent-offset n)
|
||||
|
||||
(setq-local web-mode-attr-indent-offset n)
|
||||
(setq-local web-mode-attr-value-indent-offset n)
|
||||
(setq-local web-mode-code-indent-offset n)
|
||||
(setq-local web-mode-css-indent-offset n)
|
||||
(setq-local web-mode-markup-indent-offset n)
|
||||
(setq-local web-mode-sql-indent-offset n)
|
||||
))
|
||||
|
||||
(dolist (hook (list 'c-mode-hook
|
||||
'c++-mode-hook
|
||||
'java-mode-hook
|
||||
'haskell-mode-hook
|
||||
'asm-mode-hook
|
||||
'sh-mode-hook
|
||||
'haskell-cabal-mode-hook
|
||||
'ruby-mode-hook
|
||||
'qml-mode-hook
|
||||
'scss-mode-hook
|
||||
'python-mode-hook
|
||||
))
|
||||
(add-hook hook #'(lambda ()
|
||||
(adjust-languages-indent 4)
|
||||
)))
|
||||
|
||||
(dolist (hook (list 'lua-mode-hook
|
||||
'org-mode-hook
|
||||
'js-mode-hook
|
||||
'web-mode-hook
|
||||
'yaml-mode-hook
|
||||
))
|
||||
(add-hook hook #'(lambda ()
|
||||
(adjust-languages-indent 2)
|
||||
)))
|
||||
|
||||
(provide 'init-indent)
|
||||
|
||||
;;; init-indent.el ends here
|
||||
92
site-lisp/init-config/init-mode.el
Normal file
92
site-lisp/init-config/init-mode.el
Normal file
@@ -0,0 +1,92 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'jsonian)
|
||||
(require 'lua-mode)
|
||||
|
||||
;;; Code:
|
||||
;; bind ext to a specific mode
|
||||
(defun add-to-alist (alist-var elt-cons &optional no-replace)
|
||||
"Add to the value of ALIST-VAR an element ELT-CONS if it isn't there yet.
|
||||
If an element with the same car as the car of ELT-CONS is already present,
|
||||
replace it with ELT-CONS unless NO-REPLACE is non-nil; if a matching
|
||||
element is not already present, add ELT-CONS to the front of the alist.
|
||||
The test for presence of the car of ELT-CONS is done with `equal'."
|
||||
(let ((existing-element (assoc (car elt-cons) (symbol-value alist-var))))
|
||||
(if existing-element
|
||||
(or no-replace
|
||||
(rplacd existing-element (cdr elt-cons)))
|
||||
(set alist-var (cons elt-cons (symbol-value alist-var)))))
|
||||
(symbol-value alist-var))
|
||||
|
||||
(dolist (elt-cons '(
|
||||
("\\.org\\'" . org-mode)
|
||||
("\\.stumpwmrc\\'" . lisp-mode)
|
||||
("\\.jl\\'" . lisp-mode)
|
||||
("\\.asdf\\'" . lisp-mode)
|
||||
|
||||
("\\.markdown" . markdown-mode)
|
||||
("\\.md" . markdown-mode)
|
||||
|
||||
("\\.inc\\'" . asm-mode)
|
||||
|
||||
("\\.py\\'" . python-mode)
|
||||
("SConstruct". python-mode)
|
||||
|
||||
("\\.lua\\'" . lua-mode)
|
||||
|
||||
("\\.json\\'" . jsonian-mode)
|
||||
|
||||
("\\.go\\'" . go-mode)
|
||||
|
||||
("\\.css\\'" . css-mode)
|
||||
("\\.wxss\\'" . css-mode)
|
||||
|
||||
("\\.pdf\\'" . pdf-view-mode)
|
||||
|
||||
("\\.ts\\'" . typescript-mode)
|
||||
("\\.tsx\\'" . typescript-mode)
|
||||
|
||||
("\\.js.erb\\'" . web-mode)
|
||||
("\\.js\\'" . web-mode)
|
||||
("\\.wxs\\'" . web-mode)
|
||||
|
||||
("\\.vue" . web-mode)
|
||||
("\\.wxml" . web-mode)
|
||||
("\\.blade\\.php\\'" . web-mode)
|
||||
("\\.phtml\\'" . web-mode)
|
||||
("\\.tpl\\.php\\'" . web-mode)
|
||||
("\\.jsp\\'" . web-mode)
|
||||
("\\.mustache\\'" . web-mode)
|
||||
("\\.djhtml\\'" . web-mode)
|
||||
("\\.html?\\'" . web-mode)
|
||||
("\\.jsx\\'" . web-mode)
|
||||
|
||||
;; ("\\.rs$" . rust-mode)
|
||||
("CMakeLists\\.txt\\'" . cmake-mode)
|
||||
("\\.cmake\\'" . cmake-mode)
|
||||
))
|
||||
(add-to-alist 'auto-mode-alist elt-cons))
|
||||
|
||||
;;; Mode load.
|
||||
(autoload 'cmake-mode "cmake-mode")
|
||||
|
||||
(autoload 'css-mode "css-mode")
|
||||
|
||||
(autoload 'go-mode "go-mode")
|
||||
|
||||
(autoload 'jsonian-mode "jsonian-mode")
|
||||
|
||||
(autoload 'lua-mode "lua-mode")
|
||||
(setq lua-indent-level 2)
|
||||
|
||||
(autoload 'markdown-mode "markdown-mode")
|
||||
|
||||
(autoload 'python-mode "init-python")
|
||||
|
||||
(autoload 'web-mode "web-mode")
|
||||
|
||||
;; (autoload 'rust-mode "rust-mode")
|
||||
|
||||
(provide 'init-mode)
|
||||
|
||||
;;; init-mode.el ends here
|
||||
12
site-lisp/init-config/init-neotree.el
Normal file
12
site-lisp/init-config/init-neotree.el
Normal file
@@ -0,0 +1,12 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'neotree)
|
||||
|
||||
;;; Code:
|
||||
(setq neo-theme 'ascii)
|
||||
(setq neo-show-hidden-files t)
|
||||
(setq neo-window-width 40)
|
||||
|
||||
(provide 'init-neotree)
|
||||
|
||||
;;; init-neotree.el ends here
|
||||
37
site-lisp/init-config/init-org-todo.el
Normal file
37
site-lisp/init-config/init-org-todo.el
Normal file
@@ -0,0 +1,37 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'org)
|
||||
|
||||
;;; Code:
|
||||
(setq org-agenda-files '("~/Documents/ld_org_todo"))
|
||||
|
||||
(setq org-capture-templates
|
||||
'(
|
||||
("t" "todo" entry
|
||||
(file+datetree "~/Documents/ld_org_todo/todo.org")
|
||||
"* TODO [#C] %?\n\n%i"
|
||||
:empty-lines 1 :tree-type month)
|
||||
("w" "waiting" entry
|
||||
(file+datetree "~/Documents/ld_org_todo/waiting.org")
|
||||
"* TODO [#C] %?"
|
||||
:empty-lines 1 :tree-type month)
|
||||
))
|
||||
|
||||
(setq org-refile-targets
|
||||
'(
|
||||
("~/Documents/ld_org_todo/todo.org" :maxlevel . 4)
|
||||
("~/Documents/ld_org_todo/waiting.org" :maxlevel . 4)
|
||||
(nil :maxlevel . 4)
|
||||
))
|
||||
|
||||
(setq org-use-fast-todo-selection t)
|
||||
(setq org-todo-keywords '((sequence "TODO(t)" "DOING(i)"
|
||||
"|" "DONE(d)" "ABORTED(a)")))
|
||||
(setq org-todo-keyword-faces '(("TODO" . "red")
|
||||
("DOING" . "blue")
|
||||
("DONE" . "forest green")
|
||||
("ABORTED" . "gray")))
|
||||
|
||||
(provide 'init-org-todo)
|
||||
|
||||
;;; init-org-todo.el ends here.
|
||||
233
site-lisp/init-config/init-org.el
Normal file
233
site-lisp/init-config/init-org.el
Normal file
@@ -0,0 +1,233 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'org)
|
||||
(require 'ox-publish)
|
||||
|
||||
;;; Code:
|
||||
(defun ld-org-update-lastupdate-property ()
|
||||
"If '#+LASTUPDATE' is in org file, update it to the current date/time."
|
||||
(when (eq major-mode 'org-mode)
|
||||
(save-excursion
|
||||
(widen)
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward "^#\\+LASTUPDATE:" (point-max) t)
|
||||
(progn
|
||||
(setq lastupdate-point (point))
|
||||
(if (not (equal lastupdate-point (line-end-position)))
|
||||
(delete-region lastupdate-point (line-end-position)))
|
||||
(insert (format-time-string " %Y/%m/%d %H:%M")))))))
|
||||
|
||||
(add-hook 'before-save-hook #'ld-org-update-lastupdate-property)
|
||||
|
||||
(setq org-startup-indented nil) ;; enable org-indent-mode at start, default nil.
|
||||
|
||||
(setq org-goto-auto-isearch nil)
|
||||
(setq org-support-shift-select t)
|
||||
|
||||
(setq org-use-sub-superscripts '{})
|
||||
(setq org-export-with-sub-superscripts '{})
|
||||
|
||||
;; If it is not nil, strings below will be interpreted in exporting as
|
||||
;; Org HTML LaTeX UTF-8
|
||||
;; -----+----------+--------+-------
|
||||
;; \- ­ \-
|
||||
;; -- – -- –
|
||||
;; --- — --- —
|
||||
;; ... … \ldots …
|
||||
(setq org-export-with-special-strings nil)
|
||||
|
||||
;; (set-face-attribute 'org-level-1 nil
|
||||
;; :background "#fdf0ff"
|
||||
;; :foreground "#000000"
|
||||
;; :overline "#bcbcbc"
|
||||
;; :bold t
|
||||
;; :height 1.3)
|
||||
;; (set-face-attribute 'org-level-2 nil
|
||||
;; :foreground "#8f0075"
|
||||
;; :overline "#bcbcbc"
|
||||
;; :bold t
|
||||
;; :height 1.1)
|
||||
;; (set-face-attribute 'org-level-3 nil
|
||||
;; :foreground "#093060"
|
||||
;; :weight 'semi-bold)
|
||||
;; (set-face-attribute 'org-level-4 nil
|
||||
;; :foreground "#184034"
|
||||
;; :weight 'semi-bold)
|
||||
;; (set-face-attribute 'org-level-5 nil
|
||||
;; :foreground "#61284f"
|
||||
;; :weight 'semi-bold)
|
||||
;; (set-face-attribute 'org-level-6 nil
|
||||
;; :foreground "#3f3000"
|
||||
;; :weight 'semi-bold)
|
||||
;; (set-face-attribute 'org-level-7 nil
|
||||
;; :foreground "#5f0000"
|
||||
;; :weight 'semi-bold)
|
||||
;; (set-face-attribute 'org-level-8 nil
|
||||
;; :foreground "#541f4f"
|
||||
;; :weight 'semi-bold)
|
||||
|
||||
;; (set-face-attribute 'org-block-begin-line nil
|
||||
;; :background "#f0f0f0"
|
||||
;; :foreground "#505050"
|
||||
;; :extend t)
|
||||
;; (set-face-attribute 'org-block nil
|
||||
;; :background "#f8f8f8"
|
||||
;; :foreground "#000000"
|
||||
;; :extend t
|
||||
;; )
|
||||
;; (set-face-attribute 'org-block-end-line nil
|
||||
;; :background "#f0f0f0"
|
||||
;; :foreground "#505050"
|
||||
;; :extend t)
|
||||
|
||||
;; (set-face-attribute 'org-code nil
|
||||
;; :background "#f0f0f0"
|
||||
;; :foreground "#005a5f"
|
||||
;; :extend t)
|
||||
|
||||
;; (set-face-attribute 'org-verbatim nil
|
||||
;; :background "#f0f0f0"
|
||||
;; :foreground "#8f0075"
|
||||
;; :extend t)
|
||||
|
||||
(defun ld-org-custom-html-src-block (src-block _contents info)
|
||||
"Transcode a SRC-BLOCK element from Org to HTML.
|
||||
CONTENTS holds the contents of the item. INFO is a plist holding
|
||||
contextual information.
|
||||
MAKE FINAL HTML TO BE COMPATIBLE WITH highlight.js"
|
||||
(if (org-export-read-attribute :attr_html src-block :textarea)
|
||||
(org-html--textarea-block src-block)
|
||||
(let ((lang (org-element-property :language src-block))
|
||||
(caption (org-export-get-caption src-block))
|
||||
(code (org-html-format-code src-block info))
|
||||
(label (let ((lbl (and (org-element-property :name src-block)
|
||||
(org-export-get-reference src-block info))))
|
||||
(if lbl (format " id=\"%s\"" lbl) ""))))
|
||||
(if (not lang) (format "<pre class=\"example\"%s>\n%s</pre>" label code)
|
||||
(format
|
||||
"<div class=\"org-src-container\">\n%s%s\n</div>"
|
||||
(if (not caption) ""
|
||||
(format "<label class=\"org-src-name\">%s</label>"
|
||||
(org-export-data caption info)))
|
||||
(format "\n<pre class=\"src src-%s\"%s><code class=\"language-%s\">%s</code></pre>"
|
||||
lang label lang code))))))
|
||||
|
||||
(advice-add 'org-html-src-block :override 'ld-org-custom-html-src-block)
|
||||
|
||||
(defun ld-org-custom-html-format-list-item (contents type checkbox info
|
||||
&optional term-counter-id
|
||||
headline)
|
||||
"Format a list item into HTML."
|
||||
(let ((class (if checkbox
|
||||
(format " class=\"%s\""
|
||||
(symbol-name checkbox)) ""))
|
||||
(checkbox (concat (org-html-checkbox checkbox info)
|
||||
(and checkbox " ")))
|
||||
(br (org-html-close-tag "br" nil info))
|
||||
(extra-newline (if (and (org-string-nw-p contents) headline) "\n" "")))
|
||||
(concat
|
||||
(pcase type
|
||||
(`ordered
|
||||
(let* ((counter term-counter-id)
|
||||
(extra (if counter (format " value=\"%s\"" counter) "")))
|
||||
(concat
|
||||
(format "<li%s%s>" class extra)
|
||||
(when headline (concat headline br)))))
|
||||
(`unordered
|
||||
(let* ((id term-counter-id)
|
||||
(extra (if id (format " id=\"%s\"" id) "")))
|
||||
(concat
|
||||
(format "<li%s%s>" class extra)
|
||||
(when headline (concat headline br)))))
|
||||
(`descriptive
|
||||
(let* ((term term-counter-id))
|
||||
(setq term (or term "(no term)"))
|
||||
;; Check-boxes in descriptive lists are associated to tag.
|
||||
(concat (format "<dt%s>%s</dt>"
|
||||
class (concat checkbox term))
|
||||
"<dd><p>"))))
|
||||
(unless (eq type 'descriptive) checkbox)
|
||||
extra-newline
|
||||
(and (org-string-nw-p contents) (org-trim contents))
|
||||
extra-newline
|
||||
(pcase type
|
||||
(`ordered "</li>")
|
||||
(`unordered "</li>")
|
||||
(`descriptive "</p></dd>")))))
|
||||
|
||||
(advice-add 'org-html-format-list-item :override 'ld-org-custom-html-format-list-item)
|
||||
|
||||
(defun ld-org-export-publish()
|
||||
"Publish org and then generate sitemap.xml file."
|
||||
(interactive)
|
||||
;; import project settings
|
||||
(require 'ld-org-publish-project-desc)
|
||||
;; publish site
|
||||
(org-publish-all)
|
||||
;; create sitemap for search engine
|
||||
(let (
|
||||
;; FULL PATH to doc root. MUST end with a slash.
|
||||
(ld-site-pub-path-article-root "~/Public/ld_org_article_publish/article/")
|
||||
;; file name of sitemap file, relative to webroot.
|
||||
;; file name format: <sitemap-file-name>.xml
|
||||
(ld-site-sitemap-file-name "sitemap.xml")
|
||||
;; site domain name
|
||||
(ld-site-domain-name "lishouzhong.com")
|
||||
;; gzip it or not. t for true, nil for false.
|
||||
(ld-site-sitemap-gzip-it-p nil))
|
||||
|
||||
(print (concat "begin: " (format-time-string "%Y-%m-%dT%T")))
|
||||
|
||||
;; rename file to backup ~ if already exist
|
||||
(let (f1 f2)
|
||||
(setq f1 (concat ld-site-pub-path-article-root ld-site-sitemap-file-name))
|
||||
(setq f2 (concat f1 ".gz"))
|
||||
(when (file-exists-p f1)
|
||||
(rename-file f1 (concat f1 "~") t))
|
||||
(when (file-exists-p f2)
|
||||
(rename-file f2 (concat f2 "~") t)))
|
||||
|
||||
;; create sitemap buffer
|
||||
(let (article-file-path sitemap-buffer)
|
||||
(setq article-file-path
|
||||
(concat ld-site-pub-path-article-root ld-site-sitemap-file-name))
|
||||
(setq sitemap-buffer (find-file article-file-path))
|
||||
(erase-buffer)
|
||||
(set-buffer-file-coding-system 'unix)
|
||||
(insert "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">")
|
||||
|
||||
(require 'find-lisp)
|
||||
|
||||
(let ((process-sitemap-content
|
||||
(lambda (article-file-path dest-buffer)
|
||||
(when (not (string-match "/zzz" article-file-path)) ; dir/file starting with zzz are not public
|
||||
(with-temp-buffer
|
||||
(insert-file-contents article-file-path nil nil nil t)
|
||||
(goto-char 1)
|
||||
(when (not (search-forward "<meta http-equiv=\"refresh\"" nil "noerror"))
|
||||
(with-current-buffer dest-buffer
|
||||
(insert "<url><loc>")
|
||||
(insert (concat
|
||||
"http://"
|
||||
ld-site-domain-name
|
||||
"/"
|
||||
(substring article-file-path
|
||||
(length (expand-file-name ld-site-pub-path-article-root)))))
|
||||
(insert "</loc></url>\n"))))))))
|
||||
(mapc
|
||||
(lambda (x) (funcall process-sitemap-content x sitemap-buffer))
|
||||
(find-lisp-find-files ld-site-pub-path-article-root "\\.html$")))
|
||||
|
||||
(insert "</urlset>")
|
||||
|
||||
(save-buffer)
|
||||
|
||||
(when ld-site-sitemap-gzip-it-p
|
||||
(shell-command (concat "gzip " article-file-path))))
|
||||
|
||||
(print (concat "finished: " (format-time-string "%Y-%m-%dT%T")))))
|
||||
|
||||
(provide 'init-org)
|
||||
|
||||
;;; init-org.el ends here
|
||||
45
site-lisp/init-config/init-proxy.el
Normal file
45
site-lisp/init-config/init-proxy.el
Normal file
@@ -0,0 +1,45 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require
|
||||
|
||||
;;; Code:
|
||||
(defun proxy-socks-show ()
|
||||
"Show SOCKS proxy."
|
||||
(interactive)
|
||||
(when (fboundp 'cadddr)
|
||||
(if (bound-and-true-p socks-noproxy)
|
||||
(message "Current SOCKS%d proxy is %s:%d"
|
||||
(cadddr socks-server) (cadr socks-server) (caddr socks-server))
|
||||
(message "No SOCKS proxy"))))
|
||||
|
||||
(defun proxy-socks-enable ()
|
||||
"Enable SOCKS proxy."
|
||||
(interactive)
|
||||
(require 'socks)
|
||||
(setq url-gateway-method 'socks
|
||||
socks-noproxy '("localhost")
|
||||
socks-server '("Default server" "127.0.0.1" 10800 5))
|
||||
(setenv "all_proxy" "socks5://127.0.0.1:10800")
|
||||
(proxy-socks-show))
|
||||
|
||||
(defun proxy-socks-disable ()
|
||||
"Disable SOCKS proxy."
|
||||
(interactive)
|
||||
(require 'socks)
|
||||
(setq url-gateway-method 'native
|
||||
socks-noproxy nil)
|
||||
(setenv "all_proxy" "")
|
||||
(proxy-socks-show))
|
||||
|
||||
(defun proxy-socks-toggle ()
|
||||
"Toggle SOCKS proxy."
|
||||
(interactive)
|
||||
(require 'socks)
|
||||
(if (bound-and-true-p socks-noproxy)
|
||||
(proxy-socks-disable)
|
||||
(proxy-socks-enable)))
|
||||
|
||||
;; (proxy-socks-enable)
|
||||
|
||||
(provide 'init-proxy)
|
||||
|
||||
;;; init-proxy.el ends here
|
||||
51
site-lisp/init-config/init-session.el
Normal file
51
site-lisp/init-config/init-session.el
Normal file
@@ -0,0 +1,51 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'auto-save)
|
||||
|
||||
;;; Code:
|
||||
|
||||
(setq desktop-load-locked-desktop t) ; don't popup dialog ask user, load anyway
|
||||
(setq desktop-restore-frames nil) ; don't restore any frame
|
||||
|
||||
(defun kill-unused-buffers ()
|
||||
(interactive)
|
||||
(ignore-errors
|
||||
(save-excursion
|
||||
(dolist (buf (buffer-list))
|
||||
(set-buffer buf)
|
||||
(when (and (string-prefix-p "*" (buffer-name)) (string-suffix-p "*" (buffer-name)))
|
||||
(kill-buffer buf))
|
||||
))))
|
||||
|
||||
(defun emacs-session-restore ()
|
||||
"Restore emacs session."
|
||||
(interactive)
|
||||
(ignore-errors
|
||||
;; Kill other windows.
|
||||
(delete-other-windows)
|
||||
;; Kill unused buffers.
|
||||
(kill-unused-buffers)
|
||||
;; Restore session.
|
||||
(desktop-read "~/.emacs.d/")
|
||||
))
|
||||
|
||||
(defun emacs-session-save (&optional arg)
|
||||
"Save emacs session."
|
||||
(interactive "p")
|
||||
(ignore-errors
|
||||
(if (equal arg 4)
|
||||
;; Kill all buffers if with prefix argument.
|
||||
(mapc 'kill-buffer (buffer-list))
|
||||
;; Kill unused buffers.
|
||||
(kill-unused-buffers)
|
||||
;; Save all buffers before exit.
|
||||
(auto-save-buffers))
|
||||
;; Save session.
|
||||
(make-directory "~/.emacs.d/" t)
|
||||
(desktop-save "~/.emacs.d/")
|
||||
;; Exit emacs.
|
||||
(kill-emacs)))
|
||||
|
||||
(provide 'init-session)
|
||||
|
||||
;;; init-session.el ends here
|
||||
256
site-lisp/init-config/init-shortcut.el
Normal file
256
site-lisp/init-config/init-shortcut.el
Normal file
@@ -0,0 +1,256 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
|
||||
;;; There are 3 sections:
|
||||
;;; - unset keys
|
||||
;;; - extensions
|
||||
;;; - extensions-local
|
||||
;;; - shortcut on built-in function
|
||||
|
||||
;;; ------------ unset keys
|
||||
|
||||
; originally
|
||||
; 'C-i' is TAB
|
||||
; 'C-r' is isearch-backward
|
||||
(lazy-load-unset-keys
|
||||
'("C-z" "C-\\" "C-'" "C-i" "C-r"))
|
||||
|
||||
|
||||
|
||||
;;; ------------ extensions
|
||||
|
||||
;; ------ ace-window
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("M-o" . ace-window)
|
||||
)
|
||||
"init-ace-window")
|
||||
|
||||
;; ------ avy
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("M-g c" . avy-goto-char)
|
||||
("M-g w" . avy-goto-word-1)
|
||||
("M-g s" . avy-goto-word-0)
|
||||
("M-g l l" . avy-goto-line)
|
||||
("M-g j" . avy-next)
|
||||
("M-g k" . avy-prev)
|
||||
)
|
||||
"init-avy")
|
||||
|
||||
;; ------ citre
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-x c c" . citre-mode)
|
||||
("C-x c j" . citre-jump)
|
||||
("C-x c J" . citre-jump-back)
|
||||
("C-x c p" . citre-ace-peek)
|
||||
("C-x c u" . citre-update-this-tags-file)
|
||||
)
|
||||
"init-citre")
|
||||
|
||||
;; ------ theme
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("<f5>" . ld-modus-themes-toggle)
|
||||
)
|
||||
"init-theme")
|
||||
|
||||
;; ------ multiple cursors
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-M-." . mc/mark-next-like-this)
|
||||
("C-M-," . mc/unmark-next-like-this)
|
||||
("M-<" . mc/mark-previous-like-this)
|
||||
("M->" . mc/unmark-previous-like-this)
|
||||
("C-M-<" . mc/edit-beginnings-of-lines)
|
||||
("M-<mouse-1>" . mc/add-cursor-on-click)
|
||||
)
|
||||
"multiple-cursors")
|
||||
|
||||
;; ------ swiper
|
||||
(lazy-load-set-keys
|
||||
'(
|
||||
("C-s" . swiper-isearch)
|
||||
("C-c s" . counsel-rg)
|
||||
))
|
||||
|
||||
|
||||
|
||||
;;; ------------ extensions-local
|
||||
|
||||
(lazy-load-set-keys
|
||||
'(
|
||||
;; dired-display-buffer
|
||||
("o" . dired-display-buffer)
|
||||
;; dired-narrow
|
||||
("/" . dired-narrow)
|
||||
;; dired-subtree
|
||||
("<tab>" . dired-subtree-cycle)
|
||||
("SPC" . dired-subtree-toggle)
|
||||
("C-p" . dired-subtree-previous-sibling)
|
||||
("C-n" . dired-subtree-next-sibling)
|
||||
("r" . dired-subtree-revert)
|
||||
)
|
||||
dired-mode-map)
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-c e e" . toggle-echo-keys)
|
||||
("C-c e c" . echo-keys-clean)
|
||||
)
|
||||
"echo-keys") ;show every pressed keys
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-c x e" . ld-eval-elisp-to-next-line)
|
||||
)
|
||||
"evals") ;execute code
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-<" . ld-un-indent)
|
||||
("C->" . ld-indent)
|
||||
)
|
||||
"force-indent") ;control 4 spaces indent manually
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-c \\" . goto-last-change)
|
||||
)
|
||||
"goto-last-change")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("M-g l p" . goto-line-preview)
|
||||
)
|
||||
"goto-line-preview")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-c m h a" . highlight-indentation-mode)
|
||||
("C-c m h c" . highlight-indentation-current-column-mode)
|
||||
)
|
||||
"highlight-indentation")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-r i" . ld-indent-buffer)
|
||||
("C-r r" . ld-rename-file-and-buffer)
|
||||
("C-r d" . ld-delete-file-and-buffer)
|
||||
("C-r e" . ld-revert-buffer-no-confirm)
|
||||
("C-i r" . ld-find-file-in-root) ; open file with root by sudo
|
||||
)
|
||||
"ld-buffer-operations")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-;" . ld-cursor-position-1-store) ;store cursor position
|
||||
("C-'" . ld-cursor-position-1-jump) ;jump to cursor position
|
||||
("C-c ," . ld-cursor-position-stack-push) ;push cursor position to stack
|
||||
("C-c ." . ld-cursor-position-stack-pop) ;pop corsor position from stack
|
||||
)
|
||||
"ld-goto-cursor-stack")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("M-N" . ld-delete-one-block-backward)
|
||||
("M-M" . ld-delete-one-block-forward)
|
||||
)
|
||||
"ld-delete-block") ;delete a block (eg. a word) forward and backward
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-i r" . ld-find-file-in-root) ; open file with root by sudo
|
||||
)
|
||||
"ld-file-operations")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("M-g l p" . ld-goto-percent-line)
|
||||
("M-g t p" . ld-goto-percent-text)
|
||||
("M-g t c" . ld-goto-column)
|
||||
)
|
||||
"ld-goto-simple")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("M-p" . ld-move-text-up)
|
||||
("M-n" . ld-move-text-down)
|
||||
("C-c l d" . ld-duplicate-current-line-or-region)
|
||||
("C-c l D" . ld-duplicate-and-comment-current-line-or-region)
|
||||
("C-c l k" . ld-delete-current-line)
|
||||
("C-c m l" . ld-mark-line)
|
||||
)
|
||||
"ld-text-operations")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("C-c w t" . ld-toggle-one-window)
|
||||
)
|
||||
"ld-toggle-one-window") ;maxmize current window and size back
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(("C-x j" . neotree-toggle))
|
||||
"init-neotree")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("M-j" . watch-next-window-up-line) ; 'up' to see previous content
|
||||
("M-k" . watch-next-window-down-line) ; 'down' to see further content
|
||||
("M-J" . watch-next-window-up)
|
||||
("M-K" . watch-next-window-down)
|
||||
)
|
||||
"scroll-next-window")
|
||||
|
||||
(lazy-load-global-keys
|
||||
'(
|
||||
("<f4>" . emacs-session-save)
|
||||
)
|
||||
"init-session")
|
||||
|
||||
|
||||
|
||||
;;; ------------ shortcut on built-in function
|
||||
|
||||
;; ------ org related
|
||||
(lazy-load-set-keys
|
||||
'(
|
||||
("C-c o c" . org-capture)
|
||||
("C-c o a" . org-agenda)
|
||||
("C-c o l r" . org-list-repair)
|
||||
))
|
||||
|
||||
;; ------ move cursors in current buffer
|
||||
(lazy-load-set-keys
|
||||
'(
|
||||
("M-g b k" . beginning-of-buffer)
|
||||
("M-g b j" . end-of-buffer)
|
||||
("M-g h j" . forward-paragraph)
|
||||
("M-g h k" . backward-paragraph)
|
||||
("M-g l y" . backward-up-list) ;向左跳出 LIST
|
||||
("M-g l o" . up-list) ;向右跳出 LIST
|
||||
("M-g l u" . backward-down-list) ;向左跳进 LIST
|
||||
("M-g l i" . down-list) ;向右跳进 LIST
|
||||
("M-g f a" . beginning-of-defun) ;函数开头
|
||||
("M-g f e" . end-of-defun) ;函数末尾
|
||||
))
|
||||
|
||||
;; ------ other
|
||||
(lazy-load-set-keys
|
||||
'(
|
||||
("C-z r" . global-hl-line-mode)
|
||||
("C-z l" . display-line-numbers-mode)
|
||||
("M--" . text-scale-decrease)
|
||||
("M-=" . text-scale-increase)
|
||||
("M-," . bury-buffer)
|
||||
("M-." . unbury-buffer)
|
||||
("C-c m m" . set-mark-command) ; replace C-Space for Chinese input method
|
||||
("M-;" . comment-dwim)
|
||||
("C-c r" . recentf-open-files)
|
||||
))
|
||||
|
||||
|
||||
|
||||
(provide 'init-shortcut)
|
||||
|
||||
;;; init-shortcut.el ends here
|
||||
34
site-lisp/init-config/init-swiper.el
Normal file
34
site-lisp/init-config/init-swiper.el
Normal file
@@ -0,0 +1,34 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'ivy)
|
||||
(require 'counsel)
|
||||
(require 'swiper)
|
||||
|
||||
;;; Code:
|
||||
(setq ivy-use-virtual-buffers t)
|
||||
(setq ivy-initial-inputs-alist nil)
|
||||
(setq ivy-count-format "(%d/%d) ")
|
||||
|
||||
;; Map commands to their minimum required input length.
|
||||
;; That is the number of characters prompted for before fetching
|
||||
;; candidates. The special key t is used as a fallback.
|
||||
(setq ivy-more-chars-alist '((t . 2)))
|
||||
|
||||
(ivy-mode 1)
|
||||
|
||||
(setq counsel-rg-base-command
|
||||
`("rg"
|
||||
"--max-columns" "0"
|
||||
"--with-filename"
|
||||
"--no-heading"
|
||||
"--line-number"
|
||||
"--color" "never"
|
||||
"%s"
|
||||
,@(and (memq system-type '(ms-dos windows-nt))
|
||||
(list "--path-separator" "/" "."))))
|
||||
|
||||
(counsel-mode 1)
|
||||
|
||||
(provide 'init-swiper)
|
||||
|
||||
;; init-swiper.el ends here
|
||||
82
site-lisp/init-config/init-theme.el
Normal file
82
site-lisp/init-config/init-theme.el
Normal file
@@ -0,0 +1,82 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'modus-themes)
|
||||
|
||||
;;; Code:
|
||||
;; font
|
||||
(when (and window-system *win64*)
|
||||
(let ((default-font (font-spec :name "Sarasa Fixed SC"))
|
||||
(cn-font (font-spec :name "Sarasa Fixed SC")))
|
||||
(set-face-attribute 'default nil :font default-font :height 116)
|
||||
(dolist (charset '(kana han symbol cjk-misc bopomofo))
|
||||
(set-fontset-font t charset cn-font)))
|
||||
(set-face-font 'fixed-pitch "Sarasa Fixed SC"))
|
||||
|
||||
;; theme
|
||||
;; In all of the following, WEIGHT is a symbol such as `semibold',
|
||||
;; `light', `bold', or anything mentioned in `modus-themes-weights'.
|
||||
(setq modus-themes-italic-constructs t
|
||||
modus-themes-bold-constructs nil
|
||||
modus-themes-mixed-fonts t
|
||||
modus-themes-variable-pitch-ui nil
|
||||
modus-themes-custom-auto-reload t
|
||||
modus-themes-disable-other-themes t
|
||||
|
||||
;; Options for `modus-themes-prompts' are either nil (the
|
||||
;; default), or a list of properties that may include any of those
|
||||
;; symbols: `italic', `WEIGHT'
|
||||
modus-themes-prompts '(italic bold)
|
||||
|
||||
;; The `modus-themes-completions' is an alist that reads two
|
||||
;; keys: `matches', `selection'. Each accepts a nil value (or
|
||||
;; empty list) or a list of properties that can include any of
|
||||
;; the following (for WEIGHT read further below):
|
||||
;;
|
||||
;; `matches' :: `underline', `italic', `WEIGHT'
|
||||
;; `selection' :: `underline', `italic', `WEIGHT'
|
||||
modus-themes-completions
|
||||
'((matches . (extrabold))
|
||||
(selection . (semibold italic text-also)))
|
||||
|
||||
modus-themes-org-blocks 'gray-background ; {nil,'gray-background,'tinted-background}
|
||||
|
||||
;; The `modus-themes-headings' is an alist: read the manual's
|
||||
;; node about it or its doc string. Basically, it supports
|
||||
;; per-level configurations for the optional use of
|
||||
;; `variable-pitch' typography, a height value as a multiple of
|
||||
;; the base font size (e.g. 1.5), and a `WEIGHT'.
|
||||
modus-themes-headings
|
||||
'((1 . (variable-pitch 1.5))
|
||||
(2 . (1.3))
|
||||
(agenda-date . (1.3))
|
||||
(agenda-structure . (variable-pitch light 1.8))
|
||||
(t . (1.1))))
|
||||
|
||||
(defun ld-modus-operandi ()
|
||||
"Light theme."
|
||||
(interactive)
|
||||
;; load theme firstly and then do user customization
|
||||
;; otherwise modus-themes will override the face user had assigned
|
||||
(load-theme 'modus-operandi :no-confirm))
|
||||
|
||||
(defun ld-modus-vivendi-tinted ()
|
||||
"Dark theme."
|
||||
(interactive)
|
||||
;; load theme firstly and then do user customization
|
||||
;; otherwise modus-themes will override the face user had assigned
|
||||
(load-theme 'modus-vivendi-tinted :no-confirm))
|
||||
|
||||
(defun ld-modus-themes-toggle ()
|
||||
(interactive)
|
||||
(if (eq (car custom-enabled-themes) 'modus-operandi)
|
||||
(ld-modus-vivendi-tinted)
|
||||
(ld-modus-operandi)))
|
||||
|
||||
;; active light theme
|
||||
(if window-system
|
||||
(ld-modus-operandi)
|
||||
(ld-modus-vivendi-tinted))
|
||||
|
||||
(provide 'init-theme)
|
||||
|
||||
;;; init-theme.el ends here
|
||||
14
site-lisp/init-config/init-time.el
Normal file
14
site-lisp/init-config/init-time.el
Normal file
@@ -0,0 +1,14 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(setq display-time-day-and-date t)
|
||||
(setq display-time-format "%Y/%m/%d %H:%M")
|
||||
(setq display-time-24hr-format t)
|
||||
(display-time-mode 1)
|
||||
(display-time)
|
||||
|
||||
(provide 'init-time)
|
||||
|
||||
;;; init-time.el ends here
|
||||
19
site-lisp/init-config/init-undo-tree.el
Normal file
19
site-lisp/init-config/init-undo-tree.el
Normal file
@@ -0,0 +1,19 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'undo-tree)
|
||||
|
||||
;;; Code:
|
||||
(global-undo-tree-mode)
|
||||
|
||||
;; ;; --- undo-tree
|
||||
;; (lazy-load-local-keys
|
||||
;; '(
|
||||
;; ("C-/" . undo-tree-undo)
|
||||
;; ("C-?" . undo-tree-redo)
|
||||
;; )
|
||||
;; undo-tree-map
|
||||
;; "undo-tree")
|
||||
|
||||
(provide 'init-undo-tree)
|
||||
|
||||
;;; init-undo-tree.el ends here
|
||||
17
site-lisp/init-config/init-which-key.el
Normal file
17
site-lisp/init-config/init-which-key.el
Normal file
@@ -0,0 +1,17 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'which-key)
|
||||
|
||||
;;; Code:
|
||||
(setq which-key-show-early-on-C-h t)
|
||||
(setq which-key-idle-delay 10000)
|
||||
(setq which-key-idle-secondary-delay 0.05)
|
||||
(setq which-key-max-description-length nil) ;; show entire key name
|
||||
|
||||
(which-key-mode)
|
||||
|
||||
(which-key-setup-side-window-bottom)
|
||||
|
||||
(provide 'init-which-key)
|
||||
|
||||
;;; init-which-key.el ends here
|
||||
17
site-lisp/init-config/init-yasnippet.el
Normal file
17
site-lisp/init-config/init-yasnippet.el
Normal file
@@ -0,0 +1,17 @@
|
||||
;; -*- coding: utf-8; -*-
|
||||
;;; Require:
|
||||
(require 'yasnippet)
|
||||
|
||||
;;; Code:
|
||||
(setq yas-snippet-dirs (list (concat ld-emacs-root-dir "/snippets")))
|
||||
(yas-global-mode 1)
|
||||
|
||||
;; Disable yasnippet mode on some mode.
|
||||
(dolist (hooks (list
|
||||
'term-mode-hook
|
||||
))
|
||||
(add-hook hooks #'(lambda () (yas-minor-mode -1))))
|
||||
|
||||
(provide 'init-yasnippet)
|
||||
|
||||
;;; init-yasnippet.el ends here
|
||||
46
site-lisp/init-config/init.el
Normal file
46
site-lisp/init-config/init.el
Normal file
@@ -0,0 +1,46 @@
|
||||
;;; -*- coding: utf-8-unix; lexical-binding: t; -*-
|
||||
|
||||
(let (
|
||||
;; Make startup faster by reducing the frequency of garbage collection.
|
||||
;; default (* 800 1000) bytes
|
||||
(gc-cons-threshold most-positive-fixnum)
|
||||
;; default 0.1
|
||||
(gc-cons-percentage 0.6))
|
||||
|
||||
;; keep frame size
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
|
||||
;; from local extensions
|
||||
;; firstly loaded part
|
||||
(require 'init-theme)
|
||||
(require 'lazy-load)
|
||||
(require 'init-generic)
|
||||
(require 'ld-tools)
|
||||
|
||||
(require 'init-auto-save)
|
||||
(require 'init-coding-system)
|
||||
(require 'init-company-mode)
|
||||
(require 'init-dired)
|
||||
(require 'init-highlight-parentheses)
|
||||
(require 'init-indent)
|
||||
(require 'init-mode)
|
||||
(require 'init-org-todo)
|
||||
(require 'init-org)
|
||||
(require 'init-proxy)
|
||||
(require 'init-swiper)
|
||||
(require 'init-time)
|
||||
(require 'init-undo-tree)
|
||||
(require 'init-which-key)
|
||||
(require 'init-yasnippet)
|
||||
|
||||
;; restore session
|
||||
(require 'init-session)
|
||||
(emacs-session-restore)
|
||||
|
||||
;; finally load other plugins dynamically
|
||||
(require 'init-shortcut)
|
||||
)
|
||||
|
||||
(provide 'init)
|
||||
|
||||
;;; init.el ends here
|
||||
Reference in New Issue
Block a user