From feb2c05a1db659c3e7355d2bdede75c5425e799d Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Mon, 21 Feb 2022 13:49:21 +0100 Subject: [PATCH] toansible: Add vim installation --- configs.yml | 54 ------------ .../vim/files}/colors/apprentice.vim | 0 .../vim/files}/colors/monokai.vim | 0 .../vim/files}/colors/wombat256.vim | 0 {dotfiles => roles/vim/files}/flake8 | 0 {dotfiles => roles/vim/files}/pylintrc | 0 {dotfiles/vim => roles/vim/files}/vimrc | 0 .../vim/scripts/shellcheck_binary_fix.sh | 0 roles/vim/tasks/main.yml | 84 +++++++++++++++++++ 9 files changed, 84 insertions(+), 54 deletions(-) rename {dotfiles/vim => roles/vim/files}/colors/apprentice.vim (100%) rename {dotfiles/vim => roles/vim/files}/colors/monokai.vim (100%) rename {dotfiles/vim => roles/vim/files}/colors/wombat256.vim (100%) rename {dotfiles => roles/vim/files}/flake8 (100%) rename {dotfiles => roles/vim/files}/pylintrc (100%) rename {dotfiles/vim => roles/vim/files}/vimrc (100%) rename shellcheck_binary_fix.sh => roles/vim/scripts/shellcheck_binary_fix.sh (100%) create mode 100644 roles/vim/tasks/main.yml diff --git a/configs.yml b/configs.yml index e8b8dac..3067b9b 100644 --- a/configs.yml +++ b/configs.yml @@ -391,60 +391,6 @@ java: - install: - jdk-openjdk -vim: - - install: - arch: - - gvim - - python-pylint - - python-black - - base-devel - debian: - - vim-gtk - - pylint3 - - build-essential - - python3-dev - both: - - flake8 - - mypy - - shellcheck - - cmake - - clang - - npm # for coc - - run: - command: /bin/bash ./shellcheck_binary_fix.sh - condition: arch # some Arch derivatives have this problem (arch32, archarm) - - symlink: - - dotfiles/flake8 - - ~/.flake8 - - symlink: - - dotfiles/pylintrc - - ~/.pylintrc - - symlink: - - dotfiles/vim/vimrc - - ~/.vimrc - - symlink: - - dotfiles/vim/colors - - ~/.vim/colors - - run: - command: curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - condition: "[ ! -e ~/.vim/autoload/plug.vim ]" - - run: - - vim +PlugInstall +qall # run this without conditions so it includes added stuff - - run: - command: vim +PlugUpgrade +qall - condition: update - - run: - command: vim +PlugUpdate +qall - condition: update - - run: - command: vim +CocUpdate +qall - condition: update - - run: - command: vim +BlackUpgrade +qall - condition: update - - run: - - pip install -U hdl-checker --user - zsh: - install: arch: diff --git a/dotfiles/vim/colors/apprentice.vim b/roles/vim/files/colors/apprentice.vim similarity index 100% rename from dotfiles/vim/colors/apprentice.vim rename to roles/vim/files/colors/apprentice.vim diff --git a/dotfiles/vim/colors/monokai.vim b/roles/vim/files/colors/monokai.vim similarity index 100% rename from dotfiles/vim/colors/monokai.vim rename to roles/vim/files/colors/monokai.vim diff --git a/dotfiles/vim/colors/wombat256.vim b/roles/vim/files/colors/wombat256.vim similarity index 100% rename from dotfiles/vim/colors/wombat256.vim rename to roles/vim/files/colors/wombat256.vim diff --git a/dotfiles/flake8 b/roles/vim/files/flake8 similarity index 100% rename from dotfiles/flake8 rename to roles/vim/files/flake8 diff --git a/dotfiles/pylintrc b/roles/vim/files/pylintrc similarity index 100% rename from dotfiles/pylintrc rename to roles/vim/files/pylintrc diff --git a/dotfiles/vim/vimrc b/roles/vim/files/vimrc similarity index 100% rename from dotfiles/vim/vimrc rename to roles/vim/files/vimrc diff --git a/shellcheck_binary_fix.sh b/roles/vim/scripts/shellcheck_binary_fix.sh similarity index 100% rename from shellcheck_binary_fix.sh rename to roles/vim/scripts/shellcheck_binary_fix.sh diff --git a/roles/vim/tasks/main.yml b/roles/vim/tasks/main.yml new file mode 100644 index 0000000..7c5d7f5 --- /dev/null +++ b/roles/vim/tasks/main.yml @@ -0,0 +1,84 @@ +--- + +- name: Install packages (Arch) + become: true + pacman: + name: + - gvim + - python-pylint + - python-black + - base-devel + - flake8 + - mypy + - shellcheck + - cmake + - clang + - npm # for coc + when: ansible_distribution == 'Archlinux' + +- name: Install packages (Debian) + become: true + apt: + name: + - vim-gtk + - pylint3 + - build-essential + - python3-dev + - flake8 + - mypy + - shellcheck + - cmake + - clang + - npm # for coc + when: ansible_distribution == 'Debian' + +# some Arch derivatives don't have the package (arch32, archarm) +- script: scripts/shellcheck_binary_fix.sh + when: ansible_distribution == 'Archlinux' + +- 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/colors/' } + +- 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' # When an error with vimrc is encountered, needs user input to continue + +- name: Install plugins + command: + cmd: vim +PlugInstall +qall + stdin: '\n' # When an error with vimrc is encountered, needs user input to continue + +- name: Update plugins + command: + cmd: vim +PlugUpdate +qall + stdin: '\n' # When an error with vimrc is encountered, needs user input to continue + +- name: Update Coc plugins + command: + cmd: vim +CocUpdate +qall + stdin: '\n' # When an error with vimrc is encountered, needs user input to continue + +- name: Upgrade Black + command: + cmd: vim +BlackUpgrade +qall + stdin: '\n' # When an error with vimrc is encountered, needs user input to continue + +- name: Install hdl-checker + pip: + name: hdl-checker + extra_args: --user