From 5f3cdb3efb91583635c26ce43288f7559bcc5bc0 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 25 Nov 2021 10:23:45 +0100 Subject: [PATCH] Update neovim configuration --- playbook.yml | 1 + tasks/dotfiles.yml | 13 --------- tasks/main.yml | 14 --------- tasks/neovim.yml | 66 +++++++++++++++++++++++++++++++++++++++++++ vars/archlinux-na.yml | 1 - vars/main.yml | 5 ++-- 6 files changed, 70 insertions(+), 30 deletions(-) create mode 100644 tasks/neovim.yml diff --git a/playbook.yml b/playbook.yml index 4c71b78..ad33ee1 100644 --- a/playbook.yml +++ b/playbook.yml @@ -23,6 +23,7 @@ name: common tasks_from: 'poetry.yml' - import_tasks: 'tasks/dotfiles.yml' + - import_tasks: 'tasks/neovim.yml' vars_files: - 'vars/main.yml' - 'vars/{{ ansible_distribution|lower }}-{{ ansible_distribution_release|lower }}.yml' diff --git a/tasks/dotfiles.yml b/tasks/dotfiles.yml index c9c4cfc..3dea8a8 100644 --- a/tasks/dotfiles.yml +++ b/tasks/dotfiles.yml @@ -5,15 +5,6 @@ version: master update: yes -- name: create dotfile folders - file: - state: directory - mode: '0755' - path: '{{ item }}' - loop: - - '{{ xdg_config_dir }}/nvim' - - '{{ xdg_data_dir }}/nvim/site' - - name: setup dotfiles file: path: '{{ item.dest }}' @@ -21,10 +12,6 @@ state: link force: true loop: - - { - src: '{{ ansible_env.HOME }}/dotfiles/nvim/init.vim', - dest: '{{ xdg_config_dir }}/nvim/init.vim', - } - { src: '{{ ansible_env.HOME }}/dotfiles/.vimrc', dest: '{{ ansible_env.HOME }}/.vimrc', diff --git a/tasks/main.yml b/tasks/main.yml index c69edd9..91e686f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -11,20 +11,6 @@ update: true version: master -- name: clone neovim packages - git: - repo: '{{ item.url }}' - dest: '{{ xdg_data_dir }}/nvim/site/pack/default/start/{{ item.name }}' - version: master - update: true - loop: '{{ vim_plugins }}' - -- name: install pynvim package - pip: - name: - - neovim - - pynvim - - name: copy konsole configuration files template: src: '{{ item.src }}' diff --git a/tasks/neovim.yml b/tasks/neovim.yml new file mode 100644 index 0000000..742c1c5 --- /dev/null +++ b/tasks/neovim.yml @@ -0,0 +1,66 @@ +- name: ensure neovim configuration directories exist + file: + path: '{{ item }}' + state: directory + loop: + - '{{ xdg_config_dir }}/nvim/' + - '{{ xdg_config_dir }}/nvim/lua' + - '{{ xdg_data_dir }}/nvim/site' + - '{{ xdg_data_dir }}/nvim/site/pack' + - '{{ xdg_data_dir }}/nvim/site/pack/default' + - '{{ xdg_data_dir }}/nvim/site/pack/default/start' + +- name: clone neovim packages + git: + repo: '{{ item.url }}' + dest: '{{ xdg_data_dir }}/nvim/site/pack/default/start/{{ item.name }}' + update: true + loop: '{{ vim_plugins }}' + +- name: install pynvim package + pip: + name: + - neovim + - pynvim + +- name: remove old neovim configuration file + file: + path: '{{ xdg_config_dir }}/nvim/init.vim' + state: absent + +- name: remove coc.nvim extension + file: + path: '{{ xdg_data_dir }}/nvim/site/pack/default/start/coc.nvim' + state: absent + +- name: setup neovim configuration files + file: + path: '{{ item.dest }}' + src: '{{ item.src }}' + state: link + force: true + loop: + - { + src: '{{ ansible_env.HOME }}/dotfiles/nvim/init.lua', + dest: '{{ xdg_config_dir }}/nvim/init.lua', + } + - { + src: '{{ ansible_env.HOME }}/dotfiles/nvim/lua/auto-commands.lua', + dest: '{{ xdg_config_dir }}/nvim/lua/auto-commands.lua', + } + - { + src: '{{ ansible_env.HOME }}/dotfiles/nvim/lua/keybindings.lua', + dest: '{{ xdg_config_dir }}/nvim/lua/keybindings.lua', + } + - { + src: '{{ ansible_env.HOME }}/dotfiles/nvim/lua/lsp.lua', + dest: '{{ xdg_config_dir }}/nvim/lua/lsp.lua', + } + - { + src: '{{ ansible_env.HOME }}/dotfiles/nvim/lua/nvim-cmp.lua', + dest: '{{ xdg_config_dir }}/nvim/lua/nvim-cmp.lua', + } + - { + src: '{{ ansible_env.HOME }}/dotfiles/nvim/lua/options.lua', + dest: '{{ xdg_config_dir }}/nvim/lua/options.lua', + } diff --git a/vars/archlinux-na.yml b/vars/archlinux-na.yml index f29d826..7e6330f 100644 --- a/vars/archlinux-na.yml +++ b/vars/archlinux-na.yml @@ -5,7 +5,6 @@ packages: - vim - neovim - npm - - ctags - docker - docker-compose - ttf-ibm-plex diff --git a/vars/main.yml b/vars/main.yml index c46593b..73e3f3f 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -11,9 +11,10 @@ githook_repo: 'git@git.fudiggity.nl:sonny/git-hooks.git' vim_plugins: - { url: 'https://github.com/preservim/nerdtree', name: 'nerdtree' } - - { url: 'https://github.com/neoclide/coc.nvim', name: 'coc.nvim' } - { url: 'https://github.com/sheerun/vim-polyglot', name: 'vim-polygot' } - - { url: 'https://github.com/arzg/vim-colors-xcode.git', name: 'vim-colors-xcode' } + - { url: 'https://github.com/neovim/nvim-lspconfig', name: 'nvim-lspconfig' } + - { url: 'https://github.com/hrsh7th/nvim-cmp/', name: 'nvim-cmp' } + - { url: 'https://github.com/hrsh7th/cmp-nvim-lsp/', name: 'cmp-nvim-lsp' } gitlab_domain: 'git.fudiggity.nl' gitlab_host_key: 'git.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICNmvcxza79T7JZMkifmquwXH/kMUqDnKs9Oob+JrRvn'