nodejs 'omnifunc' function of vim
VimL JavaScript
Latest commit 1e2f98f Feb 22, 2013 @myhere update readme
Failed to load latest commit information.
after turn off debug Feb 22, 2013
.gitignore update ignore file Aug 8, 2012 update readme Feb 22, 2013


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.

let g:nodejs_complete_config = {
\  'js_compl_fn': 'jscomplete#CompleteJS',
\  'max_node_compl_len': 15


  • String function 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


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

// then hit ctrl-x_ctrl-o

// then hit ctrl-x_ctrl-o

// then hit ctrl-x_ctrl-o


  1. Close the method preview window

    ctrl-w_ctrl-z or :pc.

    If you want close it automatically, put the code(from spf13-vim) below in your .vimrc file.

     " automatically open and close the popup menu / preview window
     au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
  2. About vim's complete

    Vim supports several kinds of completion, :h ins-completion for help.

  3. Completion of module in node_modules will cache result of every js file

    If you modified module in node_modules directory, use code below to clear the cache.

     :unlet b:npm_module_names


feedback or advice or feature-request