just ram

stuff I should remember

Vim to Emas - YASnippet

This post is part of a series:

  1. Vim to Emacs
  2. Vim to Emacs - Ace Jump Mode
  3. Vim to Emacs - YASnippets
  4. Vim to Emacs - Smart Tab

Another plugin I miss from Vim is snipMate, I use this plugin to insert snippets of code while programming. Once again Emacs has me covered, YASnippet offers the same functionality.

Setup

Create a yasnippet.el in the .emacs.d/personal folder.

personal/yasnippet.el

1
2
3
4
(prelude-require-package 'yasnippet)

(require 'yasnippet)
(yas-global-mode 1)

Here I make sure the yasnippet package is available then require the package and enable it globally.

Personal Snippets

You can create your own personal snippets in the .emas.d/snippets folder. More details in this slightly outdated guide.

Ruby Snippets

I have also installed a set of ruby and rspecs snippets from bmaland’s repo. I simply cloned the repo into the personal snippest folder with name ruby-mode. Note the name is important it needs to match the Emacs mode where the snippets are used.

1
git clone git@github.com:bmaland/yasnippet-ruby-mode.git ~/.emacs.d/personal/ruby-mode

Comments