Emacs相关中文问题以及解决方案

在 doom-emacs 中使用 spacemacs 的 layers

Doom-emacs

感觉 Spacemacs 用起来还是有点卡,且启动慢,用久了更卡了,只能怪自己太菜了,所以今天开始尝试转向 doom-emacs

配置列表:

  1. https://github.com/rschmukler/doom.d

  2. https://github.com/forrestchang/.doom.d

  3. https://rgoswami.me/dotdoom/config.html

  4. https://github.com/hlissner/doom-emacs-private

  5. https://github.com/sunnyhasija/Academic-Doom-Emacs-Config

  6. https://emacs.nasy.moe/

  7. 主题:https://github.com/hlissner/emacs-doom-themes

  8. https://github.com/tecosaur/emacs-config/blob/master/config.org

    常用按键

keyfunction
<f12>smerge-vc-next-conflict
<f11>+vc/smerge-hydra/body
<f10>ebuku
C-s-,parrot previous
C-s-.parrot next
SPC *+default/search-project-for-symbol-at-point
SPC 'ivy-resume
SPC ,+ivy/switch-workspace-buffer
SPC .counsel-find-file, find file in current dir
SPC /+default/search-project
SPC <ivy-switch-buffer
SPC RETcounsel-bookmark
SPC v oivy-pop-view
SPC v pivy-push-view
SPC a lleetcode
SPC b mset bookmark
SPC b Mdelete bookmark

Base Configuration/Operation

重新加载配置

keymodefunction
grevil 选中模式下执行选中代码
C-x C-e-eval-last-sexp
SPC c e-M-x +eval/buffer-or-region

packages

ebuku, browser bookmarks management

web-mode

hydra:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(defhydra hydra-web-mode (:color blue :quit-key "q" :hint nil :columns 4)
  "
^Element^                       ^Element^                       ^Attribute^             ^Block&Other
^^^^^^^^---------------------------------------------------------------------------------------------
_a_ : Select content            _r_ : Rename                    _0_ : Start             _<_ : Begin 
_b_ : Start                     _s_ : Select                    _9_ : End               _>_ : End
_C_ : Clone                     _t_ : Move Down                 _*_ : Insert            _-_ : Select
_e_ : End                       _u_ : Parent                    _N_ : Next                   
_f_ : Fold/unfold children      _v_ : Delete without content    _P_ : Previous                
_i_ : Insert                    _w_ : Wrap Element              _S_ : Select 
_I_ : Insert cursor             _t_ : Last(open/close)          _K_ : Delete
_k_ : Delete                    _T_ : Next(open/close)           
_n_ : Next                      _._ : Wrap Markup 
_p_ : Previous                  
"
 ("a" web-mode-element-content-select)
 ("b" web-mode-element-beginning)
 ("e" web-mode-element-end)
 ("f" web-mode-element-children-fold-or-unfold)
 ("F" web-mode-fold-unfold)
 ("i" web-mode-element-insert)
 ("I" web-mode-element-insert-at-point)
 ("k" web-mode-element-kill)
 ("m" web-mode-element-mute-blanks)
 ("n" web-mode-element-next :exit nil :color "pink")
 ("p" web-mode-element-previous :exit nil :color "pink")
 ("r" web-mode-element-rename)
 ("s" web-mode-element-select)
 ("t" web-mode-element-transpose)
 ("u" web-mode-element-parent :exit nil :color "pink")
 ("v" web-mode-element-vanish)
 ("w" web-mode-element-wrap)
 ("t" web-mode-tag-previous :exit nil :color "pink")
 ("T" web-mode-tag-next :exit nil :color "pink")
 ("." emmet-wrap-with-markup)
 ;; attribute
 ("0" web-mode-attribute-beginning)
 ("9" web-mode-attribute-end)
 ("*" web-mode-attribute-insert)
 ("K" web-mode-attribute-kill)
 ("N" web-mode-attribute-next :exit nil :color "pink")
 ("P" web-mode-attribute-previous :exit nil :color "pink")
 ("S" web-mode-attribute-select)
 ;; block
 ("<" web-mode-block-next :exit nil :color "pink")
 (">" web-mode-block-previous :exit nil :color "pink")
 ("-" web-mode-block-select)
  )
