Nodejs 'omnifunc' function of vim
Support node's builtin module's method&property completion(ctrl-x ctrl-o) in js file with preview.
Download the tarball and extract to your vimfiles(~/.vim or ~/vimfiles) folder.
Completion require :filetype plugin on, please make sure it's on.
All the settings is optional.
letg:nodejs_complete_config={\ 'js_compl_fn': 'jscomplete#CompleteJS', \ 'max_node_compl_len': 15\}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.
Number, length of nodejs complete items. set to 0 if unlimited
varfs=req// then hit ctrl-x_ctrl-o you'll get:varfs=require(// and then hit ctrl-x_ctrl-o again you'll get module name completionvarfs=require('f // then hit ctrl-x_ctrl-ofs.// then hit ctrl-x_ctrl-oproc// then hit ctrl-x_ctrl-oprocess.ex// then hit ctrl-x_ctrl-oClose 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 windowauCursorMovedI,InsertLeave*ifpumvisible() ==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.:unletb:npm_module_names