summaryrefslogtreecommitdiffstats
path: root/roles/vim/tasks/main.yml
blob: a0859f5c48420c620701e9264fd641e58c691829 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
- name: "Ensure vim is installed"
  become: true
  ansible.builtin.package:
    name: "vim"
    state: "present"

- name: "Clone vimrc git repo"
  ansible.builtin.git:
    repo: "{{ vimrc_repo_url }}"
    dest: "{{ ansible_env.HOME }}/.vim"
    clone: true
    update: false
    single_branch: true
    version: main

- name: "Ensure .vimrc is linked"
  ansible.builtin.file:
    src: "{{ ansible_env.HOME }}/.vim/.vimrc"
    dest: "{{ ansible_env.HOME }}/.vimrc"
    state: "link"

# NOTE: based on https://stackoverflow.com/a/33734425/1769515
- name: "Setup vim plugins"
  ansible.builtin.command:
    cmd: vim -E -s -u ~/.vimrc +PlugInstall +qall
    creates: "{{ ansible_env.HOME }}/.vim/bundle/"
  environment:
    TERM: dumb
  # We don't care much if vim failed to install all plugins
  # this can be manually fixed later when needed
  failed_when: false