keyfunctionsdesc
[tweb-mode-tag-previous上一个标签(包含开闭标签)
]tweb-mode-tag-next下一个标签(包含开闭标签)
z
z.emmet-wrap-with-markup
C-c
C-sweb-mode-snippet-insert插入snippets
C-fweb-mode-fold-or-unfold-
C-c C-dDOM 操作
dweb-mode-dom-errors-show显示DOM错误信息,标签是否闭合等等
C-c C-eelement操作
aweb-mode-element-content-select选择标签内容
bweb-mode-element-beginning-
eweb-mode-element-end-
fweb-mode-element-children-fold-or-unfoldfold/unfold children element
iweb-mode-element-insert插入标签根据输入标签名
Iweb-mode-element-insert-at-point根据光标处的名字插入标签
kweb-mode-element-kill删除当前标签
mweb-mode-element-mute-blanks?
nweb-mode-element-next
pweb-mode-element-previous-
rweb-mode-element-rename
sweb-mode-element-select选中标签及其内容
tweb-mode-element-transpose将当前标签移到下一个标签后面
uweb-mode-element-parent-
vweb-mode-element-vanish删除标签只保留标签内容,如: <div>{{xx}}</div> 变成: {{xx}}
wweb-mode-element-wrapwrap with tag
C-c C-bblock 操作
nweb-mode-block-next下一个block
pweb-mode-block-previous上一个 block
sweb-mode-block-select选中当前block
C-c C-aattribute 操作
bweb-mode-attribute-beginning定位到属性开始
eweb-mode-attribute-end定位到属性结尾
iweb-mode-attribute-insert插入属性
kweb-mode-attribute-kill删除属性
nweb-mode-attribute-next
pweb-mode-attribute-previous
sweb-mode-attribute-select
tweb-mode-attribute-transpose
web-mode Keybindings

lsp-mode

leetcode

https://github.com/kaiwk/leetcode.el

1
2
3
4
5
6
7
8
9
(:prefix ("l" . "Leetcode")
        "l" #'leetcode
        "s" #'leetcode-submit
        "t" #'leetcode-try
        "r" #'leetcode-refresh
        "R" #'leetcode-refresh-fetch
        "f" #'leetcode-set-filter-difficulty
        "." #'leetcode-reset-filter
        )

keybinds:

keyfunction
SPC a l lleetcode
SPC a l sleetcode-submit
SPC a l tleetcode-try
SPC a l Tleetcode-set-filter-tags
SPC a l rleetcode-refresh
SPC a l Rleetcode-refresh-fetch
SPC a l fleetcode-set-filter-difficulty
SPC a l .leetcode-reset-filter
SPC a l xleetcode-set-filter-regex
SPC a l pleetcode-show-current-problem

hydra/body:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
(defhydra hydra-leetcode (:columns 3)
  "
^^^^Leetcode^^^^
----------------------------------------------------------------------
"
  ("s" leetcode-submit "sumbit")
  ("t" leetcode-try "try")
  ("r" leetcode-refresh "refresh")
  ("R" leetcode-refresh-fetch "refresh fetch")
  ("s" leetcode-show-current-problem "show current problem")
  ("f" leetcode-set-filter-difficulty "filter by difficulty")
  ("g" leetcode-set-filter-tag "filter by tag")
  ("e" leetcode-set-filter-regex "filter by regexp")
  ("0" leetcode-reset-filter "reset filter")
  )

go-mode

install: https://www.mdeditor.tw/pl/2KAi

  1. no such file or directory gocode ?

smart-hungry-delete

https://github.com/hrehfeld/emacs-smart-hungry-delete

1
2
3
4
5
6
7
(use-package smart-hungry-delete
  :ensure t
  :bind (("<backspace>" . smart-hungry-delete-backward-char)
		 ("C-d" . smart-hungry-delete-forward-char))
  :defer nil ;; dont defer so we can add our functions to hooks 
  :config (smart-hungry-delete-add-default-hooks)
  )

string-inflection 代码风格切换(python/java/ruby/…)

