Logo image
TOOTIPS

|Short tips, great ideas

How To Enable Multiple Snippets In Vim [How To]

0 comments
Vim Text Editor


Recently, I have started using Vim as my sole text editor and I'm liking it so far. I have tried a bunch of text editors and none of them impressed me until I got my hands on Vim.

In the past few weeks, I have been learning, among other things, jQuery which is a Javascript library that focuses on code efficiency, and in the process of improving my .vimrc, I came across SnipMate which is a very useful Vim plugin that allows you to insert predefined snippets into your code using the Tab key.

SnipMate allows you to associate multiple snippets with one particular filetype. For example, say you want to associate html files with both Javascript and jQuery snippets. To accomplish this, you need to add the following lines to your .vimrc file:


let g:snipMate = {}
let g:snipMate.scope_aliases = {} 
let g:snipMate.scope_aliases['html'] = 'javascript,javascript-jquery'

If you want to see my Vim configuration, visit my Github repository @MyGithub.


0 comments:

Post a Comment