SpaceEmacs Rock Day6 学习笔记
Table of Contents
1 SpaceEmacs Day 6
1.1 Bonus Time
- Use org-capture to take notes
(setq org-capture-templates '(("t" "todo" entry (file+headline "~/.emacs.d/gtd.org" "工作安排") "* TODO [#B] %?\n %i\n" :empty-lines 1))) (global-set-key (kbd "C-c r") 'org-capture)
1.2 Batch rename files
- press "C-x C-q in dired mode"
- use expand-region and iedit to batch change files
1.3 Search and replace
1.3.1 install helm-ag
- at first, you should install ag
- search speed: ag > pt > ack > grep
sudo pacman -S install the_silber_searcher
- binding keys and replace all results
;; helm-ag search (global-set-key (kbd "C-c p s") 'helm-do-ag-project-root)
- "C-c C-e" is helm-ag-edit and you can repalce the result by using iedit
1.4 Show javascript errors with flycheck
- flycheck-checkers
- eslint
- install eslint
sudo npm install -g eslint
- use eslint in js2-mode
(add-hook 'js2-mode-hook 'flycheck-mode) (provide 'init-flycheck)
1.5 Code completion
- yasnippet in prog-mode
(yas-reload-all) (add-hook 'js2-mode #'yas-minor-mode)
- auto-yasnippet, use ~ to define a template
(global-set-key (kbd "M-<f2>") #'aya-create) (global-set-key (kbd "M-<f3>") #'aya-expand)
- self define snippet of cnblogs
#+TITLE: $1 #+CATEGORIES: ${2:Emacs} #+DESCRIPTION: ${3:} #+KEYWORDS: $4 #+DATE: `(format-time-string "%Y-%m-%d %H:%M")`