From a71f9b7bc51d8231911a8946222f57cd5fd9847f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Sun, 3 Oct 2021 14:24:46 +0200 Subject: [PATCH] Update vim plugin installations --- user.yml | 59 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/user.yml b/user.yml index be51334..dd3f10d 100644 --- a/user.yml +++ b/user.yml @@ -301,27 +301,60 @@ src: ~/.vim/autoload/plug.vim force: true + - name: get ycm version before update + shell: | + if ! [[ -d ~/.local/share/nvim/plugged/YouCompleteMe ]] ; then + exit 200 + fi + cd ~/.local/share/nvim/plugged/YouCompleteMe + git rev-parse HEAD + args: + executable: /bin/bash + register: ycm_before_update + changed_when: false + failed_when: ycm_before_update.rc not in (0, 200) + - name: install vim plugins - command: /usr/bin/nvim -f -E -s -c "source ~/.vimrc" +PlugInstall +qall - register: vim_plugins_stdout - check_mode: false - changed_when: vim_plugins_stdout.stdout_lines|length != 0 + command: /usr/bin/nvim --headless +"PlugInstall --sync" +qall + changed_when: false + + - name: install go binaries for vim + command: /usr/bin/nvim --headless +GoInstallBinaries +qall + changed_when: false - name: update vim plugins - command: /usr/bin/nvim -f -E -s -c "source ~/.vimrc" +PlugUpdate +qall - register: vim_plugin_update - changed_when: vim_plugin_update.stdout_lines|length != 0 + command: /usr/bin/nvim --headless +"PlugUpdate --sync" +qall + changed_when: false + + - name: update go binaries for vim + command: /usr/bin/nvim --headless +GoUpdateBinaries +qall + changed_when: false + + - name: get ycm version after update + shell: | + cd ~/.local/share/nvim/plugged/YouCompleteMe + git rev-parse HEAD + args: + executable: /bin/bash + register: ycm_after_update + changed_when: false - name: compile youcompleteme - # --force-sudo is required, as the script refuses to run - # in a sudo environment (i.e. if the SUDO_USER env variable - # is set). But of course, ansible uses that to assume the - # other user. It's fine. + # --force-sudo is required, as the script refuses to run in a sudo + # environment (i.e. if the SUDO_USER env variable is set). But of course, + # ansible uses that to assume the other user. It's fine. shell: | - cd ~/.local/share/nvim/plugged/YouCompleteMe/ + cd ~/.local/share/nvim/plugged/YouCompleteMe python3 ./install.py --force-sudo args: - creates: '~/.local/share/nvim/plugged/YouCompleteMe/third_party/ycmd/ycm_core.cpython-38-x86_64-linux-gnu.so' + executable: /bin/bash + register: ycm_compile_output + failed_when: ycm_compile_output.rc not in (0, 200) + when: > + (ycm_before_update.rc == 200) + or + (ycm_before_update.stdout != ycm_after_update.stdout) + tags: [vim-plugins] - block: - name: firefox - create chrome directory