github link-

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
(defun gcl/string-inflection-cycle-auto ()
  "switching by major-mode"
  (interactive)
  (cond
   ;; for emacs-lisp-mode
   ((eq major-mode 'emacs-lisp-mode)
    (string-inflection-all-cycle))
   ;; for python
   ((eq major-mode 'python-mode)
    (string-inflection-python-style-cycle))
   ;; for java
   ((eq major-mode 'java-mode)
    (string-inflection-java-style-cycle))
   (t
    ;; default
    (string-inflection-java-style-cycle))))

parrot(C-s)

https://github.com/dp12/parrot

rotate text,在约定的几个字符串之间来回切换。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(setq parrot-rotate-dict
      '(
        (:rot ("alpha" "beta") :caps t :lower nil)
        ;; => rotations are "Alpha" "Beta"

        (:rot ("snek" "snake" "stawp"))
        ;; => rotations are "snek" "snake" "stawp"

        (:rot ("yes" "no") :caps t :upcase t)
        ;; => rotations are "yes" "no", "Yes" "No", "YES" "NO"

        (:rot ("&" "|"))
        ;; => rotations are "&" "|"

        ;; default dictionary starts here ('v')
        (: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 ("prev" "next"))
        (:rot ("start" "stop") :caps t :upcase t)
        (:rot ("true" "false") :caps t :upcase t)
        (:rot ("&&" "||"))
        (:rot ("==" "!="))
        (:rot ("." "->"))
        (:rot ("if" "else" "elif"))
        (:rot ("ifdef" "ifndef"))
        (:rot ("int8_t" "int16_t" "int32_t" "int64_t"))
        (:rot ("uint8_t" "uint16_t" "uint32_t" "uint64_t"))
        (:rot ("1" "2" "3" "4" "5" "6" "7" "8" "9" "10"))
        (:rot ("1st" "2nd" "3rd" "4th" "5th" "6th" "7th" "8th" "9th" "10th"))
        ))

配置:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
(use-package! parrot
  :init
  (progn
    (define-key global-map (kbd "C-s ,") 'parrot-rotate-prev-word-at-point)
    (define-key global-map (kbd "C-s .") 'parrot-rotate-next-word-at-point))
  :config
  (parrot-mode)
  (setq parrot-ratate-dict
        '(
          (:rot ("alpha" "beta") :caps t :lower nil) ;; => Alpha, Beta
          (:rot ("yes" "no") :caps t :upcase t) ;; => yes,no,No,YES,NO
          (:rot ("&" "|"))
          )))

Keybindings

所有常用按键均通过 hydra 注释方式展现,方便查询:

test

key 绑定函数:

  • define-key

  • global-set-key

  • map!

  • undefined-key!

  • define-key!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
;; bind a global key
(global-set-key (kbd "C-x y") #'do-something)
(map! "C-x y" #'do-something)

;; bind a key on a keymap
(define-key emacs-lisp-mode-map (kbd "C-c p") #'do-something)
(map! :map emacs-lisp-mode-map "C-c p" #'do-something)

;; unbind a key defined elsewhere
(define-key lua-mode-map (kbd "SPC m b") nil)
(map! :map lua-mode-map "SPC m b" nil)

;; bind multiple keys
(global-set-key (kbd "C-x x") #'do-something)
(global-set-key (kbd "C-x y") #'do-something-else)
(global-set-key (kbd "C-x z") #'do-another-thing)
(map! "C-x x" #'do-something
      "C-x y" #'do-something-else
      "C-x z" #'do-another-thing)

;; bind global keys in normal mode
(evil-define-key* 'normal 'global
  (kbd "C-x x") #'do-something
  (kbd "C-x y") #'do-something-else
  (kbd "C-x z") #'do-another-thing)
(map! :n "C-x x" #'do-something
      :n "C-x y" #'do-something-else
      :n "C-x z" #'do-another-thing)

;; or on a deferred keymap
(evil-define-key 'normal emacs-lisp-mode-map
  (kbd "C-x x") #'do-something
  (kbd "C-x y") #'do-something-else
  (kbd "C-x z") #'do-another-thing)
(map! :map emacs-lisp-mode-map
      :n "C-x x" #'do-something
      :n "C-x y" #'do-something-else
      :n "C-x z" #'do-another-thing)

;; or multiple maps
(dolist (map (list emacs-lisp-mode go-mode-map ivy-minibuffer-map))
  (evil-define-key '(normal insert) map
    "a" #'a
    "b" #'b
    "c" #'c))
(map! :map (emacs-lisp-mode go-mode-map ivy-minibuffer-map)
      :ni "a" #'a
      :ni "b" #'b
      :ni "c" #'c)

;; or in multiple states (order of states doesn't matter)
(evil-define-key* '(normal visual) emacs-lisp-mode-map (kbd "C-x x") #'do-something)
(evil-define-key* 'insert emacs-lisp-mode-map (kbd "C-x x") #'do-something-else)
(evil-define-key* '(visual normal insert emacs) emacs-lisp-mode-map (kbd "C-x z") #'do-another-thing)
(map! :map emacs-lisp-mode
      :nv   "C-x x" #'do-something      ; normal+visual
      :i    "C-x y" #'do-something-else ; insert
      :vnie "C-x z" #'do-another-thing) ; visual+normal+insert+emacs

;; You can nest map! calls:
(evil-define-key* '(normal visual) emacs-lisp-mode-map (kbd "C-x x") #'do-something)
(evil-define-key* 'normal go-lisp-mode-map (kbd "C-x x") #'do-something-else)
(map! (:map emacs-lisp-mode :nv "C-x x" #'do-something)
      (:map go-lisp-mode    :n  "C-x x" #'do-something-else))

所有按键表

C-Control, s-Command, S-Shift, M-option/alt

prefixkeyfunctionmodedescription
g字母 g
~~
z字母 z
-sp-splice-sexp取消括号
CControl
(sp-backward-slurp-sexp左括号左移
)sp-forward-slurp-sexp右括号右移
+cnfonts-increase-fontsize-
-cnfonts-decrease-fontsize-
MOption/Alt
uupcase-word
ldowncase-word
ccapitalize-word
sCommand
<move-text-up
>move-text-down
(sp-forward-barf-sexp左括号右移
)sp-backward-barf-sexp右括号左移
q+workspace/kill-session-and-quitsave-buffers-kill-terminal
C-s
,parrot-rotate-prev-word-at-point-
.parrot-rotate-next-word-at-point-
C-c
dinsert-current-date-time
tinsert-current-time
rvr/replace-
qvr/query-replace
ucrux-view-url
Ubrowse-url-at-point
C-SControl + Shift
SPC
b fosx-lib-reveal-in-finder-
b Okill-other-buffers-
c e+eval/buffer-or-region-
l mlsp-ui-imenu-
l ttreemacs-
n norg-capture
n Norg-goto-capture
m rintant-rename-tagweb-mode同步修改标签名
w -evil-window-split水平分割
w vevil-window-vsplit垂直分割

主面板

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
(defhydra hydra-main (:color blue :exit t :hint nil)
  "
all hydra apps:
------------------------------------------------------------------
 [_a_]   Tip          [_h_]   Launcher     [_m_]   Multiple Cursors
 [_w_]   Window       [_t_]   Text Zoom    [_o_]   Org Agenda          
"
  ("a" hydra-tip/body)
  ("h" hydra-launcher/body)
  ("m" hydra-multiple-cursors/body)
  ("w" +hydra/window-nav/body)
  ("t" +hydra/text-zoom/body)
  ("o" hydra-org-agenda-view/body)
  )

提示面板入口

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
;; 提示面板
(defhydra hydra-tip (:color blue :hint nil)
  "
Tips for modes or kyes.
------------------------------------------------------------------
 [_m_]   M-Cursors   [_e_]   Evil    [_u_]   常用    [_q_] Quit
"
  ("m" hydra-tip-mcursors/body)
  ("u" hydra-tip-useful/body)
  ("e" hydra-tip-evil/body)
  ("q" nil)
  )

常用按键提示面板

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
(defhydra hydra-tip-useful (:color blue :hint nil)
  "
常用操作提示(C-Control, s-Command, M-option/alt):
------------------------------------------------------------------
  括号操作          文本操作                    搜索/替换
------------------------------------------------------------------
 [C-(] 左括号左移   [s-<] move-text-up      [C-c r] 替换
 [C-)] 右括号右移   [s->] move-text-down    [C-c q] 搜索替换
 [s-)] 左括号右移   [C-+] 放大字体
 [s-(] 右括号左移   [C--] 缩小字体
 [z--] 取消括号     [M-u] 大写化
                    [M-l] 小写化
                    [M-c] 首字母大写
")

SPC 开始按键提示面板

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(defhydra hydra-tip-spc (:hint nil)
  "
SPC 按键列表
------------------------------------------------------------------
  <a~l>
------------------------------------------------------------------

  [SPC b O] kill-other-buffers
  [SPC l m] lsp-ui-imenu
  [SPC l t] treemacs
")

Org-mode 按键提示面板

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
(defhydra hydra-tip-org (:hint nil)
  "
Org-mode 按键提示
------------------------------------------------------------------
  Table 操作        跳转
------------------------------------------------------------------
  [M-l] 列右移      [gj] 上一个同级标题
  [M-h] 列左移      [gk] 下一个同级标题
  [M-j] 行下移      [gh] 父级标题
  [M-k] 行上移
")

evil-mode按键提示面板

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(defhydra hydra-tip-evil (:hint nil)
  "
evil 模式下操作命令提示。
------------------------------------------------------------------
  符号/字母                     <z>
------------------------------------------------------------------
  [+]   数字+1                  [z-] 取消括号 
  [-]   数字-1                  [z.] wrap 标签
  [K]   查文档                  [za] fold 所有 
  [s/S] wrap 字符(选中)         [zo] open 当前
  [s/S] 文件内字符定位          [zj] fold 下一个
  [f/F] 行内字符定位            [zk] fold 上一个
  [t/T] 行内字符定位            [zr] open所有
  [;]   向后重复查找            [zm] close所有
  [,]   向前重复查找            [zt] 当前行定位到顶部
                                [zx] kill 当前buffer
------------------------------------------------------------------
                                <g>
------------------------------------------------------------------
 [_g[_] 函数开头                  [_gd_] 查找定义(definition)       [_g0_] 行首
 [_g]_] 函数结尾                  [_gD_] 查找引用(reference)
 [_gsj_] 按字符往后定位           [_gr_] 执行选中内容
 [_gss_] 按两个字符定位           [_gt_] 切换下一个workspace
 [_gs/_] 按单个字符定位           [_gx_] 交换两个选中区内容
 [_gsk_] 按字符往前定位           [_gf_] 查找光标处名称的文件
 [_gs[[_] 按段首向前定位
 [_gs[]_] 按断尾向前定位
 [_gs]]_] 按段首向后定位
 [_gs][_] 按断尾向后定位
"
  ("g[" beginning-of-defun)
  ("g]" end-of-defun)
  ("g0" evil-beginning-of-visual-line)
  ("gd" xref-find-definitions)
  ("gD" xref-find-references)
  ("gb" xref-pop-marker-stack)
  ("gr" +eval:region)
  ("gjj" dumb-jump-go)
  ("gjb" dumb-jump-back)
  ("gt" +workspace:switch-next)
  ("gx" evil-exchange)
  ("gf" +lookup/file)
  ("gss" evil-avy-goto-char-2)
  ("gs/" evil-avy-goto-char-timer)
  ("gsj" evilem-motion-next-line)
  ("gsk" evilem-motion-previous-line)
  ("gs[[" evilem-motion-backward-section-begin)
  ("gs[]" evilem-motion-backward-section-end)
  ("gs][" evilem-motion-forward-section-end)
  ("gs]]" evilem-motion-forward-section-begin)
  )

multiple cursors(C-S-c, Control-Shift-c)

keyfunctiondescription
C->mc/mark-next-like-this-
C-<mc/mark-previous-like-this-
C-c C-<mc/mark-all-like-this-
C-S-c C-S-cmc/edit-linesS: Shift Key
C-S-c 0mc/insert-numbers-
C-S-c 1mc/insert-letters-
C-S-c smc/mark-all-in-region-
C-S-c Smc/mark-all-in-region-regexp-
C-j-insert newline
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
(defhydra hydra-tip-mcursors (:color blue :hint nil)
  "
Multiple Cursors Mode Tip(C-Control, S-Shift).

 [C-S-c 0] insert numbers   [C->] next 
 [C-S-c 1] insert letters   [C->] previous
 [C-S-c s] region           [C-c C-<] all
 [C-S-c S] region regexp
 [C-S-c C-S-c] edit lines    
")

Launcher 按键面板

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
(defhydra hydra-launcher (:color blue :hint nil :exit t)
    "
all hydra apps or browse urls:
------------------------------------------------------------------
 [_h_]   Man     [_r_]   Reddit     [_w_]   EmacsWiki   [_z_]   Zhihu
 [_s_]   Shell   [_q_]   Cancel
"
  ("h" man)
  ("r" (browse-url "http://www.reddit.com/r/emacs"))
  ("w" (browse-url "http://www.emacswiki.org/"))
  ("z" (browse-url "https://www.zhihu.com/"))
  ("s" shell)
  ("q" nil))

crux tool(C-c)

keyfunctiondescription
C-c ocrux-open-withopen with specific application
C-c ucrux-view-urlopen the url under cursor
C-c Dcrux-delete-file-and-bufferSPC f D -> doom/delete-this-file
C-c Scrux-find-shell-init-file-
中文对齐??

window operations

keyfunctiondescription
SPC w L+evil/window-move-right-
SPC w H+evil/window-move-left
SPC w J+evil/window-move-down
SPC w K+evil/window-move-up

smartparen 括号操作

keyfunctiondescription
z [sp-wrap-squarereplace with S
z (sp-wrap-roundreplace with S
z {sp-wrap-curlyreplace with S
z -sp-splice-sexp-
z .emmet-wrap-with-markup-
C-(sp-backward-slurp-sexp
C-)sp-forward-slurp-sexp
s-(sp-backward-barf-sexp
s-)sp-forward-barf-sexp
C-{sp-backward-sexp
C-}sp-forward-sexp

+workspace

keyfunctiondescription
SPC TAB 0-9-+workspaces switch to(0-9)
SPC TAB .+workspace/switch-
SPC TAB [+workspace/previous-
SPC TAB ]+workspace/next-
SPC TAB `+workspace/last-
SPC TAB d+workspace/deletedelete this workspace
SPC TAB l+workspace/load-
SPC TAB n+workspace/new-
SPC TAB r+workspace/rename-
SPC TAB s+workspace/save-
SPC TAB x+workspace/kill-session-
SPC TAB R+workspace/restore-last-

Spaceamcs

我的 Spacemacs 配置文件,参考配置来源于 子龙山人 的配置方案(进行了部分删减),我的完整配置文档链接🛬🛬🛬

Awesome/有趣/实用

keyfunctiondescription
SPC i sivy-yas插入 snippet 实时显示要插入的内容
C-c i mhelm-imenu函数,变量列表

SPC i s

http://qiniu.ii6g.com/img/20200919230430.png

Key bindings

我的自定义按键:

Key BindingDescription
SPC a m nemms-next
SPC a m pemms-previous
SPC b iibuffer
SPC b Dspacemacs/kill-other-buffers
SPC b m sbookmark-set
SPC b m rbookmark-rename
SPC b m dbookmark-delete
SPC b m jcounsel-bookmark
SPC d ddash-at-point
SPC e nflycheck-next-error
SPC e pflycheck-previous-error
SPC f dprojectile-find-file-dwim-other-window
SPC g gmagit
SPC g Lmagit-log-buffer-file, show git logs
SPC g nsmerge-next
SPC g psmerge-prev
SPC g Mgit-messenger:popup-message, show git log message, with `f' open in browser.
SPC h hzilongshanren/highlight-dwim
SPC h czilongshanren/clearn-highlight, TODO
SPC o ozilongshanren/helm-hotspots
SPC o xorg-open-at-point-global, open link
SPC o rzilongshanren/browser-refresh–chrome-applescript
SPC o sspacemacs/search-engine-select, open search engine list to search
SPC o gmy-git-timemachine, git record
SPC o !zilongshanren/iterm-shell-command, go current dir & run command
SPC o etiny-expand
SPC o iorg-mode insert command
SPC o i torg-set-tags-command, –> :done:
SPC p bcounsel-projectile-switch-to-buffer
SPC p tmy-simple-todo
SPC p fzilongshanren/open-file-with-projectile-or-counsel-git
SPC r livy-resume, resume last search result
SPC s jcounsel-jump-in-buffer
SPC y iyas/insert-snippet
SPC y dyoudao-dictionary-search-at-point+
C-c lzilongshanren/insert-chrome-current-tab-url
C-c torg-capture
C-c rvr/replace
C-c qvr/query-replace
M--zilongshanren/goto-match-paren
M-istring-inflection-java-style-cycle
M-'avy-goto-char-2
s-pfind-file-in-project
, 'ielm, lisp-repl
, g dxref-find-definition
, g bxref-pop-marker-stack
+evil-numbers/inc-at-pt,number +1
-evil-numbers/dec-at-pt, number -1
g [beginning-of-defun
g ]end-of-defun
z [sp-wrap-square
z (sp-wrap-round
z {sp-wrap-curly
z -sp-splice-sexp
z .emmet-wrap-with-markup

smartparens(括号操作)

keyfunction
C-(sp-backward-slurp-sexp
s-(sp-backward-barf-sexp
C-)sp-forward-slurp-sexp
s-)sp-forward-barf-sexp
C-{sp-backward-sexp
C-}sp-forward-sexp

move-text, up/down

keyfunction
s-<move-text-up
s->move-text-down

Modes

emms, play music

1
2
3
4
5
6
7
8
9
  (spacemacs/set-leader-keys "ama" 'emms-add-directory-tree)
  (spacemacs/set-leader-keys "ame" 'emms-smart-browse)
  (spacemacs/set-leader-keys "aml" 'emms-play-playlist)
  (spacemacs/set-leader-keys "amn" 'emms-next)
  (spacemacs/set-leader-keys "amp" 'emms-previous)
  (spacemacs/set-leader-keys "amP" 'emms-pause)
  (spacemacs/set-leader-keys "ams" 'emms-start)
  (spacemacs/set-leader-keys "amS" 'emms-stop)
  (spacemacs/set-leader-keys "amt" 'emms-toggle-repeat-playlist)
keyfunction
SPC a m a'emms-add-directory-tree
SPC a m e'emms-smart-browse
SPC a m l'emms-play-playlist
SPC a m n'emms-next
SPC a m p'emms-previous
SPC a m P'emms-pause
SPC a m s'emms-start
SPC a m S'emms-stop
SPC a m t'emms-toggle-repeat-playlist

DONE ranger

CLOSED: [2020-08-27 Thu 21:14]

  • State "DONE" from [2020-08-27 Thu 21:14]

keyfunction
SPC a ropen ranger
qquit
jmove down
kmove up
linto current directory
hup to parent dir

file manangement:

keyfunction
rrevert buffer
Rrename
Ddelete
yycopy
pppaste
fsearch file names
itoggle showing literal / full-text previews
zhtoggle dot files
osort options
Hsearch through history
z- or z+reduce/increase parents
C-SPCmark a file or directory
vtoggle mark
Vvisually select lines
;Ccopy / move directory
;+create directory
SPC a ddeer
C-jscroll preview window down
C-kscroll preview window up
Senter shell

org-mode

ref: https://practicalli.github.io/spacemacs/org-mode/

keyfunction
, i pset property
text-style

code: , x c

italic: , x i

line-throught: , x s

underline: , x u

verbatim: , x v

bold: , x b

checkbox
  • todo one, C-c C-c change status

  • todo two, done

  • todo three

todos
TODO todo one

SCHEDULED: <2020-08-27 Thu>

WAITING todo two waiting
  • State "WAITING" from "TODO" [2020-08-25 Tue 14:46]

todo scheduler

SCHEDULED: <2020-08-25 Tue>

TODO multiple-cursors

TODO prodigy

blog settings.

Misc Settings

超过 80 列自动换行

1
2
  (add-hook 'org-mode-hook 'turn-on-auto-fill)
  (setq-default fill-column 80)

自动缩进:

(global-aggressive-indent-mode)

Issues

Points

org-mode 简介
  1. Jump to inner link: <<text>> <- [[test][text]]