VimScript Language Server

2.3.1 · active · verified Sun Apr 19

The `vim-language-server` package provides Language Server Protocol (LSP) features specifically for VimScript, enhancing the development experience within Vim and Neovim environments. It offers core LSP functionalities such as auto-completion, function signature help, hover documentation, go-to-definition, find references, document symbols, and diagnostics. The current stable version is 2.3.1, with releases occurring periodically to introduce new features or improve parsing capabilities, as seen by the recent v2.3.0 update that included an `vimlparser` update. Its key differentiators include its dedicated support for VimScript, robust integration with popular Vim LSP clients like `coc.nvim` and `vim-easycomplete`, and configurable indexing options for performance tuning. This server is designed to be run as a standalone process or managed by an LSP client, rather than being imported as a programmatic library in JavaScript or TypeScript applications.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates global installation via npm and a comprehensive `coc.nvim` configuration example for the VimScript Language Server, showing both Node.js IPC and stdio setup options.

{
  // First, install the language server globally:
  // npm install -g vim-language-server

  // To use with coc.nvim, add the following to your coc-settings.json:
  // This configuration tells coc.nvim how to launch and interact with the server.
  "languageserver": {
    "vimls": {
      // Option 1: Using Node.js IPC (Inter-Process Communication) for potentially faster communication.
      // Ensure the path to index.js is correct for your installation. 
      // You can find it by running `npm root -g` and then looking inside `vim-language-server/bin/index.js`.
      "module": "/usr/local/lib/node_modules/vim-language-server/bin/index.js", // Example path, adjust as needed
      "args": ["--node-ipc"],

      // Option 2 (alternative to "module"): Using standard I/O for communication.
      // This assumes `vim-language-server` is in your system's PATH.
      // "command": "vim-language-server",
      // "args": ["--stdio"],

      "initializationOptions": {
        "isNeovim": true, // Set to true if you are using Neovim, false for Vim8+
        "iskeyword": "@,48-57,_,192-255,-#", // Customize Vim's `iskeyword` option
        "vimruntime": "$VIMRUNTIME",         // Path to your $VIMRUNTIME directory
        "runtimepath": "~/.config/nvim,~/.vim", // Comma-separated list of runtime paths
        "diagnostic": { "enable": true }, // Enable diagnostics
        "indexes": {
          "runtimepath": true, // Index vim files from runtimepath for suggestions
          "gap": 50,           // Indexing time gap in ms
          "count": 5           // Number of files to index concurrently
        },
        "suggest": {
          "fromVimruntime": true,
          "fromRuntimepath": true
        }
      },
      "filetypes": [ "vim" ] // Specify file types this server should handle
    }
  }
}

view raw JSON →