
- name: Ensure .vim folder
  file:
      path: ~/.vim
      state: directory
  become: False

- name: Ensure .vim plugin folder
  file:
      path: "~/.vim/pack/bundle/start/"
      state: directory
  become: False

- name: Remove old configuration
  file:
    path: "~/.vim/{{ item }}"
    state: absent
  with_items:
    - "plugged"
    - "README.md"
    - ".gitignore"
    - ".git"
    - "script"
    - "autoload"
  become: False

- name: Copy config files
  file:
      src: "{{ item }}"
      dest: "~/.vim/{{ item | basename }}"
      state: link
      force: True
  with_fileglob: "{{ role_path }}/files/*"
  become: False

- name: Install/update plugins
  git: 
      repo: 'https://github.com/{{ item  }}'
      dest: '~/.vim/pack/bundle/start/{{ item | basename }}'
      update: True
  with_items: "{{ plugins }}"
  become: False

- name: Intall fzf repo
  git:
    repo: 'https://github.com/junegunn/fzf.git'
    dest: '~/.fzf'
    update: True
  register: fzf_result

- name: Install fzf 
  command: "~/.fzf/install --all"
  become: False
  when: fzf_result.changed



- name: Ensure .vim folder
  file:
      path: ~/.vim
      state: directory
  become: False

- name: Ensure .vim plugin folder
  file:
      path: "~/.vim/pack/bundle/start/"
      state: directory
  become: False

- name: Remove old configuration
  file:
    path: "~/.vim/{{ item }}"
    state: absent
  with_items:
    - "plugged"
    - "README.md"
    - ".gitignore"
    - ".git"
    - "script"
    - "autoload"
  become: False

- name: Copy config files
  file:
      src: "{{ item }}"
      dest: "~/.vim/{{ item | basename }}"
      state: link
      force: True
  with_fileglob: "{{ role_path }}/files/*"
  become: False

- name: Install/update plugins
  git: 
      repo: 'https://github.com/{{ item  }}'
      dest: '~/.vim/pack/bundle/start/{{ item | basename }}'
      update: True
  with_items: "{{ plugins }}"
  become: False
  ignore_errors: True

- name: Intall fzf repo
  git:
    repo: 'https://github.com/junegunn/fzf.git'
    dest: '~/.fzf'
    update: True
  register: fzf_result

- name: Install fzf 
  command: "~/.fzf/install --all"
  become: False
  when: fzf_result.changed


Add vim plugins error support
Add vim plugins error support
