gikeymarcia.neovim

Neovim

This guide helps you install the latest neovim and tree-sitter from GitHub on Debian-based x86_64 systems.

Optional Features

  • Install the nightly version of neovim as nnvim
  • Sync your local nvim settings with remote machines
  • Install necessary apt packages
  • Install necessary pip packages (using pipx)
  • Install necessary npm packages

Requirements

None.

Role Variables

Default Setup

By default, this setup will install neovim and tree-sitter from GitHub. You can turn any of these features off or change the version of each application using the following variables:

neovim: true
neovim_version: "0.10.1"

treesitter: true
treesitter_version: "0.22.6"

Nightly Neovim Version

If you want the latest nightly appimage release of neovim, set neovim_nightly: true (default: false).

neovim_nightly: true

Neovim Personal Development Environment (PDE)

Many vim users customize their tools over time, and this can be challenging when working across multiple machines. The neovim_pde option helps you keep your development environment settings in one place and easily transfer them to different machines.

Default Values:

neovim_pde: false

# packages
neovim_apt_packages: []
neovim_pip_packages: []
neovim_npm_packages: []

# configuration
neovim_external_config: []
neovim_config_dirs: []
neovim_config_syncs: []
  • neovim_pde enables or disables this syncing mode. When it's false (default), none of the additional PDE features will work, meaning no packages or syncs will occur.

Packages

Currently, three packaging systems are supported:

  • neovim_apt_packages
  • neovim_pip_packages
  • neovim_npm_packages

Each of these variables should list the packages you want to install. If you choose any packages, the respective package manager will also be installed. Your variables file might look like this:

neovim_pde: true
neovim_npm_packages:
  - neovim
neovim_pip_packages:
  - pynvim
  - flake8

In this example, the 'npm' and 'pip' package managers will also be installed in their latest versions. You can find more details in the default vars under "digging deeper."

Configuration

To sync configuration files, you need to specify a primary_user. The neovim_config_syncs list defines which files and folders from your local ~/.config/nvim/ will be copied to the remote machine.

Tip: Ensure folders to sync end with a /.

neovim_pde: true

primary_user: prime

neovim_config_syncs:
  - init.vim
  - coc-settings.json
  - autoload/
  - ftplugin/
  - lua/
  - plug-config/
  - snips/
  - spell/
  - syntax/
neovim_config_dirs:
  - "/home/{{ primary_user }}/.config/nvim"

To ensure a folder exists on the remote $HOME, add it to the neovim_config_dirs list starting from /home/{{ primary_user }}. For instance, ensure the nvim config folder is at /home/{{ primary_user }}/.config/nvim.

If you need to copy files outside ~/.config/nvim, use the neovim_external_config variable, which should be a list of src: and dest: key-value pairs.

  • src is the path to the local file.
  • dest is the path on the remote machine where the src file should go, typically starting with /home/{{ primary_user }}.
neovim_external_config:
  - src: ~/.config/flake8
    dest: "/home/{{ primary_user }}/.config/flake8"
  - src: ~/.config/shellcheckrc
    dest: "/home/{{ primary_user }}/.config/shellcheckrc"

In this example, the local flake8 and shellcheck configuration files are copied to remote machines.

Dependencies

None.

Example Playbook

Here’s how to combine all of the above settings into one playbook.

---
- hosts: all
  become: true

  roles:
    - gikeymarcia.neovim
  vars:
    neovim_nightly: true
    primary_user: mikey
    neovim_pde: true
    neovim_npm_packages:
      - neovim
    neovim_pip_packages:
      - pynvim
      - flake8
    neovim_config_syncs:
      - init.vim
      - coc-settings.json
      - autoload/
      - ftplugin/
      - lua/
      - plug-config/
      - snips/
      - spell/
      - syntax/
    neovim_config_dirs:
      - "/home/{{ primary_user }}/.config/nvim"
    neovim_external_config:
      - src: ~/.config/flake8
        dest: "/home/{{ primary_user }}/.config/flake8"
      - src: ~/.config/shellcheckrc
        dest: "/home/{{ primary_user }}/.config/shellcheckrc"
...

License

GPLv3

Author Information

You can find me on GitHub: gikeymarcia

Informazioni sul progetto

Deploy the latest Neovim and sync your configs.

Installa
ansible-galaxy install gikeymarcia.neovim
Licenza
lgpl-3.0
Download
508
Proprietario
Code enthusiast and FOSS commoner. I love writing software that makes people's lives easier.