/neovim-cmd

Send commands to neovim from :terminal

Primary LanguageRustMIT LicenseMIT

neovim-cmd

Send commands to neovim from :terminal.

This project is a way for me to learn rust and experiment with the neovim API. It is in early development stage and not ready for production.

It is heavily inspired by neovim-remote which has more features, and probably less bugs.

Usage

USAGE:
    neovim-cmd [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    cd
    edit
    help      Prints this message or the help of the given subcommand(s)
    rename

Features

  • Use it as your commit message editor:

    git config core.editor '~/bin/neovim-cmd edit --wait'
  • Use it to synchronize $PWD with :tchdir:

    function cd() {
        builtin cd "$@";
        # do a vim :tcd if we managed to cd and we are withing neovim
        if [[ -n ${NVIM_LISTEN_ADDRESS} ]]; then
            ~/bin/neovim-cmd cd "$@"
        fi
    }
    export cd

    Inspired from Yazgoo's blog post

Installation

  1. Install neovim 0.3.x. This is not compatible with neovim 0.3.x. See neovim instructions for details.

  2. Install the rust toolchain with rustup.rs

    curl https://sh.rustup.rs -sSf | sh
  3. Clone the source code:

    git clone https://github.com/Makohoek/neovim-cmd neovim-cmd
    cd neovim-cd
  4. Make sure you have the latest stable version of cargo and friends:

    rustup override set stable
    rustup update stable
  5. Build for release:

    cargo build --release
  6. Copy the binary to a folder in your $PATH:

    cp target/release/neovim-cmd ~/bin

References