denops.vim

repository·main·Indexed 21 days ago

https://github.com/vim-denops/denops.vim

An ecosystem for Vim and Neovim that enables developers to write plugins using TypeScript or JavaScript powered by the Deno runtime.

Tokens
724
Snippets
3
Records
5
Agent score
24%

What's inside denops.vim

  1. Install Denops

    main

    Denops allows you to write Vim/Neovim plugins in TypeScript/JavaScript using Deno. To install it, follow these steps:

    1. Install Deno: Ensure Deno is installed on your system. It must be executable from your terminal.
    2. Configure Deno Path (Optional): If deno is not in your system PATH, specify its absolute path using the g:denops#deno variable in your .vimrc or init.vim.
    3. Install the plugin: Use your preferred plugin manager to install vim-denops/denops.vim.
    " Optional: Specify absolute path to Deno
    let g:denops#deno = '/usr/local/bin/deno'
    
    " Using vim-plug
    Plug 'vim-denops/denops.vim'
  2. Use a Shared Server to improve startup performance

    main

    Denops plugins may experience slow startup times because a new Deno process must be started for each plugin. To mitigate this, you can use a Shared server to avoid startup overhead.

    1. Add the following configuration to your .vimrc: let g:denops_server_addr = '127.0.0.1:32123'
    2. Install the vim-denops/denops-shared-server.vim plugin.
    3. Execute the installation command: :call denops_shared_server#install().
    4. Restart Vim.

    Method 2: Manual Launch

    You can also launch the shared server manually using the Denops CLI script: deno run -A --no-lock {path/to/denops.vim}/denops/@denops-private/cli.ts --hostname=127.0.0.1 --port=32123

    " In .vimrc
    let g:denops_server_addr = '127.0.0.1:32123'
    
    " After installing denops-shared-server.vim
    :call denops_shared_server#install()
  3. Verify Denops installation

    main

    To confirm that Denops is correctly configured, you can use the denops-helloworld.vim plugin as a test:

    1. Install vim-denops/denops-helloworld.vim via your plugin manager.
    2. Run the command :DenopsHello.
    3. If it outputs Hello, Denops is working correctly.
    4. You can then remove the helloworld plugin.
    Plug 'vim-denops/denops-helloworld.vim'
  4. Optimize Denops performance on Windows

    main

    On Windows, Denops plugins might remain slow even with a shared server. This is often caused by antivirus software (like Windows Defender) scanning Deno's cache directory (%LOCALAPPDATA%\deno) every time Deno starts.

    To fix this, add the Deno cache directory to your antivirus exclusion list.

  5. Denops Support Policy

    main

    Denops follows a specific support policy for major version updates:

    • Vim: Supports the latest version provided by Homebrew (macOS) and vim-win32-installer (Windows). Linux users can use any version they build.
    • Neovim & Deno: Support extends to the two most recent minor versions. Since Neovim is in the 0.x range, support covers the latest available 0.x.y versions.