summaryrefslogtreecommitdiffstats
path: root/roles/vim/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-11-09 01:43:24 +0100
committerAhmed Abdelhalim <[email protected]>2025-11-09 01:47:01 +0100
commitde990dbbb6d0b852b73046e1f8c8875ae0849403 (patch)
tree9396a5471430a6288a27342b2e92bc0e79a4bc12 /roles/vim/tasks
parentaa8d8855e0a153245f2ad0832ebeea80af57cbfb (diff)
Add vim role w/testing
Diffstat (limited to 'roles/vim/tasks')
-rw-r--r--roles/vim/tasks/main.yml32
1 files changed, 32 insertions, 0 deletions
diff --git a/roles/vim/tasks/main.yml b/roles/vim/tasks/main.yml
new file mode 100644
index 00000000..a0859f5c
--- /dev/null
+++ b/roles/vim/tasks/main.yml
@@ -0,0 +1,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