Merge nvim and vim tasks
This commit is contained in:
parent
c59a67f6fb
commit
13f0e2a68e
11 changed files with 100 additions and 120 deletions
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
dependencies:
|
||||
- role: check-sudo
|
||||
- role: vim
|
||||
|
|
|
@ -3,8 +3,19 @@
|
|||
become: true
|
||||
pacman:
|
||||
name:
|
||||
- vim
|
||||
- python-pynvim
|
||||
- neovim
|
||||
- python-pylint
|
||||
- python-black
|
||||
- ansible-lint
|
||||
- base-devel
|
||||
- flake8
|
||||
- mypy
|
||||
- shellcheck
|
||||
- cmake
|
||||
- clang
|
||||
- npm
|
||||
when:
|
||||
ansible_facts['distribution'] == 'Archlinux'
|
||||
|
||||
|
@ -12,11 +23,29 @@
|
|||
become: true
|
||||
apt:
|
||||
name:
|
||||
- vim
|
||||
- python3-pynvim
|
||||
- neovim
|
||||
- build-essential
|
||||
- python3-dev
|
||||
- pylint3
|
||||
- ansible-lint
|
||||
- flake8
|
||||
- mypy
|
||||
- shellcheck
|
||||
- cmake
|
||||
- clang
|
||||
- npm
|
||||
when:
|
||||
ansible_facts['distribution'] == 'Debian'
|
||||
|
||||
# some Arch derivatives don't have the shellcheck package (arch32, archarm)
|
||||
- name: Run shellcheck script
|
||||
script: scripts/shellcheck_binary_fix.sh
|
||||
register: shellcheck_script
|
||||
when: ansible_facts['distribution'] == 'Archlinux'
|
||||
changed_when: "'there is nothing to do' not in shellcheck_script.stdout"
|
||||
|
||||
- name: Install neovim with pip for Debian
|
||||
pip:
|
||||
name: neovim
|
||||
|
@ -34,7 +63,74 @@
|
|||
path: ~/.config/nvim
|
||||
state: directory
|
||||
|
||||
- name: Copy neovim config
|
||||
copy:
|
||||
src: init.vim
|
||||
dest: ~/.config/nvim/init.vim
|
||||
- name: Check if colors is a symlink
|
||||
stat:
|
||||
path: ~/.vim/colors
|
||||
follow: false
|
||||
register: colors_dir
|
||||
|
||||
- name: Remove colors symlink
|
||||
file:
|
||||
path: ~/.vim/colors
|
||||
state: absent
|
||||
when: colors_dir.stat.exists and colors_dir.stat.islnk
|
||||
|
||||
- name: Copy configs
|
||||
copy: src={{ item.src }} dest={{ item.dest }}
|
||||
with_items:
|
||||
- {src: 'init.vim', dest: '~/.config/nvim/init.vim'}
|
||||
- {src: 'flake8', dest: '~/.flake8'}
|
||||
- {src: 'pylintrc', dest: '~/.pylintrc'}
|
||||
- {src: 'vimrc', dest: '~/.vimrc'}
|
||||
- {src: 'colors', dest: '~/.vim/'}
|
||||
|
||||
- name: Check if vim-plug is installed
|
||||
stat:
|
||||
path: ~/.vim/autoload/plug.vim
|
||||
register: vimplug
|
||||
|
||||
- name: Install vim-plug
|
||||
command: curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
when: not vimplug.stat.exists
|
||||
|
||||
- name: Upgrade vim-plug
|
||||
command:
|
||||
cmd: vim +PlugUpgrade +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'vim-plug is already up-to-date' not in result.stdout"
|
||||
|
||||
- name: Install plugins
|
||||
command:
|
||||
cmd: vim +PlugInstall +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'Resolving deltas' in result.stdout"
|
||||
|
||||
- name: Update plugins
|
||||
command:
|
||||
cmd: vim +PlugUpdate +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'files changed' in result.stdout"
|
||||
|
||||
- name: Update Coc plugins
|
||||
command:
|
||||
cmd: vim +CocUpdate +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'Updated' in result.stdout"
|
||||
|
||||
- name: Upgrade Black
|
||||
command:
|
||||
cmd: vim +BlackUpgrade +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
# TODO: changed_when
|
||||
|
||||
- name: Install hdl-checker
|
||||
pip:
|
||||
name: hdl-checker
|
||||
extra_args: --user
|
||||
register: result
|
||||
changed_when: "'Running setup.py install for hdl-checker' in result.stdout"
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
---
|
||||
dependencies:
|
||||
- role: check-sudo
|
|
@ -1,112 +0,0 @@
|
|||
---
|
||||
- name: Install packages (Archlinux)
|
||||
become: true
|
||||
pacman:
|
||||
name:
|
||||
- gvim
|
||||
- ansible-lint
|
||||
- python-pylint
|
||||
- python-black
|
||||
- base-devel
|
||||
- flake8
|
||||
- mypy
|
||||
- shellcheck
|
||||
- cmake
|
||||
- clang
|
||||
- npm # for coc
|
||||
when: ansible_facts['distribution'] == 'Archlinux'
|
||||
|
||||
- name: Install packages (Debian)
|
||||
become: true
|
||||
apt:
|
||||
name:
|
||||
- vim-gtk
|
||||
- pylint3
|
||||
- build-essential
|
||||
- ansible-lint
|
||||
- python3-dev
|
||||
- flake8
|
||||
- mypy
|
||||
- shellcheck
|
||||
- cmake
|
||||
- clang
|
||||
- npm # for coc
|
||||
when: ansible_facts['distribution'] == 'Debian'
|
||||
|
||||
# some Arch derivatives don't have the package (arch32, archarm)
|
||||
- name: Run shellcheck script
|
||||
script: scripts/shellcheck_binary_fix.sh
|
||||
register: shellcheck_script
|
||||
when: ansible_facts['distribution'] == 'Archlinux'
|
||||
changed_when: "'there is nothing to do' not in shellcheck_script.stdout"
|
||||
|
||||
- name: Check if colors is a symlink
|
||||
stat:
|
||||
path: ~/.vim/colors
|
||||
follow: false
|
||||
register: colors_dir
|
||||
|
||||
- name: Remove colors symlink
|
||||
file:
|
||||
path: ~/.vim/colors
|
||||
state: absent
|
||||
when: colors_dir.stat.exists and colors_dir.stat.islnk
|
||||
|
||||
- name: Copy configs
|
||||
copy: src={{ item.src }} dest={{ item.dest }}
|
||||
with_items:
|
||||
- {src: 'flake8', dest: '~/.flake8'}
|
||||
- {src: 'pylintrc', dest: '~/.pylintrc'}
|
||||
- {src: 'vimrc', dest: '~/.vimrc'}
|
||||
- {src: 'colors', dest: '~/.vim/'}
|
||||
|
||||
- name: Check if vim-plug is installed
|
||||
stat:
|
||||
path: ~/.vim/autoload/plug.vim
|
||||
register: vimplug
|
||||
|
||||
- name: Install vim-plug
|
||||
command: curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
when: not vimplug.stat.exists
|
||||
|
||||
- name: Upgrade vim-plug
|
||||
command:
|
||||
cmd: vim +PlugUpgrade +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'vim-plug is already up-to-date' not in result.stdout"
|
||||
|
||||
- name: Install plugins
|
||||
command:
|
||||
cmd: vim +PlugInstall +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'Resolving deltas' in result.stdout"
|
||||
|
||||
- name: Update plugins
|
||||
command:
|
||||
cmd: vim +PlugUpdate +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'files changed' in result.stdout"
|
||||
|
||||
- name: Update Coc plugins
|
||||
command:
|
||||
cmd: vim +CocUpdate +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
changed_when: "'Updated' in result.stdout"
|
||||
|
||||
- name: Upgrade Black
|
||||
command:
|
||||
cmd: vim +BlackUpgrade +qall
|
||||
stdin: '\n' # On error needs user input to continue
|
||||
register: result
|
||||
# TODO: changed_when
|
||||
|
||||
- name: Install hdl-checker
|
||||
pip:
|
||||
name: hdl-checker
|
||||
extra_args: --user
|
||||
register: result
|
||||
changed_when: "'Running setup.py install for hdl-checker' in result.stdout"
|
Loading…
Add table
Reference in a new issue