feat(neovim): add initial role
This commit is contained in:
parent
cc671bda63
commit
07f1a6078b
27
roles/neovim/README.md
Normal file
27
roles/neovim/README.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
neovim
|
||||
======
|
||||
|
||||
Deploys neovim from xbps and configures it, with plugins installed via dein. It
|
||||
ships with language server configs for rust, and it comes with the deus theme
|
||||
preconfigured
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
```yaml
|
||||
- hosts: devboxes
|
||||
collections:
|
||||
- jcgruenhage.base
|
||||
roles:
|
||||
- neovim
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
[CNPLv7+](https://thufie.lain.haus/NPL.html)
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
- [Jan Christian Grünhage](https://jcg.re) <jan.christian@gruenhage.xyz>
|
10
roles/neovim/defaults/main.yml
Normal file
10
roles/neovim/defaults/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
neovim_dein_plugin_dir: ".local/share/dein"
|
||||
neovim_dein_install_dir: "{{ user.home_path }}/{{ neovim_dein_plugin_dir }}/repos/github.com/Shougo/dein.vim"
|
||||
neovim_dein_repo: "https://github.com/Shougo/dein.vim"
|
||||
|
||||
neovim_config_path: "{{ user.home_path }}/.config/nvim"
|
||||
neovim_init_vim_path: "{{ neovim_config_path }}/init.vim"
|
||||
neovim_config_d_path: "{{ neovim_config_path }}/config.d"
|
||||
|
||||
neovim_users: ["root"]
|
2
roles/neovim/handlers/main.yml
Normal file
2
roles/neovim/handlers/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# handlers file for neovim
|
7
roles/neovim/meta/main.yml
Normal file
7
roles/neovim/meta/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
galaxy_info:
|
||||
author: Jan Christian Grünhage
|
||||
description: Deploy and configure neovim
|
||||
license: CNPLv7+
|
||||
min_ansible_version: 2.9
|
||||
galaxy_tags: []
|
||||
dependencies: []
|
14
roles/neovim/tasks/main.yml
Normal file
14
roles/neovim/tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- name: install neovim
|
||||
become: yes
|
||||
xbps:
|
||||
name: neovim
|
||||
- name: install dependecy packages
|
||||
become: yes
|
||||
xbps:
|
||||
name:
|
||||
- fzf
|
||||
- rust-analyzer
|
||||
- name: loop over user specific tasks
|
||||
include: user.yml
|
||||
loop: "{{ neovim_users }}"
|
37
roles/neovim/tasks/user.yml
Normal file
37
roles/neovim/tasks/user.yml
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
- name: setup variables
|
||||
set_fact:
|
||||
user:
|
||||
name: "{{ item }}"
|
||||
home_path: "{{ (item == 'root') | ternary('/root', '/home/' + item) }}"
|
||||
- name: create neovim directories
|
||||
become: yes
|
||||
become_user: "{{ user.name }}"
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
loop:
|
||||
- "{{ neovim_dein_install_dir }}"
|
||||
- "{{ neovim_config_d_path }}"
|
||||
- name: clone dein
|
||||
become: yes
|
||||
become_user: "{{ user.name }}"
|
||||
git:
|
||||
repo: "{{ neovim_dein_repo }}"
|
||||
dest: "{{ neovim_dein_install_dir }}"
|
||||
- name: template init.vim
|
||||
become: yes
|
||||
become_user: "{{ user.name }}"
|
||||
template:
|
||||
src: init.vim.j2
|
||||
dest: "{{ neovim_init_vim_path }}"
|
||||
- name: template additional config files
|
||||
become: yes
|
||||
become_user: "{{ user.name }}"
|
||||
template:
|
||||
src: "{{ item }}.j2"
|
||||
dest: "{{ neovim_config_d_path }}/{{ item }}"
|
||||
loop:
|
||||
- "general.vim"
|
||||
- "appearance.vim"
|
||||
- "lsp.vim"
|
14
roles/neovim/templates/appearance.vim.j2
Normal file
14
roles/neovim/templates/appearance.vim.j2
Normal file
|
@ -0,0 +1,14 @@
|
|||
set t_Co=256
|
||||
set termguicolors
|
||||
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline_theme = 'deus'
|
||||
|
||||
set background=dark
|
||||
|
||||
colorscheme deus
|
||||
let g:deus_termcolors = 256
|
||||
|
||||
set cursorline
|
||||
set number
|
||||
set relativenumber
|
5
roles/neovim/templates/general.vim.j2
Normal file
5
roles/neovim/templates/general.vim.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
set nocompatible
|
||||
set clipboard=unnamedplus
|
||||
|
||||
filetype plugin indent on
|
||||
syntax enable
|
30
roles/neovim/templates/init.vim.j2
Normal file
30
roles/neovim/templates/init.vim.j2
Normal file
|
@ -0,0 +1,30 @@
|
|||
set runtimepath+=/home/jcgruenhage/.local/share/dein/repos/github.com/Shougo/dein.vim
|
||||
call dein#begin('/home/jcgruenhage/.local/share/dein')
|
||||
call dein#add('/home/jcgruenhage/.local/share/dein/repos/github.com/Shougo/dein.vim')
|
||||
|
||||
call dein#add('junegunn/fzf', { 'build': './install --all', 'merged': 0 })
|
||||
call dein#add('junegunn/fzf.vim', { 'depends': 'fzf' })
|
||||
|
||||
call dein#add('neovim/nvim-lspconfig')
|
||||
call dein#add('nvim-lua/lsp_extensions.nvim')
|
||||
call dein#add('nvim-lua/completion-nvim')
|
||||
|
||||
call dein#add('vim-airline/vim-airline')
|
||||
call dein#add('vim-airline/vim-airline-themes')
|
||||
|
||||
call dein#add('tpope/vim-fugitive')
|
||||
|
||||
call dein#add('ajmwagar/vim-deus')
|
||||
|
||||
call dein#add('editorconfig/editorconfig-vim')
|
||||
|
||||
call dein#end()
|
||||
|
||||
if dein#check_install()
|
||||
call dein#install()
|
||||
endif
|
||||
|
||||
" include all the files in the config.d directory
|
||||
for fpath in split(globpath('~/.config/nvim/config.d', '*.vim'), '\n')
|
||||
exe 'source' fpath
|
||||
endfor
|
21
roles/neovim/templates/lsp.vim.j2
Normal file
21
roles/neovim/templates/lsp.vim.j2
Normal file
|
@ -0,0 +1,21 @@
|
|||
set completeopt=menuone,noinsert,noselect
|
||||
set shortmess+=c
|
||||
|
||||
lua <<EOF
|
||||
|
||||
local nvim_lsp = require'lspconfig'
|
||||
|
||||
local on_attach = function(client)
|
||||
require'completion'.on_attach(client)
|
||||
end
|
||||
|
||||
nvim_lsp.rust_analyzer.setup({ on_attach=on_attach })
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
}
|
||||
)
|
||||
EOF
|
2
roles/neovim/vars/main.yml
Normal file
2
roles/neovim/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
# vars file for neovim
|
Loading…
Reference in a new issue