---
- name: Install packages (Archlinux)
  become: true
  pacman:
    name:
      - python-pynvim
      - neovim
  when:
    ansible_distribution == 'Archlinux'

- name: Install packages (Debian)
  become: true
  apt:
    name:
      - python3-pynvim
      - neovim
  when:
    ansible_distribution == 'Debian'

- name: Install neovim with pip for Debian
  pip:
    name: neovim
    extra_args: --user
  when:
    ansible_distribution == 'Debian'

- name: Install neovim-remote
  pip:
    name: neovim-remote
    extra_args: --user

- name: Make sure ~/.config/nvim/ directory exists
  file:
    path: ~/.config/nvim
    state: directory

- name: Copy neovim config
  copy:
    src: init.vim
    dest: ~/.config/nvim/init.vim