usage of YASnippet

usage of YASnippet

What is YASnippet do?

YASnippet is a template system of Emacs, which help those lazy guys like me who just want to write less and less but do more and more.

How to access it and install it?

Git follow the guide in git and install it.

Define a template for yourselef

Because when I want to write a blog using jekyll, I always required to write some thing like:

1 ---
2   layout: post
3   title: usage of YASnippet
4   category: leetcode
5   ---
This is really boring and waste of time.

Steps to make own snippet.

  • M-x yas-new-snippet
  • name is just a name, type something easy to understand.
  • key is the "less what you should write"
  • below the "#---" is the "more what you want"
  • in YASnippet "$1","$2" mean the variables
  • When finish editing, C-x C-s and save this in "~/wher your YASnippet/snippet/*/". And "*" is which mode you want to use this template in(html,org,cc,and so on).
  • restart your emacs and it could work now.

Loading Disqus comments...
Table of Contents