简介

spacemacs也可以像vim一样配置快捷代码块,提高输入的效率。当前比较好用的插件是yasnippet。

安装yasnippet插件

  • 修改.spacemacs配置文件
dotspacemacs-additional-packages
'(
  ;; 快捷代码块插件
  yasnippet
  ;; 常用代码块
  yasnippet-snippets
  )
  • 启用插件,~/.emacs.d/init.el
;; 全局启用yas-snippet代码块插件
(yas-global-mode 1) ;; or M-x yas-reload-all if you've started YASnippet already.

配置自定义代码块

;; =============== 快捷代码块 ==============
;; 配置默认个人代码块存储目录~/.emacs.d/private/snippets
(setq yas-snippet-dirs
      '("~/note/emacs-snippets"                 ;; personal snippets
        ))


## 自定义插入日期代码块
  • ~/note/emacs-snippets下,新建目录 markdown-mode
❯ cat date
# -*- mode: snippet -*-
# name: 当前日期
# contributor: jiftle <lixugood@126.com>
# key: date
# --
`(format-time-string "%Y-%m-%d")`$0

相关文章:

  • 2021-05-06
  • 2021-04-03
  • 2021-09-24
  • 2021-09-07
  • 2021-07-06
  • 2021-12-17
  • 2021-12-15
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2021-11-22
  • 2022-12-23
  • 2021-12-07
  • 2021-04-30
  • 2021-11-12
  • 2021-10-14
相关资源
相似解决方案