ctorgalson.vim

Ansible Role Vim

This is an Ansible role designed to install Vim and its plugins on Linux and macOS systems.

This role uses the built-in package manager of Vim 8 (see :help packages). By default, the plugins will be installed in these locations:

  • ~/.vim/pack/ansible-managed/start
  • ~/.vim/pack/ansible-managed/opt

Unlike other Vim plugin managers like Pathogen, Vim's package management does not automatically create helptags. This role will manage the creation of helptags itself, meaning it should be run every time a plugin is added or removed.

If you want to manage your Vim plugins differently, you will need to create helptags using one of these methods:

  • Run :helptags ALL inside Vim.
  • Scripting it (using cron or Git hooks) like this: vim -c 'helptags ~/.vim/pack' -c q.

Requirements

This role has no special requirements, but Vim's package management only works with Vim versions higher than 8.0. Make sure you have a recent version of Vim, or set the vim_installed_packages variable accordingly.

Role Variables

The following variables are available in the role. You can also refer to the Example Playbook (below) and molecule/default/playbook.yml for specific examples.

Variable Name Default Value Description
vim_installed_packages ["vim"] List of packages to install (used by Ansible's Package module).
vim_removed_packages [] List of packages to remove (e.g., on Ubuntu, you might want to remove vim-tiny).
vim_owner "" The user for whom to install Vim and/or plugins.
vim_pack_subdirectory ansible-managed Directory name for plugins installed by this role (default creates e.g. ~/.vim/pack/ansible-managed/start and ~/.vim/pack/ansible-managed/opt).
vim_installed_plugins [] List of plugins to install in ~/.vim/pack/ansible-managed/start. Each plugin should include a repo, a type (set to 'start' or 'opt'), and optionally a version.
vim_removed_plugins [] List of plugins to remove from ~/.vim/pack/ansible-managed/{opt,start}. Each should include a directory and a type.
vim_dotfiles [] List of local Vim-related dotfiles to install in ~/.

Example Playbook

---
# These are all great plugins, even those being removed in this example.
-
  hosts: all
  vars:
    vim_removed_packages:
      - "vim-tiny"
    vim_owner: "molecule"
    vim_installed_plugins:
      - repo: "https://github.com/altercation/vim-colors-solarized.git"
        type: "start"
      - repo: "https://github.com/itchyny/lightline.vim.git"
        type: "start"
      - repo: "https://github.com/scrooloose/nerdcommenter.git"
        type: "start"
      - repo: "https://github.com/skammer/vim-css-color.git"
        type: "start"
      - repo: "https://github.com/vim-vdebug/vdebug.git"
        type: "opt"
      - repo: "https://github.com/godlygeek/tabular.git"
        type: "opt"
    vim_removed_plugins:
      - directory: "nerdcommenter"
        type: "start"
      - directory: "tabular"
        type: "opt"
    vim_dotfiles:
      - "{{ playbook_dir }}/files/dotfiles/.vimrc"
  roles:
    - role: ansible-role-vim

License

GPLv3

Author Information

Christopher Torgalson

Informazioni sul progetto

An Ansible role to install Vim and plugins on Linux and macOS.

Installa
ansible-galaxy install ctorgalson.vim
Licenza
gpl-3.0
Download
2.9k
Proprietario