Compare commits
169 commits
file-restr
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 66cde494d8 | |||
| 48cf510079 | |||
| 086c6217a6 | |||
| 88898151e6 | |||
| 2fbfbb273f | |||
| 7d363a30b2 | |||
| 5e1ddd690d | |||
| 54d4fa4323 | |||
| cca1f0e59d | |||
| bdf0af0645 | |||
| df438c062b | |||
| 95c5cddab2 | |||
| 224b9d08f0 | |||
| d65dc0ef3b | |||
| 8864a5d37e | |||
| 8ad75b7029 | |||
| 5edc5bd7e1 | |||
| 3820b79faf | |||
| c8ee2a0623 | |||
| ca9edc9d38 | |||
| 5e0ff0dbc5 | |||
| bdc337b3cb | |||
| 1b881c1559 | |||
| 0caa8c07fc | |||
| f21944eb52 | |||
| 87f05c5d83 | |||
| a68558e4ae | |||
| 3b50e0ee67 | |||
| 8b7ad62cff | |||
| 53ef5f0d54 | |||
| b6222e3682 | |||
| 6d801bcb4e | |||
| 6adb1f506f | |||
| 0dc654ae2e | |||
| d174718477 | |||
| 747a1fe584 | |||
| 7f3dd527af | |||
| 2d5e5caa25 | |||
| d46c4e4ec2 | |||
| 755493d155 | |||
| f7eb8dc56d | |||
| 0f0a5e592b | |||
| 0bf40c8972 | |||
| cbddfba5ee | |||
| bd146ae1d8 | |||
| cf129ad7f6 | |||
| 7d974f5115 | |||
| 5d15147130 | |||
| ee344af9f5 | |||
| a351ad691b | |||
| 030f887734 | |||
| c2c6f53075 | |||
| 3ca4225f7c | |||
| 199f40b0ea | |||
| 5aa08aef39 | |||
| eb14a601fb | |||
| c2bbe6cf4a | |||
| 3b9e414e17 | |||
| f9a3f5f8bf | |||
| ad47adabd0 | |||
| 0113a9c143 | |||
| 52e30d61d1 | |||
| 2bbf7655c9 | |||
| a3353cc601 | |||
| f45918c93d | |||
| d300288799 | |||
| b663f3bb20 | |||
| 9183c29751 | |||
| f61a044c86 | |||
| 6115ca4be2 | |||
| 6f512112d8 | |||
| a791f70f5f | |||
| 763124e737 | |||
| 3b448a8579 | |||
| a5d9b86b3c | |||
| f1196f4c42 | |||
| e737c4f44b | |||
| 0fa06bdf39 | |||
| 903b70b59d | |||
| 5a346cf7ea | |||
| c775ba3fa5 | |||
| 8bd8ce698c | |||
| 4dba4f2bb0 | |||
| 10469b1d42 | |||
| c2dc0f5c8b | |||
| dc1285358e | |||
| 373dad8448 | |||
| 3587460d37 | |||
| 0d85540281 | |||
| 613b72cd15 | |||
| d6680fd014 | |||
| 02fbdf4389 | |||
| 80222dd489 | |||
| 7f908f1c40 | |||
| ff290950ba | |||
| 3c3b3952b4 | |||
| 6247861f0f | |||
| a458963ff0 | |||
| f817379950 | |||
| 905e696cbf | |||
| ae424f066d | |||
| aef5ca8138 | |||
| 8254bfee9f | |||
| fe9f6788c3 | |||
| 8f273cc775 | |||
| deec1581c5 | |||
| b53e644f7e | |||
| 6de369fbbb | |||
| e28e2eec11 | |||
| ad6c1dedfe | |||
| 0ca888974c | |||
| 4d57f381a9 | |||
| 699bb8d85c | |||
| 4103f73de3 | |||
| a5aa039671 | |||
| 0755c7e3d4 | |||
| 057797e25d | |||
| 1d09789238 | |||
| bbf5f1a3c7 | |||
| b0cdf7b854 | |||
| 9891f205f4 | |||
| b61cc78a65 | |||
| 69f44a414d | |||
| 1c59ba439f | |||
| ff63e93336 | |||
| 65e8420e47 | |||
| 11f27e4869 | |||
| 092b78cce6 | |||
| 82c346506d | |||
| 9881f4134b | |||
| d5c3653320 | |||
| 55b28b21bd | |||
| 0a125b00bd | |||
| 7cc21dd3f9 | |||
| 74a974be5e | |||
| 6cd67e88ad | |||
| e2227cd87d | |||
| 7a635a437b | |||
| 0e6d5bdff0 | |||
| ba225a09a7 | |||
| ba2ae319b6 | |||
| 7f1f1f0efb | |||
| e205c6c0cf | |||
| d9eeeb3684 | |||
| dfff572025 | |||
| a6f0bc729c | |||
| 208eca8c05 | |||
| e1ed19dea5 | |||
| 3d26eaa10c | |||
| cede4ea365 | |||
| 52a8bc8a7f | |||
| 4c35875333 | |||
| 195b9600bb | |||
| 5f3cdb3efb | |||
| c1b9f491e4 | |||
| 6d79543fc9 | |||
| 64fde68038 | |||
| 3e4d60091e | |||
| af58cdc396 | |||
| 0d16af9d83 | |||
| b28f961d7d | |||
| 8cc4d46b96 | |||
| c38742df47 | |||
| 4dfc755e05 | |||
| f7ef91cb35 | |||
| 3094ca8ce7 | |||
| 05beb0ece3 | |||
| 0e5b42dcec | |||
| af7211830d |
61 changed files with 1601 additions and 235 deletions
|
|
@ -1,26 +0,0 @@
|
|||
stages:
|
||||
- lint
|
||||
- test
|
||||
|
||||
cache:
|
||||
key: $CI_COMMIT_REF_SLUG
|
||||
paths:
|
||||
- .cache/pip
|
||||
- node_modules/
|
||||
|
||||
lint:
|
||||
stage: lint
|
||||
image: node:12
|
||||
before_script:
|
||||
- npm install prettier --no-save
|
||||
script:
|
||||
- npx prettier '**/*.yml' --check
|
||||
|
||||
syntax-test:
|
||||
stage: test
|
||||
image: python:3.7
|
||||
before_script:
|
||||
- pip install ansible --quiet
|
||||
- ansible-galaxy install -r requirements.yml
|
||||
script:
|
||||
- ansible-playbook playbook.yml --syntax-check
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
singleQuote: true
|
||||
printWidth: 90
|
||||
tabWidth: 2
|
||||
useTabs: false
|
||||
bracketSpacing: true
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
[defaults]
|
||||
roles_path = ./roles
|
||||
inventory = inventory.yml
|
||||
|
||||
[privilege_escalation]
|
||||
become_ask_pass = True
|
||||
|
|
|
|||
3
files/desktop/docker-daemon.json
Normal file
3
files/desktop/docker-daemon.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"data-root": "/mnt/docker"
|
||||
}
|
||||
14
files/nvim.conform.lua
Normal file
14
files/nvim.conform.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
-- example of a project specific nvim configuration file using :exrc and conform
|
||||
|
||||
local conform = require 'conform';
|
||||
|
||||
conform.setup {
|
||||
formatters_by_ft = {
|
||||
python = { 'isort', 'black' },
|
||||
javascript = { 'prettier', },
|
||||
},
|
||||
|
||||
format_on_save = {
|
||||
lsp_format = 'never',
|
||||
}
|
||||
}
|
||||
33
files/nvim.lsp.lua
Normal file
33
files/nvim.lsp.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
-- example of a project specific nvim configuration file using :exrc and lsp formatting
|
||||
|
||||
local format_clients = {
|
||||
'ruff',
|
||||
'lua_ls',
|
||||
'bashls',
|
||||
'jsonls',
|
||||
'ts_ls',
|
||||
'ansiblels',
|
||||
'yamlls',
|
||||
'cssls',
|
||||
'html',
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('lsp', { clear = true }),
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
|
||||
if client:supports_method('textDocument/formatting')
|
||||
and vim.tbl_contains(format_clients, client.name) then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format {
|
||||
async = false,
|
||||
id = args.data.client_id
|
||||
}
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
})
|
||||
32
files/tmux.sh
Executable file
32
files/tmux.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
session_name=${PWD##*/}
|
||||
project_directory="$HOME/development/$session_name"
|
||||
|
||||
tmux has-session -t $session_name
|
||||
|
||||
if [ $? != 0 ];
|
||||
then
|
||||
tmux new-session \
|
||||
-c $project_directory \
|
||||
-ds $session_name \
|
||||
-e "project_dir=$project_directory"
|
||||
|
||||
# FIRST WINDOW
|
||||
tmux send-keys -t $session_name:0 'source ./env/bin/activate' C-m
|
||||
tmux send-keys -t $session_name:0 'nvim' C-m
|
||||
|
||||
# SECOND WINDOW
|
||||
tmux new-window -t $session_name
|
||||
|
||||
# THIRD WINDOW
|
||||
tmux new-window -t $session_name
|
||||
|
||||
# FOURTH WINDOW
|
||||
tmux new-window -t $session_name
|
||||
|
||||
# SELECT DEFAULT PANE AFTER OPENING
|
||||
tmux select-window -t $session_name:0
|
||||
fi
|
||||
|
||||
tmux attach -t $session_name
|
||||
7
group_vars/all/git.yml
Normal file
7
group_vars/all/git.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
dotfiles_repo: 'git@forgejo.fudiggity.nl:sonny/dotfiles.git'
|
||||
|
||||
git_domain: 'forgejo.fudiggity.nl'
|
||||
git_host_key: 'forgejo.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBqEej87ukSK7KGi7e0q+oTrru4h7Fm6fK8GgiMtu01+'
|
||||
|
||||
git_name: Sonny Bakker
|
||||
git_email: sonny871@hotmail.com
|
||||
50
group_vars/all/neovim.yml
Normal file
50
group_vars/all/neovim.yml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
neovim_plugins:
|
||||
- url: 'https://forgejo.fudiggity.nl/sonny/source-link.lua'
|
||||
name: 'source-link'
|
||||
- url: 'https://github.com/nvim-tree/nvim-tree.lua'
|
||||
name: 'nvim-tree'
|
||||
- url: 'https://github.com/nvim-tree/nvim-web-devicons'
|
||||
name: 'nvim-tree-icons'
|
||||
- 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-buffer'
|
||||
name: 'cmp-buffer'
|
||||
- url: 'https://github.com/hrsh7th/cmp-path'
|
||||
name: 'cmp-path'
|
||||
- url: 'https://github.com/hrsh7th/cmp-omni'
|
||||
name: 'cmp-omni'
|
||||
- url: 'https://github.com/hrsh7th/cmp-nvim-lsp'
|
||||
name: 'cmp-nvim-lsp'
|
||||
- url: 'https://github.com/hrsh7th/cmp-nvim-lua'
|
||||
name: 'cmp-nvim-lua'
|
||||
- url: 'https://github.com/nvim-treesitter/nvim-treesitter'
|
||||
name: 'nvim-treesitter'
|
||||
version: master # main seems broken?
|
||||
- url: 'https://github.com/nvim-lua/plenary.nvim'
|
||||
name: 'plenary.nvim'
|
||||
- url: 'https://github.com/nvim-telescope/telescope-fzf-native.nvim'
|
||||
name: 'telescope-fzf-native.nvim'
|
||||
- url: 'https://github.com/nvim-telescope/telescope.nvim'
|
||||
name: 'telescope.nvim'
|
||||
version: '0.1.x'
|
||||
- url: 'https://github.com/L3MON4D3/LuaSnip'
|
||||
name: 'luasnip'
|
||||
version: 'v1.0.0'
|
||||
- url: 'https://github.com/lewis6991/gitsigns.nvim'
|
||||
name: 'gitsigns.nvim'
|
||||
version: 'v0.9.0'
|
||||
- url: 'https://github.com/nvim-lualine/lualine.nvim'
|
||||
name: 'lualine'
|
||||
- url: 'https://github.com/lukas-reineke/indent-blankline.nvim'
|
||||
name: 'indent-blankline.nvim'
|
||||
version: 'v3.7.2'
|
||||
- url: 'https://github.com/projekt0n/github-nvim-theme.git'
|
||||
name: 'github-colors'
|
||||
version: 'v1.1.2'
|
||||
- url: 'https://github.com/stevearc/conform.nvim.git'
|
||||
name: 'conform.nvim'
|
||||
version: 'v9.0.0'
|
||||
|
||||
language_servers: []
|
||||
4
group_vars/all/system.yml
Normal file
4
group_vars/all/system.yml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
xdg_config_dir: '{{ ansible_env.HOME }}/.config'
|
||||
xdg_data_dir: '{{ ansible_env.HOME }}/.local/share'
|
||||
|
||||
packages: []
|
||||
40
group_vars/arch/aur.yml
Normal file
40
group_vars/arch/aur.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
aur_packages:
|
||||
- url: 'https://aur.archlinux.org/nvm.git'
|
||||
name: 'nvm'
|
||||
package_name: 'nvm'
|
||||
version: '0.40.0-1'
|
||||
arch: 'any'
|
||||
|
||||
aur_build_dir: '/usr/local/src'
|
||||
python_build_dir: '/usr/local/src'
|
||||
python_install_dir: '/opt'
|
||||
|
||||
python_download_url: 'https://www.python.org/ftp/python'
|
||||
python_versions:
|
||||
- version: 3.12.9
|
||||
path: 'python3.12'
|
||||
binary: 'python3.12'
|
||||
|
||||
- version: 3.11.9
|
||||
path: 'python3.11'
|
||||
binary: 'python3.11'
|
||||
|
||||
- version: 3.10.0
|
||||
path: 'python3.10'
|
||||
binary: 'python3.10'
|
||||
|
||||
- version: 3.9.14
|
||||
path: 'python3.9'
|
||||
binary: 'python3.9'
|
||||
|
||||
- version: 3.8.14
|
||||
path: 'python3.8'
|
||||
binary: 'python3.8'
|
||||
|
||||
- version: 3.7.14
|
||||
path: 'python3.7'
|
||||
binary: 'python3.7'
|
||||
|
||||
- version: 3.6.15
|
||||
path: 'python3.6'
|
||||
binary: 'python3.6'
|
||||
48
group_vars/arch/neovim.yml
Normal file
48
group_vars/arch/neovim.yml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
language_servers:
|
||||
- package: ansible-language-server
|
||||
server_name: 'ansiblels'
|
||||
auto_setup: true
|
||||
|
||||
- package: typescript-language-server
|
||||
server_name: 'ts_ls'
|
||||
auto_setup: true
|
||||
|
||||
- package: vscode-json-languageserver
|
||||
server_name: 'jsonls'
|
||||
auto_setup: true
|
||||
|
||||
- package: vscode-css-languageserver
|
||||
server_name: 'cssls'
|
||||
auto_setup: true
|
||||
|
||||
- package: bash-language-server
|
||||
server_name: 'bashls'
|
||||
auto_setup: true
|
||||
|
||||
- package: marksman
|
||||
server_name: 'marksman'
|
||||
auto_setup: true
|
||||
|
||||
- package: esbonio
|
||||
server_name: 'esbonio'
|
||||
auto_setup: true
|
||||
|
||||
- package: lua-language-server
|
||||
server_name: 'lua_ls'
|
||||
auto_setup: false
|
||||
|
||||
- package: yaml-language-server
|
||||
server_name: 'yamlls'
|
||||
auto_setup: false
|
||||
|
||||
- package: vscode-html-languageserver
|
||||
server_name: 'html'
|
||||
auto_setup: false
|
||||
|
||||
- package: ruff-lsp
|
||||
server_name: 'ruff'
|
||||
auto_setup: false
|
||||
|
||||
- package: pyright
|
||||
server_name: 'pyright'
|
||||
auto_setup: false
|
||||
23
group_vars/arch/system.yml
Normal file
23
group_vars/arch/system.yml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
packages:
|
||||
- python
|
||||
- git
|
||||
- vim
|
||||
- neovim
|
||||
- python-pynvim
|
||||
- wl-clipboard
|
||||
- npm
|
||||
- docker
|
||||
- docker-compose
|
||||
- iptables-nft
|
||||
- fuse-overlayfs
|
||||
- ttf-ibm-plex
|
||||
- slirp4netns
|
||||
- tree-sitter
|
||||
- ripgrep
|
||||
- fd
|
||||
- uv
|
||||
- fakeroot
|
||||
- debugedit
|
||||
- which
|
||||
- gcc
|
||||
- make
|
||||
18
group_vars/debian/neovim.yml
Normal file
18
group_vars/debian/neovim.yml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# TODO: add lua language server, see https://github.com/LuaLS/lua-language-server?
|
||||
language_servers:
|
||||
- package: "@ansible/ansible-language-server"
|
||||
server_name: "ansiblels"
|
||||
auto_setup: true
|
||||
|
||||
- package: yaml-language-server
|
||||
server_name: "yamlls"
|
||||
auto_setup: false
|
||||
|
||||
- package: bash-language-server
|
||||
server_name: "bashls"
|
||||
auto_setup: true
|
||||
|
||||
neovim:
|
||||
version: "v0.11.4"
|
||||
install_path: "/opt/nvim"
|
||||
download_checksum: sha256:a74740047e73b2b380d63a474282814063d10650cd6cc95efa16d1713c7e616c
|
||||
7
group_vars/debian/system.yml
Normal file
7
group_vars/debian/system.yml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
packages:
|
||||
- python3
|
||||
- git
|
||||
- vim
|
||||
- npm
|
||||
- libtree-sitter0
|
||||
- ripgrep
|
||||
27
inventory.yml
Normal file
27
inventory.yml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
personal:
|
||||
hosts:
|
||||
xps: &xps
|
||||
ansible_connection: local
|
||||
ansible_become_method: community.general.run0
|
||||
desktop: &desktop
|
||||
ansible_connection: local
|
||||
ansible_become_method: community.general.run0
|
||||
htpc: &htpc
|
||||
ansible_connection: local
|
||||
ansible_become_method: community.general.run0
|
||||
fudiggity: &fudiggity
|
||||
ansible_connection: local
|
||||
|
||||
debian:
|
||||
hosts:
|
||||
fudiggity:
|
||||
<<: *fudiggity
|
||||
|
||||
arch:
|
||||
hosts:
|
||||
xps:
|
||||
<<: *xps
|
||||
desktop:
|
||||
<<: *desktop
|
||||
htpc:
|
||||
<<: *htpc
|
||||
94
playbook.yml
94
playbook.yml
|
|
@ -1,37 +1,71 @@
|
|||
- hosts: localhost
|
||||
- name: Development provisioning
|
||||
hosts:
|
||||
- personal
|
||||
- arch
|
||||
- debian
|
||||
pre_tasks:
|
||||
- name: load OS specific vars
|
||||
include_vars: '{{ item }}'
|
||||
with_first_found:
|
||||
- files:
|
||||
- '{{ ansible_distribution|lower }}-{{ ansible_distribution_release|lower }}.yml'
|
||||
- '{{ ansible_distribution|lower }}.yml'
|
||||
- '{{ ansible_os_family|lower }}.yml'
|
||||
paths:
|
||||
- 'vars/'
|
||||
- name: add gitlab to known hosts
|
||||
include_role:
|
||||
- name: Verifying that a limit is set
|
||||
ansible.builtin.fail:
|
||||
msg: 'This playbook cannot be run with no limit'
|
||||
run_once: true
|
||||
when: ansible_limit is not defined
|
||||
|
||||
- name: Install packages
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: '{{ item }}'
|
||||
state: present
|
||||
loop: '{{ packages }}'
|
||||
|
||||
- name: Add git forge to known hosts
|
||||
ansible.builtin.include_role:
|
||||
name: common
|
||||
tasks_from: 'known_hosts.yml'
|
||||
vars:
|
||||
user: '{{ ansible_user_id }}'
|
||||
items:
|
||||
- { domain: '{{ gitlab_domain }}', key: '{{ gitlab_host_key }}' }
|
||||
- name: install packages
|
||||
become: true
|
||||
package:
|
||||
name: '{{ item }}'
|
||||
state: present
|
||||
loop: '{{ packages }}'
|
||||
roles:
|
||||
- common
|
||||
- npm
|
||||
- domain: '{{ git_domain }}'
|
||||
key: '{{ git_host_key }}'
|
||||
when: ansible_hostname != 'fudiggity'
|
||||
tasks:
|
||||
- import_tasks: 'tasks/main.yml'
|
||||
- include_role:
|
||||
name: common
|
||||
tasks_from: 'poetry.yml'
|
||||
- import_tasks: 'tasks/dotfiles.yml'
|
||||
- import_tasks: 'tasks/coc.yml'
|
||||
vars_files:
|
||||
- 'vars/main.yml'
|
||||
- name: Setup dotfiles
|
||||
ansible.builtin.import_tasks: 'tasks/dotfiles.yml'
|
||||
tags: dotfiles
|
||||
|
||||
- name: Include generic neovim tasks
|
||||
ansible.builtin.import_tasks: 'tasks/neovim.yml'
|
||||
tags: neovim
|
||||
|
||||
- name: Include debian neovim tasks
|
||||
ansible.builtin.import_tasks: 'tasks/debian/neovim.yml'
|
||||
when: "'debian' in group_names"
|
||||
tags: neovim
|
||||
|
||||
- name: Provision Archlinux hosts
|
||||
when: "'arch' in group_names"
|
||||
block:
|
||||
- name: Gather package facts
|
||||
ansible.builtin.package_facts:
|
||||
manager: pacman
|
||||
|
||||
- name: Include arch neovim tasks
|
||||
ansible.builtin.import_tasks: 'tasks/arch/neovim.yml'
|
||||
when: "'arch' in group_names"
|
||||
tags: neovim
|
||||
|
||||
- name: Install AUR packages
|
||||
ansible.builtin.import_tasks: 'tasks/arch/aur.yml'
|
||||
tags: aur
|
||||
|
||||
- name: Setup docker
|
||||
ansible.builtin.import_tasks: 'tasks/arch/docker.yml'
|
||||
tags: docker
|
||||
|
||||
- name: Setup python versions
|
||||
ansible.builtin.include_tasks: 'tasks/arch/python.yml'
|
||||
loop: '{{ python_versions }}'
|
||||
tags: python
|
||||
|
||||
- name: Setup NVM
|
||||
ansible.builtin.import_tasks: 'tasks/arch/nvm.yml'
|
||||
tags: nvm
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
- src: git+https://git.fudiggity.nl/ansible/common.git
|
||||
- src: git+https://forgejo.fudiggity.nl/sonny/common-ansible.git
|
||||
name: common
|
||||
version: master
|
||||
scm: git
|
||||
- src: git+https://git.fudiggity.nl/ansible/npm.git
|
||||
name: npm
|
||||
version: master
|
||||
scm: git
|
||||
|
|
|
|||
53
tasks/arch/aur-package.yml
Normal file
53
tasks/arch/aur-package.yml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
- name: Set package directory
|
||||
ansible.builtin.set_fact:
|
||||
build_dir: '{{ aur_build_dir }}/{{ item.name }}'
|
||||
|
||||
- name: 'Retrieve package name for {{ item.name }}'
|
||||
command:
|
||||
argv:
|
||||
- grep
|
||||
- --only-matching
|
||||
- --perl-regexp
|
||||
- "(?<=pkgname=).*"
|
||||
- "{{ build_dir }}/PKGBUILD"
|
||||
register: pkg_name
|
||||
|
||||
- name: 'Retrieve package version for {{ item.name }}'
|
||||
command:
|
||||
argv:
|
||||
- grep
|
||||
- --only-matching
|
||||
- --perl-regexp
|
||||
- "(?<=pkgver=).*"
|
||||
- "{{ build_dir }}/PKGBUILD"
|
||||
register: pkg_version
|
||||
|
||||
- name: 'Retrieve package release for {{ item.name }}'
|
||||
command:
|
||||
argv:
|
||||
- grep
|
||||
- --only-matching
|
||||
- --perl-regexp
|
||||
- "(?<=pkgrel=).*"
|
||||
- "{{ build_dir }}/PKGBUILD"
|
||||
register: pkg_release
|
||||
|
||||
- name: Set package filename & version
|
||||
ansible.builtin.set_fact:
|
||||
package_filename: '{{ pkg_name.stdout }}-{{ pkg_version.stdout }}-{{ pkg_release.stdout }}-{{ item.arch }}.pkg.tar.zst'
|
||||
installed_version: ansible_facts.packages[item.package_name].version|default('')
|
||||
|
||||
- name: 'Build package {{ item.name }}'
|
||||
ansible.builtin.command: 'makepkg --syncdeps --rmdeps --clean --noconfirm --force'
|
||||
args:
|
||||
chdir: '{{ build_dir }}'
|
||||
creates: '{{ build_dir }}/{{ package_filename }}'
|
||||
register: package_build
|
||||
when: item.version != installed_version
|
||||
|
||||
- name: 'Install {{ item.name }}'
|
||||
become: true
|
||||
community.general.pacman:
|
||||
name: '{{ build_dir }}/{{ package_filename }}'
|
||||
state: present
|
||||
when: item.version != installed_version
|
||||
26
tasks/arch/aur.yml
Normal file
26
tasks/arch/aur.yml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
- name: Retrieve directory stats
|
||||
ansible.builtin.stat:
|
||||
path: '{{ aur_build_dir }}/{{ item.name }}'
|
||||
loop: '{{ aur_packages }}'
|
||||
|
||||
- name: Clone aur packages
|
||||
become: true
|
||||
ansible.builtin.git:
|
||||
repo: '{{ item.url }}'
|
||||
dest: '{{ aur_build_dir }}/{{ item.name }}'
|
||||
update: true
|
||||
loop: '{{ aur_packages }}'
|
||||
|
||||
- name: Change aur package directories owner
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: '{{ aur_build_dir }}/{{ item.name }}'
|
||||
state: directory
|
||||
owner: '{{ ansible_user_id }}'
|
||||
group: '{{ ansible_user_id }}'
|
||||
recurse: true
|
||||
loop: '{{ aur_packages }}'
|
||||
|
||||
- name: Build & install aur packages
|
||||
ansible.builtin.include_tasks: 'tasks/arch/aur-package.yml'
|
||||
loop: '{{ aur_packages }}'
|
||||
66
tasks/arch/docker.yml
Normal file
66
tasks/arch/docker.yml
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
- name: Remove docker mapping files
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
state: absent
|
||||
loop:
|
||||
- /etc/subgid
|
||||
- /etc/subuid
|
||||
|
||||
- name: Setup desktop configuration
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: 'files/desktop/docker-daemon.json'
|
||||
dest: '/etc/docker/daemon.json'
|
||||
mode: '0755'
|
||||
when: ansible_hostname == 'desktop'
|
||||
|
||||
- name: Remove user setup desktop configuration
|
||||
ansible.builtin.file:
|
||||
path: '{{ xdg_config_dir }}/docker/daemon.json'
|
||||
state: absent
|
||||
when: ansible_hostname == 'desktop'
|
||||
|
||||
- name: Check for .bashrc.override
|
||||
ansible.builtin.stat:
|
||||
path: '{{ ansible_env.HOME }}/.bashrc.override'
|
||||
register: bashrc_override
|
||||
|
||||
- name: Create .bashrc.override
|
||||
ansible.builtin.file:
|
||||
path: '{{ ansible_env.HOME }}/.bashrc.override'
|
||||
state: touch
|
||||
mode: '0755'
|
||||
when: not bashrc_override.stat.exists
|
||||
|
||||
- name: Remove rootless DOCKER_HOST variable assignment
|
||||
ansible.builtin.lineinfile:
|
||||
path: '{{ ansible_env.HOME }}/.bashrc.override'
|
||||
regexp: '^export DOCKER_HOST='
|
||||
line: ''
|
||||
|
||||
- name: Disable user docker socket
|
||||
ansible.builtin.systemd:
|
||||
name: '{{ item }}'
|
||||
state: stopped
|
||||
enabled: false
|
||||
scope: user
|
||||
daemon_reload: true
|
||||
register: disable_stats
|
||||
ignore_errors: true # TODO: add better error handling
|
||||
loop:
|
||||
- docker.socket
|
||||
- docker.service
|
||||
|
||||
- name: Remove docker rootless package
|
||||
become: true
|
||||
ansible.builtin.package:
|
||||
name: docker-rootless-extras
|
||||
state: absent
|
||||
|
||||
- name: Enable system docker socket
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: docker.socket
|
||||
state: started
|
||||
enabled: true
|
||||
6
tasks/arch/neovim.yml
Normal file
6
tasks/arch/neovim.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
- name: Install language servers
|
||||
become: true
|
||||
community.general.pacman:
|
||||
name: '{{ item }}'
|
||||
state: present
|
||||
loop: '{{ language_servers | map(attribute="package") | list }}'
|
||||
15
tasks/arch/nvm.yml
Normal file
15
tasks/arch/nvm.yml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
- name: Set NVM install directory
|
||||
ansible.builtin.set_fact:
|
||||
install_dir: '{{ xdg_config_dir }}/nvm'
|
||||
|
||||
- name: Remove manually installed nvm install directory
|
||||
ansible.builtin.file:
|
||||
path: '{{ install_dir }}'
|
||||
state: absent
|
||||
|
||||
- name: Remove nvm entry from bashrc
|
||||
ansible.builtin.lineinfile:
|
||||
path: '{{ ansible_env.HOME }}/.bashrc.override'
|
||||
line: >
|
||||
[ -s "{{ install_dir }}/nvm.sh" ] && \. "{{ install_dir }}/nvm.sh" # This loads nvm
|
||||
state: absent
|
||||
65
tasks/arch/python.yml
Normal file
65
tasks/arch/python.yml
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
- name: 'check for {{ item.binary }} binary'
|
||||
command: 'which {{ item.binary }}'
|
||||
changed_when: false
|
||||
failed_when: python_installed.rc not in [ 0, 1 ]
|
||||
register: python_installed
|
||||
|
||||
- name: 'check for {{ item.binary }} download'
|
||||
stat:
|
||||
path: '{{ python_build_dir }}/python-{{ item.version }}.tgz'
|
||||
register: python_download
|
||||
|
||||
- block:
|
||||
# TODO: verify for checksum
|
||||
- name: 'retrieve python {{ item.version }} source'
|
||||
become: true
|
||||
get_url:
|
||||
url: '{{ python_download_url }}/{{ item.version }}/Python-{{ item.version }}.tgz'
|
||||
dest: '{{ python_build_dir }}/python-{{ item.version }}.tgz'
|
||||
owner: '{{ ansible_user_id }}'
|
||||
group: '{{ ansible_user_id }}'
|
||||
when: not python_download.stat.exists
|
||||
|
||||
- name: 'extract python {{ item.version }} sources'
|
||||
become: true
|
||||
unarchive:
|
||||
src: '{{ python_build_dir }}/python-{{ item.version }}.tgz'
|
||||
dest: '{{ python_build_dir }}'
|
||||
include: 'Python-{{ item.version }}'
|
||||
|
||||
- name: rename source directory
|
||||
become: true
|
||||
ansible.builtin.command: 'mv {{ python_build_dir}}/Python-{{ item.version }} {{ python_build_dir }}/{{ item.path }}'
|
||||
|
||||
- name: set correct permissions
|
||||
become: true
|
||||
file:
|
||||
path: '{{ python_build_dir }}/{{ item.path }}'
|
||||
recurse: true
|
||||
owner: '{{ ansible_user_id }}'
|
||||
group: '{{ ansible_user_id }}'
|
||||
state: directory
|
||||
|
||||
- name: configure build
|
||||
ansible.builtin.command: 'sh ./configure --prefix={{ python_install_dir }}/{{ item.path }}'
|
||||
args:
|
||||
chdir: '{{ python_build_dir }}/{{ item.path }}/'
|
||||
|
||||
- name: make build
|
||||
ansible.builtin.command: 'make'
|
||||
args:
|
||||
chdir: '{{ python_build_dir }}/{{ item.path }}/'
|
||||
|
||||
- name: install build
|
||||
become: true
|
||||
ansible.builtin.command: 'make install'
|
||||
args:
|
||||
chdir: '{{ python_build_dir }}/{{ item.path }}/'
|
||||
|
||||
- name: 'create symlink for python {{ item.version }}'
|
||||
become: true
|
||||
file:
|
||||
src: '{{ python_install_dir }}/{{ item.path }}/bin/{{ item.binary }}'
|
||||
dest: '/usr/bin/{{ item.binary }}'
|
||||
state: link
|
||||
when: python_installed.rc not in [ 0 ]
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
- name: install coc.nvim node packages
|
||||
npm:
|
||||
path: '{{ xdg_data_dir }}/nvim/site/pack/default/start/coc.nvim'
|
||||
state: present
|
||||
global: false
|
||||
|
||||
- name: create default coc.nvim venv directory
|
||||
file:
|
||||
path: '{{ ansible_env.HOME }}/.local/lib/coc'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: copy coc pyproject.toml
|
||||
template:
|
||||
src: 'pyproject.j2'
|
||||
dest: '{{ ansible_env.HOME }}/.local/lib/coc/pyproject.toml'
|
||||
mode: '0644'
|
||||
force: false
|
||||
|
||||
- name: set default venv python version
|
||||
command: 'poetry env use python3'
|
||||
args:
|
||||
chdir: '{{ ansible_env.HOME }}/.local/lib/coc'
|
||||
environment:
|
||||
PATH: '{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}'
|
||||
when: ansible_distribution == "Debian"
|
||||
|
||||
- name: install default coc.nvim python packages # noqa 301
|
||||
command: 'poetry install'
|
||||
args:
|
||||
chdir: '{{ ansible_env.HOME }}/.local/lib/coc'
|
||||
environment:
|
||||
PATH: '{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}'
|
||||
57
tasks/debian/neovim.yml
Normal file
57
tasks/debian/neovim.yml
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
- name: Install language servers on debian hosts
|
||||
become: true
|
||||
community.general.npm:
|
||||
name: '{{ item }}'
|
||||
global: true
|
||||
loop: '{{ language_servers | map(attribute="package") | list }}'
|
||||
|
||||
- name: Create neovim install directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
path: '{{ neovim.install_path }}'
|
||||
owner: '{{ ansible_user_id }}'
|
||||
group: '{{ ansible_user_gid }}'
|
||||
mode: '0755'
|
||||
|
||||
- name: Register the current neovim version
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- '{{ neovim.install_path }}/bin/nvim'
|
||||
- '--version'
|
||||
register: neovim_stats
|
||||
changed_when: false
|
||||
ignore_errors: true
|
||||
|
||||
- name: Parse the current neovim version
|
||||
ansible.builtin.set_fact:
|
||||
neovim_installed_version: neovim_stats.stdout_lines[0] | regex_search('(v\d+\.\d+\.\d+)')
|
||||
when: neovim_stats.rc == 0
|
||||
|
||||
- name: Download neovim {{ neovim.version }}
|
||||
ansible.builtin.get_url:
|
||||
url: 'https://github.com/neovim/neovim/releases/download/{{ neovim.version }}/nvim-linux-x86_64.tar.gz'
|
||||
dest: /tmp/nvim-linux64.tar.gz
|
||||
mode: '0755'
|
||||
checksum: '{{ neovim.download_checksum }}'
|
||||
when: neovim_stats.rc > 0 or neovim_installed_version != neovim.version
|
||||
register: neovim_download
|
||||
|
||||
- name: Extract downloaded neovim version
|
||||
ansible.builtin.unarchive:
|
||||
src: /tmp/nvim-linux64.tar.gz
|
||||
dest: '{{ neovim.install_path }}'
|
||||
extra_opts:
|
||||
- '--strip-components=1'
|
||||
- '--show-stored-names'
|
||||
- '--overwrite'
|
||||
when: |
|
||||
neovim_download.state == 'file'
|
||||
and (neovim_installed_version is undefined or neovim_installed_version != neovim.version)
|
||||
|
||||
- name: Add neovim to PATH
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: 'templates/debian/nvim.profile.j2'
|
||||
dest: '/etc/profile.d/neovim.sh'
|
||||
mode: '0755'
|
||||
|
|
@ -1,52 +1,69 @@
|
|||
- name: clone dotfiles
|
||||
git:
|
||||
- name: Clone dotfiles
|
||||
ansible.builtin.git:
|
||||
repo: '{{ dotfiles_repo }}'
|
||||
dest: '{{ ansible_env.HOME }}/dotfiles'
|
||||
version: master
|
||||
update: yes
|
||||
update: true
|
||||
|
||||
- name: create dotfile folders
|
||||
file:
|
||||
- name: Create xdg configuration directories
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: '{{ item }}'
|
||||
loop:
|
||||
- '{{ xdg_config_dir }}/nvim'
|
||||
- '{{ xdg_data_dir }}/nvim/site'
|
||||
- '{{ xdg_config_dir }}/kitty'
|
||||
- '{{ xdg_config_dir }}/git'
|
||||
- '{{ xdg_config_dir }}/tmux'
|
||||
|
||||
- name: setup dotfiles
|
||||
file:
|
||||
- name: Remove previous dotfiles
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
state: absent
|
||||
loop:
|
||||
- '{{ ansible_env.HOME }}/.tmux.conf'
|
||||
- '{{ ansible_env.HOME }}/.gitconfig'
|
||||
|
||||
- name: Setup dotfiles
|
||||
ansible.builtin.file:
|
||||
path: '{{ item.dest }}'
|
||||
src: '{{ item.src }}'
|
||||
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',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.bashrc',
|
||||
dest: '{{ ansible_env.HOME }}/.bashrc',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.profile',
|
||||
dest: '{{ ansible_env.HOME }}/.profile',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/nvim/colors',
|
||||
dest: '{{ xdg_data_dir }}/nvim/site/colors',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/kitty.conf',
|
||||
dest: '{{ xdg_config_dir }}/kitty/kitty.conf',
|
||||
}
|
||||
- {
|
||||
src: '{{ ansible_env.HOME }}/dotfiles/.gitignore',
|
||||
dest: '{{ ansible_env.HOME }}/.gitignore',
|
||||
}
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.vimrc'
|
||||
dest: '{{ ansible_env.HOME }}/.vimrc'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.bashrc'
|
||||
dest: '{{ ansible_env.HOME }}/.bashrc'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.profile'
|
||||
dest: '{{ ansible_env.HOME }}/.profile'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/tmux/tmux.conf'
|
||||
dest: '{{ xdg_config_dir }}/tmux/tmux.conf'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/tmux/light.conf'
|
||||
dest: '{{ xdg_config_dir }}/tmux/light.conf'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/tmux/dark.conf'
|
||||
dest: '{{ xdg_config_dir }}/tmux/dark.conf'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.gitignore'
|
||||
dest: '{{ xdg_config_dir }}/git/ignore'
|
||||
|
||||
- name: Copy git configuration
|
||||
ansible.builtin.template:
|
||||
src: 'templates/gitconfig.j2'
|
||||
dest: '{{ xdg_config_dir }}/git/config'
|
||||
mode: '0755'
|
||||
|
||||
- name: Create script directory
|
||||
ansible.builtin.file:
|
||||
path: '{{ ansible_env.HOME }}/.local/bin'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy tmux toggle script
|
||||
ansible.builtin.template:
|
||||
src: 'templates/tmux-toggle.j2'
|
||||
dest: '{{ ansible_env.HOME }}/.local/bin/tmux-toggle.sh'
|
||||
mode: '0755'
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
- name: create development dir
|
||||
file:
|
||||
path: '{{ ansible_env.HOME }}/development'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: clone git hooks
|
||||
git:
|
||||
repo: '{{ githook_repo }}'
|
||||
dest: '{{ ansible_env.HOME }}/development/git-hooks'
|
||||
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 }}'
|
||||
125
tasks/neovim.yml
Normal file
125
tasks/neovim.yml
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
- name: Ensure neovim configuration directories exist
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
state: directory
|
||||
mode: '0755'
|
||||
loop:
|
||||
- '{{ xdg_config_dir }}/nvim/'
|
||||
- '{{ xdg_config_dir }}/nvim/lua'
|
||||
- '{{ xdg_config_dir }}/nvim/after'
|
||||
- '{{ xdg_config_dir }}/nvim/after/ftplugin'
|
||||
- '{{ 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: Remove old neovim packages
|
||||
ansible.builtin.file:
|
||||
path: '{{ item }}'
|
||||
state: absent
|
||||
loop:
|
||||
- '{{ xdg_data_dir }}/nvim/site/pack/default/start/catpuccin'
|
||||
- '{{ xdg_data_dir }}/nvim/site/pack/default/start/vim-colors-xcode'
|
||||
|
||||
# Note that helptags may need to be regenerated (see `:h helptags`)
|
||||
- name: Clone neovim packages
|
||||
ansible.builtin.git:
|
||||
repo: '{{ item.url }}'
|
||||
dest: '{{ xdg_data_dir }}/nvim/site/pack/default/start/{{ item.name }}'
|
||||
update: true
|
||||
version: '{{ item.version | default("HEAD") }}'
|
||||
force: true # some maintainers overwrite existing tags :/
|
||||
loop: '{{ neovim_plugins }}'
|
||||
|
||||
- name: Install neovim node package
|
||||
become: true
|
||||
community.general.npm:
|
||||
name: neovim
|
||||
global: true
|
||||
|
||||
- name: Remove old neovim configuration file
|
||||
ansible.builtin.file:
|
||||
path: '{{ xdg_config_dir }}/nvim/init.vim'
|
||||
state: absent
|
||||
|
||||
- name: Remove coc.nvim extension
|
||||
ansible.builtin.file:
|
||||
path: '{{ xdg_data_dir }}/nvim/site/pack/default/start/coc.nvim'
|
||||
state: absent
|
||||
|
||||
- name: Setup neovim configuration files
|
||||
ansible.builtin.template:
|
||||
dest: '{{ item.dest }}'
|
||||
src: '{{ item.src }}'
|
||||
mode: '0755'
|
||||
loop:
|
||||
- src: 'templates/nvim/ftplugin/bash.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/bash.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/css.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/css.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/html.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/html.lua'
|
||||
- src: 'templates/nvim/ftplugin/htmldjango.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/htmldjango.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/javascript.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/javascript.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/json.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/json.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/lua.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/lua.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/python.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/python.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/scss.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/scss.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/sh.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/sh.lua'
|
||||
|
||||
- src: 'templates/nvim/ftplugin/yaml.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/yaml.lua'
|
||||
|
||||
- src: 'templates/nvim/init.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/init.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/lsp.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/lsp.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/options.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/options.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/tree-sitter.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/tree-sitter.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/git-signs.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/git-signs.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/lua-line.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/lua-line.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/telescope.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/_telescope.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/indent-blankline.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/indent-blankline.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/nvim-tree.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/_nvim-tree.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/colorscheme.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/colorscheme.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/source-link.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/_source-link.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/filetype.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/_filetype.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/diagnostic.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/diagnostic.lua'
|
||||
3
templates/debian/nvim.profile.j2
Normal file
3
templates/debian/nvim.profile.j2
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
PATH="{{ neovim.install_path }}/bin:$PATH"
|
||||
54
templates/gitconfig.j2
Normal file
54
templates/gitconfig.j2
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[user]
|
||||
email = {{ git_email }}
|
||||
name = {{ git_name }}
|
||||
|
||||
[core]
|
||||
editor = nvim
|
||||
{% if ansible_facts['os_family'] == 'Archlinux' %}
|
||||
pager = delta
|
||||
{% endif %}
|
||||
|
||||
{% if ansible_facts['os_family'] == 'Archlinux' %}
|
||||
[interactive]
|
||||
diffFilter = delta --color-only
|
||||
{% endif %}
|
||||
|
||||
[init]
|
||||
defaultBranch = main
|
||||
|
||||
[commit]
|
||||
verbose = true
|
||||
|
||||
[push]
|
||||
default = simple
|
||||
autoSetupRemote = true
|
||||
|
||||
[pull]
|
||||
rebase = false
|
||||
|
||||
[fetch]
|
||||
prune = true
|
||||
pruneTags = true
|
||||
all = true
|
||||
|
||||
[merge]
|
||||
tool = nvimdiff
|
||||
conflictstyle = zdiff3
|
||||
|
||||
[diff]
|
||||
colorMoved = default
|
||||
mnemonicPrefix = true
|
||||
renames = true
|
||||
|
||||
[help]
|
||||
autocorrect = prompt
|
||||
|
||||
{% if ansible_facts['os_family'] == 'Archlinux' %}
|
||||
[delta]
|
||||
navigate = true
|
||||
hyperlinks = true
|
||||
line-numbers = true
|
||||
map-styles = bold purple => syntax magenta, bold cyan => syntax blue, bold yellow => syntax yellow
|
||||
{% endif %}
|
||||
7
templates/nvim/ftplugin/bash.lua.j2
Normal file
7
templates/nvim/ftplugin/bash.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/css.lua.j2
Normal file
7
templates/nvim/ftplugin/css.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/html.lua.j2
Normal file
7
templates/nvim/ftplugin/html.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/htmldjango.lua.j2
Normal file
7
templates/nvim/ftplugin/htmldjango.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/javascript.lua.j2
Normal file
7
templates/nvim/ftplugin/javascript.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/json.lua.j2
Normal file
7
templates/nvim/ftplugin/json.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/lua.lua.j2
Normal file
7
templates/nvim/ftplugin/lua.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/python.lua.j2
Normal file
7
templates/nvim/ftplugin/python.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/scss.lua.j2
Normal file
7
templates/nvim/ftplugin/scss.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/sh.lua.j2
Normal file
7
templates/nvim/ftplugin/sh.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
7
templates/nvim/ftplugin/yaml.lua.j2
Normal file
7
templates/nvim/ftplugin/yaml.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.autoindent = true
|
||||
14
templates/nvim/init.lua.j2
Normal file
14
templates/nvim/init.lua.j2
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
require('options')
|
||||
require('_filetype')
|
||||
require('colorscheme')
|
||||
require('lsp')
|
||||
require('tree-sitter')
|
||||
require('git-signs')
|
||||
require('_telescope')
|
||||
require('indent-blankline')
|
||||
require('_nvim-tree')
|
||||
require('lua-line')
|
||||
require('_source-link')
|
||||
require('diagnostic')
|
||||
100
templates/nvim/lua/colorscheme.lua.j2
Normal file
100
templates/nvim/lua/colorscheme.lua.j2
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local background_callback = function()
|
||||
if vim.o.background == 'dark' then
|
||||
vim.cmd('colorscheme github_dark_dimmed')
|
||||
else
|
||||
vim.cmd('colorscheme github_light_tritanopia')
|
||||
end
|
||||
|
||||
-- force a full redraw:
|
||||
vim.cmd('mode')
|
||||
end
|
||||
|
||||
-- set the colorscheme whenever the background setting changes
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'OptionSet' },
|
||||
{ pattern = { 'background' }, callback = background_callback }
|
||||
)
|
||||
|
||||
|
||||
{% if ansible_facts['os_family'] == 'Debian' %}
|
||||
background_callback()
|
||||
{% endif %}
|
||||
|
||||
{% if ansible_facts['os_family'] == 'Archlinux' %}
|
||||
--[[
|
||||
Use `busctl --user tree` to show a tree of available services.
|
||||
Use the `Introspect` option to inspect available options:
|
||||
|
||||
dbus-send \
|
||||
--session \
|
||||
--print-reply \
|
||||
--reply-timeout=2000 \
|
||||
--type=method_call \
|
||||
--dest=org.freedesktop.portal.Desktop \
|
||||
/org/freedesktop/portal/desktop \
|
||||
org.freedesktop.DBus.Introspectable.Introspect
|
||||
|
||||
--]]
|
||||
local oneshot = {
|
||||
'dbus-send',
|
||||
'--session',
|
||||
'--print-reply',
|
||||
'--reply-timeout=2000',
|
||||
'--type=method_call',
|
||||
'--dest=org.freedesktop.portal.Desktop',
|
||||
'/org/freedesktop/portal/desktop',
|
||||
'org.freedesktop.portal.Settings.ReadOne',
|
||||
'string:org.freedesktop.appearance',
|
||||
'string:color-scheme'
|
||||
}
|
||||
|
||||
local set_background = vim.schedule_wrap(
|
||||
function(object)
|
||||
local default_background = 'light'
|
||||
|
||||
if object.code ~= 0 then
|
||||
print(string.format('An error occured: \n %s', object.stderr))
|
||||
vim.api.nvim_command(string.format('set background=%s', default_background))
|
||||
end
|
||||
|
||||
local colorscheme_output = tonumber(string.match(object.stdout, 'uint32 (%d)'))
|
||||
|
||||
if colorscheme_output == 1 then
|
||||
vim.api.nvim_command('set background=dark')
|
||||
elseif colorscheme_output == 2 then
|
||||
vim.api.nvim_command('set background=light')
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
vim.schedule(
|
||||
function() vim.system(oneshot, { text = true }, set_background) end
|
||||
)
|
||||
|
||||
-- Note that the last argument is a match rule,
|
||||
-- see https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules.
|
||||
local monitor_command = {
|
||||
'dbus-monitor',
|
||||
'--session',
|
||||
'path=/org/freedesktop/portal/desktop,' ..
|
||||
'interface=org.freedesktop.portal.Settings,' ..
|
||||
'member=SettingChanged,' ..
|
||||
'arg0=org.freedesktop.appearance,'..
|
||||
'arg1=color-scheme'
|
||||
}
|
||||
|
||||
local detect_scheme_change = function(channel_id, data, name)
|
||||
local line = table.concat(data)
|
||||
local match_output = tonumber(string.match(line, "uint32 (%d)"))
|
||||
|
||||
if match_output == 1 then
|
||||
vim.api.nvim_command('set background=dark')
|
||||
elseif match_output == 2 then
|
||||
vim.api.nvim_command('set background=light')
|
||||
end
|
||||
end
|
||||
|
||||
vim.fn.jobstart(monitor_command, { on_stdout = detect_scheme_change } )
|
||||
{% endif %}
|
||||
11
templates/nvim/lua/diagnostic.lua.j2
Normal file
11
templates/nvim/lua/diagnostic.lua.j2
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
vim.diagnostic.config {
|
||||
float = {
|
||||
suffix = function(diagnostic)
|
||||
return (' %s | [%s]'):format(diagnostic.code, diagnostic.source)
|
||||
end
|
||||
},
|
||||
|
||||
virtual_text = { current_line = true }
|
||||
}
|
||||
42
templates/nvim/lua/filetype.lua.j2
Normal file
42
templates/nvim/lua/filetype.lua.j2
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
local ansible_keywords = {
|
||||
'hosts',
|
||||
'tasks',
|
||||
'vars',
|
||||
'vars_files',
|
||||
'vars_prompt',
|
||||
'handlers',
|
||||
'roles',
|
||||
'import_tasks',
|
||||
'import_playbook',
|
||||
'import_role',
|
||||
}
|
||||
|
||||
vim.filetype.add {
|
||||
pattern = {
|
||||
['playbook*.y(a?)ml'] = 'yaml.ansible',
|
||||
['site*.y(a?)ml'] = 'yaml.ansible',
|
||||
['inventory*.y(a?)ml'] = 'yaml.ansible',
|
||||
['task*.y(a?)ml'] = 'yaml.ansible',
|
||||
['requirement*.y(a?)ml'] = 'yaml.ansible',
|
||||
|
||||
|
||||
['.*/tasks/.*.y(a?)ml'] = 'yaml.ansible',
|
||||
['.*/vars/.*.y(a?)ml'] = 'yaml.ansible',
|
||||
['.*/host_vars/.*.y(a?)ml'] = 'yaml.ansible',
|
||||
['.*/group_vars/.*.y(a?)ml'] = 'yaml.ansible',
|
||||
['.*/playbooks/.*.y(a?)ml'] = 'yaml.ansible',
|
||||
|
||||
['*.ansible.y(a?)ml'] = 'yaml.ansible',
|
||||
|
||||
['.*.y(a?)ml'] = {
|
||||
function(path, bufnr)
|
||||
local content = vim.api.nvim_buf_get_lines(bufnr, 0, 1, false)[1] or ''
|
||||
|
||||
for _, keyword in pairs(ansible_keywords) do
|
||||
local pattern = string.format('^- %s:', keyword)
|
||||
if content:match(pattern) then return 'yaml.ansible' end
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
7
templates/nvim/lua/git-signs.lua.j2
Normal file
7
templates/nvim/lua/git-signs.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local gitsigns = require('gitsigns');
|
||||
|
||||
gitsigns.setup({
|
||||
numhl = true;
|
||||
})
|
||||
10
templates/nvim/lua/indent-blankline.lua.j2
Normal file
10
templates/nvim/lua/indent-blankline.lua.j2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local indent_blankline = require("ibl");
|
||||
|
||||
indent_blankline.setup {
|
||||
scope = {
|
||||
show_start = false,
|
||||
show_end = false,
|
||||
}
|
||||
}
|
||||
198
templates/nvim/lua/lsp.lua.j2
Normal file
198
templates/nvim/lua/lsp.lua.j2
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
--use an on_attach function to only map the following keys
|
||||
--after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local opts = { buffer = bufnr, noremap = true, silent = true }
|
||||
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>la', vim.lsp.buf.code_action, opts)
|
||||
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
end
|
||||
|
||||
--enable some language servers with the additional completion capabilities
|
||||
--offered by nvim-cmp
|
||||
local auto_setup_servers = {
|
||||
{% for item in language_servers %}
|
||||
{% if item.auto_setup and not loop.last %}
|
||||
'{{ item.server_name }}',
|
||||
{% elif item.auto_setup %}
|
||||
'{{ item.server_name }}'
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
--add additional capabilities supported by nvim-cmp
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
for _, lsp in ipairs(auto_setup_servers) do
|
||||
vim.lsp.config[lsp] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
local util = require('lspconfig/util')
|
||||
|
||||
{% if ansible_facts.os_family == 'Archlinux' %}
|
||||
local python_root_dir = function(fname)
|
||||
return util.root_pattern('.git', 'setup.cfg', 'requirements')(fname) or
|
||||
util.path.dirname(fname)
|
||||
end
|
||||
|
||||
vim.lsp.config['ruff'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = python_root_dir
|
||||
}
|
||||
|
||||
|
||||
vim.lsp.config['pyright'] = {
|
||||
settings = {
|
||||
pyright = {
|
||||
-- Using Ruff's import organizer
|
||||
disableOrganizeImports = true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
local snippet_capabilities = vim.deepcopy(capabilities);
|
||||
snippet_capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
vim.lsp.config['html'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
filetypes = { 'html', 'htmldjango' },
|
||||
settings = {
|
||||
html = {
|
||||
format = {
|
||||
templating = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vim.lsp.config['cssls'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
}
|
||||
|
||||
vim.lsp.config['jsonls'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
}
|
||||
|
||||
vim.lsp.config['lua_ls'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
vim.lsp.config['yamlls'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
filetypes = { 'yaml', 'yaml.ansible', 'yaml.docker-compose', 'yaml.gitlab' }
|
||||
}
|
||||
|
||||
local servers = {
|
||||
{% for item in language_servers %}
|
||||
{% if not loop.last %}
|
||||
'{{ item.server_name }}',
|
||||
{% else %}
|
||||
'{{ item.server_name }}'
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
vim.lsp.enable { unpack(servers) }
|
||||
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
cmp.setup {
|
||||
sources = {
|
||||
{ name = 'nvim_lsp', },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'nvim_lua' },
|
||||
{
|
||||
name = 'omni',
|
||||
option = {
|
||||
disable_omnifuncs = { 'v:lua.vim.lsp.omnifunc' }
|
||||
}
|
||||
},
|
||||
{ name = 'luasnip', }, -- TODO: add snippets
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
if entry.source.name == 'nvim_lsp' then
|
||||
vim_item.menu = string.format('[%s]', entry.source.source.client.name)
|
||||
else
|
||||
vim_item.menu = string.format('[%s]', entry.source.name)
|
||||
end
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['S-<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
}
|
||||
50
templates/nvim/lua/lua-line.lua.j2
Normal file
50
templates/nvim/lua/lua-line.lua.j2
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local lualine = require('lualine');
|
||||
|
||||
local function active_lsps()
|
||||
local buffer = vim.api.nvim_get_current_buf()
|
||||
local attached_clients = vim.lsp.get_clients({ bufnr = buffer })
|
||||
|
||||
if #attached_clients == 0 then return 'LSP: 0' end
|
||||
|
||||
local preview_client = attached_clients[1]
|
||||
|
||||
return ('LSP: %s (%d)'):format(preview_client.name, #attached_clients)
|
||||
end
|
||||
|
||||
local function diff_source()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
lualine.setup {
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {
|
||||
{'b:gitsigns_head', icon = ''},
|
||||
{'diff', source = diff_source},
|
||||
'diagnostics',
|
||||
active_lsps
|
||||
},
|
||||
lualine_c = {
|
||||
{
|
||||
'filename',
|
||||
path = 1,
|
||||
}
|
||||
},
|
||||
lualine_x = {
|
||||
'encoding',
|
||||
'fileformat',
|
||||
'filetype'
|
||||
},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
}
|
||||
39
templates/nvim/lua/nvim-tree.lua.j2
Normal file
39
templates/nvim/lua/nvim-tree.lua.j2
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local nvim_tree = require('nvim-tree');
|
||||
local nvim_tree_icons = require('nvim-web-devicons');
|
||||
local api = require('nvim-tree.api')
|
||||
|
||||
local function toggle_tree()
|
||||
api.tree.toggle({ find_file = true, update_root = true, focus = true })
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<C-E>', toggle_tree, { noremap = true, silent = true })
|
||||
|
||||
local function my_on_attach(bufnr)
|
||||
local function opts(desc)
|
||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<C-]>', api.tree.change_root_to_node, opts('CD'))
|
||||
vim.keymap.set('n', '<C-H>', api.tree.toggle_hidden_filter, opts('Toggle filter: Dotfiles'))
|
||||
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
|
||||
vim.keymap.set('n', 'E', api.tree.expand_all, opts('Expand All'))
|
||||
vim.keymap.set('n', 'F', api.live_filter.clear, opts('Live filter: Clear'))
|
||||
vim.keymap.set('n', 'f', api.live_filter.start, opts('Live filter: Start'))
|
||||
vim.keymap.set('n', 'g?', api.tree.toggle_help, opts('Help'))
|
||||
vim.keymap.set('n', 'I', api.tree.toggle_gitignore_filter, opts('Toggle filter: Git Ignore'))
|
||||
vim.keymap.set('n', 'm', api.marks.toggle, opts('Toggle bookmark'))
|
||||
vim.keymap.set('n', 'q', api.tree.close, opts('Close'))
|
||||
vim.keymap.set('n', 'R', api.tree.reload, opts('Refresh'))
|
||||
vim.keymap.set('n', 'S', api.tree.search_node, opts('Search'))
|
||||
vim.keymap.set('n', 'a', api.fs.create, opts('Create a file'))
|
||||
vim.keymap.set("n", "r", api.fs.rename, opts("Rename"))
|
||||
vim.keymap.set('n', 'd', api.fs.remove, opts('Delete a file'))
|
||||
end
|
||||
|
||||
nvim_tree.setup {
|
||||
on_attach = my_on_attach,
|
||||
}
|
||||
|
||||
nvim_tree_icons.setup();
|
||||
66
templates/nvim/lua/options.lua.j2
Normal file
66
templates/nvim/lua/options.lua.j2
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
-- fix different locale settings when ssh'ing
|
||||
vim.o.encoding = 'utf-8'
|
||||
|
||||
vim.o.syntax = 'on'
|
||||
|
||||
-- display all matching files when we tab complete
|
||||
vim.o.wildmenu = true
|
||||
|
||||
-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
-- delays and poor user experience.
|
||||
vim.o.updatetime = 300
|
||||
|
||||
vim.o.splitright = true
|
||||
vim.o.splitbelow = true
|
||||
|
||||
-- switch buffers without writing to file
|
||||
vim.o.hidden = true
|
||||
|
||||
-- folding
|
||||
vim.o.foldmethod = 'expr'
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||
|
||||
-- don't open folds when jumping over one with (, {, [[ or [{
|
||||
vim.opt.foldopen = vim.opt.foldopen - { 'block' }
|
||||
|
||||
-- search down into subfolders
|
||||
-- provides tab-completion for all file-related tasks
|
||||
vim.opt.path = vim.opt.path + { '**' }
|
||||
|
||||
-- line numbers
|
||||
vim.o.number = true
|
||||
|
||||
-- higlhight search
|
||||
vim.o.hls = true
|
||||
|
||||
-- search as characters are entered
|
||||
vim.o.incsearch = true
|
||||
|
||||
-- line for linewrapping
|
||||
vim.o.colorcolumn = '80'
|
||||
|
||||
-- wrap text instead of being on one line
|
||||
vim.o.lbr = true
|
||||
|
||||
-- default Colors for CursorLine
|
||||
vim.o.cursorline = true
|
||||
|
||||
-- theme related
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- use a dedicated file explorer
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- load project specific configuration files
|
||||
vim.o.exrc = true
|
||||
vim.o.secure = true
|
||||
|
||||
-- disable mouse options
|
||||
vim.opt.mouse = ''
|
||||
|
||||
-- python interpreter
|
||||
vim.g.python3_host_prog = '/usr/bin/python3'
|
||||
7
templates/nvim/lua/source-link.lua.j2
Normal file
7
templates/nvim/lua/source-link.lua.j2
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local source_link = require('source-link')
|
||||
|
||||
source_link.setup()
|
||||
|
||||
vim.keymap.set('n', '<C-L>', '<cmd>:SourceOpen<CR>', { noremap = true, silent = true })
|
||||
37
templates/nvim/lua/telescope.lua.j2
Normal file
37
templates/nvim/lua/telescope.lua.j2
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local telescope = require('telescope')
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local find_files_unignored = function()
|
||||
builtin.find_files { hidden = true, no_ignore = true }
|
||||
end
|
||||
|
||||
local live_grep_unignored = function()
|
||||
builtin.live_grep { additional_args = { '--unrestricted', '--unrestricted' } }
|
||||
end
|
||||
|
||||
vim.keymap.set('n', 'ff', builtin.find_files, opts)
|
||||
vim.keymap.set('n', 'fF', find_files_unignored, opts)
|
||||
vim.keymap.set('n', 'fg', builtin.live_grep, opts)
|
||||
vim.keymap.set('n', 'fG', live_grep_unignored, opts)
|
||||
vim.keymap.set('n', 'fb', builtin.current_buffer_fuzzy_find, opts)
|
||||
vim.keymap.set('n', 'fB', builtin.buffers, opts)
|
||||
vim.keymap.set('n', 'fh', builtin.help_tags, opts)
|
||||
vim.keymap.set('n', 'fj', builtin.jumplist, opts)
|
||||
vim.keymap.set('n', 'fl', builtin.loclist, opts)
|
||||
vim.keymap.set('n', 'fq', builtin.quickfix, opts)
|
||||
vim.keymap.set('n', 'fm', builtin.marks, opts)
|
||||
vim.keymap.set('n', 'ft', builtin.treesitter, opts)
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
layout_strategy = 'vertical',
|
||||
layout_config = {
|
||||
prompt_position = 'bottom',
|
||||
vertical = { width = 0.8, height = 0.9 }
|
||||
},
|
||||
},
|
||||
})
|
||||
26
templates/nvim/lua/tree-sitter.lua.j2
Normal file
26
templates/nvim/lua/tree-sitter.lua.j2
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
-- Tree sitter language parsers are installed automatically (through `auto_install`).
|
||||
-- To update installed parsers use `:TSUpdate {language}`.
|
||||
-- See https://github.com/nvim-treesitter/nvim-treesitter for more info.
|
||||
local tree_sitter_config = require('nvim-treesitter.configs')
|
||||
|
||||
tree_sitter_config.setup {
|
||||
ensure_installed = {
|
||||
'lua', 'yaml', 'bash', 'python', 'javascript', 'typescript', 'css', 'scss',
|
||||
'html', 'htmldjango', 'sql', 'json', 'dockerfile', 'markdown', 'rst', 'tmux',
|
||||
'xml', 'toml', 'editorconfig', 'diff', 'gitcommit', 'git_config', 'gitignore',
|
||||
'gitattributes', 'make', 'nginx', 'vim', 'vimdoc', 'passwd', 'regex'
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
# {{ ansible_managed }} {{ ansible_date_time.time }} {{ ansible_date_time.date }}
|
||||
|
||||
[tool.poetry]
|
||||
name = "coc"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Sonny Bakker <sonny871@hotmail.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.7"
|
||||
black = "^19.10b0"
|
||||
pylint = "^2.5.3"
|
||||
autoflake = "^1.3.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
||||
19
templates/tmux-toggle.j2
Normal file
19
templates/tmux-toggle.j2
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
# Toggle the current window (all panes) between light and dark themes.
|
||||
|
||||
set -e
|
||||
|
||||
current_window_style=$(tmux show -Av window-style)
|
||||
|
||||
case $current_window_style in
|
||||
'fg=#000000,bg=#eff0f1')
|
||||
tmux source-file ~/.config/tmux/dark.conf
|
||||
;;
|
||||
*)
|
||||
# Change back to the default window style.
|
||||
tmux source-file ~/.config/tmux/light.conf
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
packages:
|
||||
- python
|
||||
- poetry
|
||||
- git
|
||||
- vim
|
||||
- neovim
|
||||
- npm
|
||||
- ctags
|
||||
- kitty
|
||||
- docker
|
||||
- docker-compose
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
packages:
|
||||
- git
|
||||
- vim
|
||||
- neovim
|
||||
- python3
|
||||
- python3-pip
|
||||
- python3-venv
|
||||
- python3-setuptools
|
||||
- exuberant-ctags
|
||||
- apt-transport-https
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
packages: []
|
||||
|
||||
xdg_config_dir: '{{ ansible_env.HOME }}/.config'
|
||||
xdg_data_dir: '{{ ansible_env.HOME }}/.local/share'
|
||||
|
||||
dotfiles_repo: 'git@git.fudiggity.nl:sonny/dotfiles.git'
|
||||
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' }
|
||||
|
||||
poetry_packages:
|
||||
- black
|
||||
- pylint
|
||||
- autoflake
|
||||
|
||||
gitlab_domain: 'git.fudiggity.nl'
|
||||
gitlab_host_key: 'git.fudiggity.nl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICNmvcxza79T7JZMkifmquwXH/kMUqDnKs9Oob+JrRvn'
|
||||
|
||||
skip_common_setup: true
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
dotfiles_repo: 'https://git.fudiggity.nl/sonny/dotfiles.git'
|
||||
githook_repo: 'https://git.fudiggity.nl/sonny/git-hooks.git'
|
||||
|
||||
packages:
|
||||
- git
|
||||
- vim
|
||||
- neovim
|
||||
- python2
|
||||
- python3
|
||||
- python3-pip
|
||||
- python3-venv
|
||||
- python3-setuptools
|
||||
- exuberant-ctags
|
||||
- apt-transport-https
|
||||
- kitty
|
||||
Loading…
Add table
Add a link
Reference in a new issue