212 lines
6.6 KiB
YAML
212 lines
6.6 KiB
YAML
---
|
|
- name: Fail if still using init.vim
|
|
stat:
|
|
path: ~/.config/nvim/init.vim
|
|
register: init_vim
|
|
failed_when: init_vim.stat.exists
|
|
|
|
- name: Install (Archlinux)
|
|
when:
|
|
ansible_facts['distribution'] == 'Archlinux'
|
|
block:
|
|
- name: Install things with pacman (Archlinux)
|
|
become: true
|
|
pacman:
|
|
name:
|
|
- neovim
|
|
- python-pynvim
|
|
- base-devel
|
|
- cmake
|
|
- clang
|
|
- npm
|
|
- ripgrep
|
|
- rsync # for 'synchronize' module
|
|
- ansible-lint
|
|
- flake8
|
|
- mypy
|
|
- python-pylint
|
|
- python-black
|
|
- shellcheck
|
|
- bash-language-server
|
|
- jedi-language-server
|
|
- lua-language-server
|
|
- texlab
|
|
- rust-analyzer
|
|
- name: Install things with npm (Archlinux)
|
|
become: true
|
|
npm:
|
|
name: "{{ item }}"
|
|
global: true
|
|
with_items:
|
|
- '@ansible/ansible-language-server'
|
|
- diagnostic-languageserver
|
|
|
|
- name: Install (Debian)
|
|
when:
|
|
ansible_facts['distribution'] == 'Debian'
|
|
block:
|
|
- name: Find latest neovim version
|
|
uri:
|
|
url: https://github.com/neovim/neovim/releases/latest
|
|
register: latest_http_content
|
|
- name: Set latest neovim version
|
|
set_fact:
|
|
neovim_version: "{{ latest_http_content.url | split('/') | last }}"
|
|
- name: Get latest neovim deb package
|
|
get_url:
|
|
url: "https://github.com/neovim/neovim/releases/download/{{ neovim_version }}/nvim-linux64.deb"
|
|
checksum: "sha256:https://github.com/neovim/neovim/releases/download/{{ neovim_version }}/nvim-linux64.deb.sha256sum"
|
|
dest: /tmp/nvim-linux64.deb
|
|
mode: 0644
|
|
- name: Install neovim deb package (Debian)
|
|
become: true
|
|
apt:
|
|
deb: /tmp/nvim-linux64.deb
|
|
- name: Install things with apt (Debian)
|
|
become: true
|
|
apt:
|
|
name:
|
|
- ansible-lint
|
|
- python3-pynvim
|
|
- build-essential
|
|
- python3-dev
|
|
- cmake
|
|
- clang
|
|
- clangd
|
|
- npm
|
|
- ripgrep
|
|
- rsync # for 'synchronize' module
|
|
- flake8
|
|
- mypy
|
|
- pylint3
|
|
- shellcheck
|
|
- name: Install things with pip (Debian)
|
|
pip:
|
|
name:
|
|
- jedi-language-server
|
|
extra_args: --user
|
|
- name: Install things with npm (Debian)
|
|
become: true
|
|
npm:
|
|
name: "{{ item }}"
|
|
global: true
|
|
with_items:
|
|
- '@ansible/ansible-language-server'
|
|
- bash-language-server
|
|
- diagnostic-languageserver
|
|
- name: Find latest texlab version
|
|
uri:
|
|
url: https://github.com/latex-lsp/texlab/releases/latest
|
|
register: latest_http_content
|
|
- name: Set latest texlab version
|
|
set_fact:
|
|
texlab_version: "{{ latest_http_content.url | split('/') | last }}"
|
|
- name: Get latest texlab binary
|
|
unarchive:
|
|
src: "https://github.com/latex-lsp/texlab/releases/download/{{ texlab_version }}/texlab-{{ ansible_facts.architecture }}-linux.tar.gz"
|
|
remote_src: true
|
|
dest: ~/.local/bin/
|
|
mode: 0755
|
|
- name: Find latest lua-language-server version
|
|
uri:
|
|
url: https://github.com/sumneko/lua-language-server/releases/latest
|
|
register: latest_http_content
|
|
- name: Set latest lua-language-server version
|
|
set_fact:
|
|
lua_lsp_version: "{{ latest_http_content.url | split('/') | last }}"
|
|
- name: Create tempdir for extracting lua-language-server
|
|
file:
|
|
path: /tmp/lualsp
|
|
state: directory
|
|
mode: 0755
|
|
changed_when: false
|
|
- name: Get latest lua-lsp archive
|
|
unarchive:
|
|
src: "https://github.com/sumneko/lua-language-server/releases/download/{{ lua_lsp_version }}/lua-language-server-{{ lua_lsp_version }}-linux-x64.tar.gz"
|
|
remote_src: true
|
|
dest: /tmp/lualsp/
|
|
changed_when: false
|
|
- name: Copy lua-lsp binary
|
|
copy:
|
|
src: /tmp/lualsp/bin/lua-language-server
|
|
remote_src: true
|
|
dest: ~/.local/bin/
|
|
mode: 0755
|
|
- name: Find latest rust-analyzer version
|
|
uri:
|
|
url: https://github.com/rust-lang/rust-analyzer/releases/latest
|
|
register: latest_http_content
|
|
- name: Set latest rust-analyzer version
|
|
set_fact:
|
|
rust_analyzer_version: "{{ latest_http_content.url | split('/') | last }}"
|
|
- name: Create tempdir for extracting rust-analyzer
|
|
file:
|
|
path: /tmp/rust-analyzer
|
|
state: directory
|
|
mode: 0755
|
|
changed_when: false
|
|
- name: Get latest rust-analyzer compressed binary
|
|
get_url:
|
|
url: "https://github.com/rust-lang/rust-analyzer/releases/download/{{ rust_analyzer_version }}/rust-analyzer-x86_64-unknown-linux-gnu.gz"
|
|
dest: /tmp/rust-analyzer/
|
|
mode: 0644
|
|
changed_when: false
|
|
- name: Decompress rust-analyzer binary
|
|
command:
|
|
cmd: gzip -fd /tmp/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu.gz
|
|
chdir: /tmp/rust-analyzer
|
|
changed_when: false
|
|
- name: Copy rust-analyzer binary
|
|
copy:
|
|
src: /tmp/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu
|
|
remote_src: true
|
|
dest: ~/.local/bin/rust-analyzer
|
|
mode: 0755
|
|
|
|
- name: Grab marksman (LSP server) binary
|
|
block:
|
|
- name: Find latest marksman version
|
|
uri:
|
|
url: https://github.com/artempyanykh/marksman/releases/latest
|
|
register: latest_http_content
|
|
- name: Set latest marksman version
|
|
set_fact:
|
|
marksman_version: "{{ latest_http_content.url | split('/') | last }}"
|
|
- name: Get latest marksman binary
|
|
get_url:
|
|
url: "https://github.com/artempyanykh/marksman/releases/download/{{ marksman_version }}/marksman-linux"
|
|
dest: ~/.local/bin/marksman
|
|
mode: 0755
|
|
|
|
- name: Make sure needed directories exist
|
|
file: path={{ item.path }} state=directory mode={{ item.mode }}
|
|
with_items:
|
|
- {path: '~/.config/nvim', mode: '0755'}
|
|
- {path: '~/.config/nvim/lua', mode: '0755'}
|
|
- {path: '~/.config/nvim/after', mode: '0755'}
|
|
|
|
- name: Copy configs
|
|
copy: src={{ item.src }} dest={{ item.dest }} mode=0644
|
|
with_items:
|
|
- {src: 'init.lua', dest: '~/.config/nvim/init.lua'}
|
|
- {src: 'flake8', dest: '~/.flake8'}
|
|
- {src: 'pylintrc', dest: '~/.pylintrc'}
|
|
|
|
- name: Copy lua configs
|
|
synchronize:
|
|
src: "{{ item }}"
|
|
dest: ~/.config/nvim/
|
|
recursive: true
|
|
delete: true
|
|
with_items:
|
|
- lua
|
|
- after
|
|
|
|
- name: Run PackerSync
|
|
command: nvim --headless -c 'autocmd User PackerComplete quitall' -c PackerSync
|
|
# TODO: changed_when
|
|
changed_when: false
|
|
|
|
- name: Run TSUpdate
|
|
command: nvim --headless -c TSUpdate -c quitall
|
|
changed_when: false
|