Ⅰ. 插件描述
nodejs 'omnifunc' function of vimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'myhere/vim-nodejs-complete'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'myhere/vim-nodejs-complete'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'myhere/vim-nodejs-complete'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/myhere/vim-nodejs-complete
Ⅳ. 文档说明
vim-nodejs-complete
Nodejs 'omnifunc' function of vim
Support node's builtin module's method&property completion(ctrl-x ctrl-o) in js file with preview.
Install
Download the tarball and extract to your vimfiles(~/.vim or ~/vimfiles) folder.
Completion require :filetype plugin on, please make sure it's on.
Settings
All the settings is optional.
let g:nodejs_complete_config = {
\ 'js_compl_fn': 'jscomplete#CompleteJS',
\ 'max_node_compl_len': 15
\}js_compl_fn
Stringfunction name, called to complete javascript- default to
javascriptcomplete#CompleteJS - if you want to integrate with jscomplete, set it to
jscomplete#CompleteJS, make sure it's installed.
max_node_compl_len
Number, length of nodejs complete items. set to 0 if unlimited
Example
var fs = req
// then hit ctrl-x_ctrl-o you'll get:
var fs = require(
// and then hit ctrl-x_ctrl-o again you'll get module name completion
var fs = require('f
// then hit ctrl-x_ctrl-o
fs.
// then hit ctrl-x_ctrl-o
proc
// then hit ctrl-x_ctrl-o
process.ex
// then hit ctrl-x_ctrl-oTip
Close the method preview window
ctrl-w_ctrl-zor:pc.If you want close it automatically, put the code(from spf13-vim) below in your
.vimrcfile." automatically open and close the popup menu / preview window au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif- About vim's complete
Vim supports several kinds of completion,
:h ins-completionfor help. Completion of module in
node_moduleswill cache result of everyjsfileIf you modified module in
node_modulesdirectory, use code below to clear the cache.:unlet b:npm_module_names