Install Neo Snippet to improve your coding speed.

Neo snippet
This article explains neosnippet plugin to improve your coding speed.I used to Coda2 in Japan. When I came to Canada, I was charged editor Vim. Because Vim is a most powerful editor, I wanna challenge heighley editor. And I thought to improve my develop speed.
As a result, my improved my develop speed. As well I completely understand UNIX knowledge. Vim is a good editor.
By the way, this introduction has become quite long, I’ll explain Neo-snippet.

How to install neo-snippet

Neosnippet
Also, assume that dein has been installed as a prerequisite.

First one, prepare .vimrc. Please add neosnippet plugin.

call dein#begin(expand('~/.vim/dein'))
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/neocomplete.vim')
call dein#add('Shougo/neocomplcache')
call dein#add('Shougo/neosnippet')
call dein#add('Shougo/neosnippet-snippets')
#...
call dein#end()

Then, Please define keymap and snippet folder.
In this case, I defined Ctrl + k, when you use Ctrl + k you can use snippet code, as well you define folder path to snippet store.
~/.vim/snippet is snippet folder.

"NeoSunippet
"-----------------------------------------------------
"Plugin key-mappings
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
let g:neosnippet#enable_snipmate_compatibility = 1
let g:neosnippet#snippets_directory='~/.vim/snippet/'

Please, update dein.

:call dein#update()

You can use neosnippet
If you wanna edit snippet on vim, use this command.

:NeoSnippetEdit

or direct edit ~/vim/snippet/ file. When you add snippet code, Please describe it with __ indent__ from the bellow line defined by snippet.
And you can define arias, description.

name meaning
snippet snippet’s name
abbr snippet’s description
alias snippet’s another name
options snippet’s option

For example

snippet react
abbr React class
alias rc
    import React, { Component } from 'react';
    class App extends Component{
        constructor(props) {
            super(props);
        }
        render(){
            return(
            );
        }
    }

of snippet becomes a keyword, and when entering the keyword in insert mode, the snippet will be displayed as completion candidate.
It selects from the completion candidate and performs expansion with Ctrl + k that was set earlier.

multiple snippet files

Sometimes, I wanna separate snippet file, because snippet file has taken the long code. So I’ll explain how to separate file.
First one, please make extensions directory in snippet directory.
You change the code, like this.

include extensions/*

And create .snip files in extensions. So neosnippet reads each file in extensions.

[amazonjs asin=”B005EI85BE” locale=”JP” title=”Learning the vi and Vim Editors: Text Processing at Maximum Speed and Power (English Edition)”]

関連記事