2016-03-04 66 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文件中添加插件/包。希望這可以幫助。