1.7 KiB
vim-nodejs-complete
Nodejs 'omnifunc' function of vim
Support node build-in module's method 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.
For integration with jscomplete, set let g:node_usejscomplete = 1. Note: you must install jscomplete manually.
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-o
Tip
-
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