2016-03-04 70 views
0

我想了解如何启用vim-snippets中的ES6代码段。在vim-snippets中启用ES6

如果写function,然后按Tab键两次,它会产生这对我来说:

image

这是完美的。

但如果我写af,然后按Tab键它并没有产生箭头功能。

不知怎的,我必须包括es6文件,但我不知道如何...

我怎样才能做到这一点?

+0

你正在使用什么片段程序? UltiSnips或snipmate? –

回答

1

使用autocmd加载javascript-es6片段:

autocmd FileType js UltiSnipsAddFiletypes javascript-es6 

从技术文档:

     *FileType* 
FileType  When the 'filetype' option has been set. The 
       pattern is matched against the filetype. 
       <afile> can be used for the name of the file 
       where this option was set, and <amatch> for 
       the new value of 'filetype'. 
       See |filetypes|. 

参考Installation部分获取更多信息如何安装该模块。

0

我不会为你的查询写一个长答案,我会告诉你这个post:,它在解释如何为vim设置片段方面做得更好。你的插件和Vundle添加你的插件安装后的vim,可以很容易地找到了反应,ES6等片段......

`cd ~/.vim/bundle` and then just `git clone ./path/to/repo` or use `Vundle` 

,并通过你的〜/ .vimrc文件中添加插件/包。希望这可以帮助。