Compare commits

..

169 commits

Author SHA1 Message Date
66cde494d8 Update used github theme 2025-10-15 10:02:02 +02:00
48cf510079 Create missing directory 2025-10-11 20:47:58 +02:00
086c6217a6 Update role requirement URL 2025-10-11 20:47:47 +02:00
88898151e6 Include missing packages 2025-10-11 20:47:29 +02:00
2fbfbb273f Add htpc to inventory 2025-10-11 20:19:20 +02:00
7d363a30b2 Update debian neovim version 2025-10-11 09:18:19 +02:00
5e1ddd690d Add keybinding for searching through current buffer 2025-10-11 09:11:51 +02:00
54d4fa4323 Switch to master branch for nvim-treesitter
The new main branch, which should be the default branch from now on, does not seem to be stable
2025-10-08 21:00:15 +02:00
cca1f0e59d Move telescope prompt position 2025-10-08 20:56:21 +02:00
bdf0af0645 Fix colorscheme command 2025-10-08 20:56:09 +02:00
df438c062b Add keybind to search with treesitter 2025-10-08 20:55:32 +02:00
95c5cddab2 Replace deprecated nvim_lsp usage 2025-10-08 20:54:10 +02:00
224b9d08f0 Add fd to packages 2025-05-11 08:19:08 +02:00
d65dc0ef3b Allow searching hidden/ignored files 2025-04-29 09:14:09 +02:00
8864a5d37e Increase telescope size & position 2025-04-29 09:05:41 +02:00
8ad75b7029 Group keybinds by function 2025-04-29 08:58:04 +02:00
5edc5bd7e1 Use groups in playbook hosts 2025-04-29 08:57:26 +02:00
3820b79faf Disable mouse options for neovim 2025-04-07 20:45:29 +02:00
c8ee2a0623 Update neovim for debian hosts 2025-04-05 14:06:33 +02:00
ca9edc9d38 Add nvim lsp formatting configuration example 2025-04-03 22:22:14 +02:00
5e0ff0dbc5 Add project specific nvim configuration file example 2025-04-03 21:37:12 +02:00
bdc337b3cb Remove deprecated env variable 2025-04-03 21:36:45 +02:00
1b881c1559 Enable project specific configuration 2025-04-03 21:27:18 +02:00
0caa8c07fc Remove leftover file after f21944eb52 2025-04-02 09:57:44 +02:00
f21944eb52 Remove global formatting configuration
Will be replaced with project specific configurations
2025-04-02 09:10:10 +02:00
87f05c5d83 Split diagnostic configuration to separate file 2025-04-01 22:15:23 +02:00
a68558e4ae Add tmux theme toggle configuration 2025-04-01 22:14:38 +02:00
3b50e0ee67 Disable formatting for template strings 2025-03-26 10:16:52 +01:00
8b7ad62cff use vim.env for detecting environment variables 2025-03-21 08:58:43 +01:00
53ef5f0d54 Add formatting variable to new tmux sessions 2025-03-19 09:18:13 +01:00
b6222e3682 Add delta styling for moved code 2025-03-18 21:52:08 +01:00
6d801bcb4e Move formatting configuration to separate file 2025-03-18 21:51:14 +01:00
6adb1f506f Add additional configuration for lua lsp 2025-03-18 20:16:43 +01:00
0dc654ae2e Remove excluded clients
Should be disabled in LSP configuration
2025-03-18 19:56:11 +01:00
d174718477 Include tmux project init script 2025-03-18 19:50:29 +01:00
747a1fe584 Replace formatting code 2025-03-18 19:49:26 +01:00
7f3dd527af Add git configuration 2025-03-17 21:39:51 +01:00
2d5e5caa25 Add group_vars & host_vars for ansible file detection 2025-03-16 20:54:25 +01:00
d46c4e4ec2 Load git forge key when applicable 2025-03-15 17:13:04 +01:00
755493d155 Group vars refactor 2025-03-15 17:01:22 +01:00
f7eb8dc56d Apply lsp client filtering before filter callback 2025-02-22 20:37:35 +01:00
0f0a5e592b Enable snippet completion for certain lsp's 2025-02-20 22:16:09 +01:00
0bf40c8972 Update neovim version & use checksum to verify downloads 2025-02-15 09:10:26 +01:00
cbddfba5ee Ignore docker user scope errors 2025-02-14 21:18:58 +01:00
bd146ae1d8 Reuse gitsigns information 2025-02-14 21:02:24 +01:00
cf129ad7f6 Show first found LSP in lualine 2025-02-14 20:48:35 +01:00
7d974f5115 Use correct buffer argument 2025-02-14 10:26:10 +01:00
5d15147130 Attach yamlls to yaml.ansible filetypes & show diagnostic source
similiar to lsp source
2025-02-14 09:29:41 +01:00
ee344af9f5 Show current attached LSP count 2025-02-13 22:05:49 +01:00
a351ad691b Check lsp client capabilties before formatting 2025-02-13 21:25:49 +01:00
030f887734 Add missing become statement 2025-02-13 21:16:54 +01:00
c2c6f53075 Remove docker rootless setup 2025-02-13 21:11:15 +01:00
3ca4225f7c Provision python 3.12 2025-02-13 20:51:25 +01:00
199f40b0ea Add ansible filetype detection
Based on 86eea3d684
2025-02-13 20:49:49 +01:00
5aa08aef39 Enable formatting on save
Requires `ENABLE_FORMATTING` to be set
2025-02-11 09:10:52 +01:00
eb14a601fb Add more tree-sitter parsers 2025-02-07 09:51:22 +01:00
c2bbe6cf4a Set colorscheme early
This allows propery theming for lualine & nvim-tree
2025-02-06 21:02:42 +01:00
3b9e414e17 Fix publicly available repo URL 2025-02-06 21:02:09 +01:00
f9a3f5f8bf Fix file permissions 2025-01-20 08:48:58 +01:00
ad47adabd0 Move tmux configuration file path 2025-01-19 21:46:42 +01:00
0113a9c143 Add language servers for structured text formats 2025-01-07 19:48:19 +01:00
52e30d61d1 Fix nvim-cmp sources 2025-01-03 21:44:11 +01:00
2bbf7655c9 Use fallback for displaying completion source 2025-01-03 21:40:38 +01:00
a3353cc601 Show diagnostics source 2025-01-03 21:31:15 +01:00
f45918c93d Remove python-lsp-server setup 2025-01-03 21:30:49 +01:00
d300288799 Add nvim-cmp mappings 2025-01-03 21:18:05 +01:00
b663f3bb20 Remove previously removed files 2025-01-03 20:03:34 +01:00
9183c29751 Remove old statubar setup & install python-lsp-server globablly 2025-01-03 20:00:58 +01:00
f61a044c86 Remove unused configuration files 2025-01-03 20:00:01 +01:00
6115ca4be2 Replace vim.api.nvim_set_keymap with vim.keymap.set 2025-01-03 08:21:21 +01:00
6f512112d8 Remove unused functions 2025-01-03 08:21:21 +01:00
a791f70f5f Remove separate keybindings module 2025-01-03 08:21:14 +01:00
763124e737 Focus on current file when toggling nvim-tree 2025-01-03 06:59:56 +01:00
3b448a8579 Add uv to packages 2024-12-28 12:06:56 +01:00
a5d9b86b3c Add nvim-tree keybindings 2024-12-27 08:22:21 +01:00
f1196f4c42 Add source-link plugin 2024-12-09 20:38:36 +01:00
e737c4f44b Add keybinding to create files/directories 2024-12-06 15:51:13 +01:00
0fa06bdf39 Add missing bits for 5a346cf7ea 2024-11-26 09:51:12 +01:00
903b70b59d Open all folds by default 2024-11-25 21:37:00 +01:00
5a346cf7ea Update ruff lsp reference 2024-11-25 21:36:40 +01:00
c775ba3fa5 Update git forge setup 2024-11-11 10:17:06 +01:00
8bd8ce698c Set initial colorscheme on debian hosts 2024-10-11 22:02:29 +02:00
4dba4f2bb0 Remove color files & add additional completion sources 2024-10-10 21:39:19 +02:00
10469b1d42 Update colorscheme 2024-10-06 08:02:27 +02:00
c2dc0f5c8b Use correct typescript lsp 2024-09-20 22:01:35 +02:00
dc1285358e Only add dbus related calls for arch setups 2024-09-20 21:58:24 +02:00
373dad8448 Detect colorscheme from dbus 2024-09-20 21:20:01 +02:00
3587460d37 Fix gitignore location 2024-09-20 20:47:56 +02:00
0d85540281 Add vim-colors-xcode 2024-09-02 08:14:11 +02:00
613b72cd15 Add nvim-tree icons 2024-08-30 17:41:59 +02:00
d6680fd014 Set nvim-tree keybindings 2024-08-28 10:37:42 +02:00
02fbdf4389 Add ansible managed template 2024-08-28 10:37:17 +02:00
80222dd489 Add nvim-tree setup 2024-08-26 20:14:12 +02:00
7f908f1c40 Update when statement 2024-08-24 20:56:58 +02:00
ff290950ba Disable jedi fuzzy completion 2024-08-24 10:06:45 +02:00
3c3b3952b4 Squashed commit of the following:
commit 1029099729
Author: Sonny Bakker <sonny871@hotmail.com>
Date:   Sat Aug 24 09:54:59 2024 +0200

    [#1] show completion lsp source
2024-08-24 09:56:18 +02:00
6247861f0f Add missing pyright lsp 2024-08-24 09:54:11 +02:00
a458963ff0 Update neovim keybindings & setup ruff lsp 2024-08-23 07:55:15 +02:00
f817379950 Fix removing previous nvm dir 2024-08-23 07:54:38 +02:00
905e696cbf Set correct path for neovim binary 2024-08-20 07:51:09 +02:00
ae424f066d Update AUR packages 2024-08-16 09:02:52 +02:00
aef5ca8138 Remove nvm bash installation 2024-08-16 09:02:42 +02:00
8254bfee9f Add nvm setup 2024-08-13 20:40:20 +02:00
fe9f6788c3 Add neovim to PATH 2024-08-12 20:36:26 +02:00
8f273cc775 Update debian setup 2024-08-10 16:45:02 +02:00
deec1581c5 Extract neovim from prebuilt archives for debian hosts 2024-08-10 16:08:06 +02:00
b53e644f7e Add indent-blankline configuration 2024-08-07 16:58:45 +02:00
6de369fbbb Target debian & archlinux 2024-08-07 11:20:35 +02:00
e28e2eec11 Remove main task 2024-08-07 09:38:41 +02:00
ad6c1dedfe Update ansible managed file markers 2024-08-06 20:25:21 +02:00
0ca888974c Remove git hooks setup 2024-08-06 20:24:48 +02:00
4d57f381a9 Add wl-clipboard to packages 2024-08-02 12:36:25 +02:00
699bb8d85c Add Telescope configuration, update python versions and pin gitsigns version 2024-07-22 09:51:33 +02:00
4103f73de3 Add missing tmux dotfile symlink 2024-05-23 21:01:11 +02:00
a5aa039671 Remove timestamps, remove konsole setup and update neovim packages 2024-05-23 20:49:34 +02:00
0755c7e3d4 Update neovim setup 2023-08-19 14:10:58 +02:00
057797e25d Add missing css language server 2023-08-06 11:48:42 +02:00
1d09789238 Update gitlab CI image tags 2023-08-05 21:53:57 +02:00
bbf5f1a3c7 Add missing language server & update gitlab ssh host key 2023-08-05 21:42:56 +02:00
b0cdf7b854 Update neovim setup
Switch from pyright to python-lsp-server
2023-08-04 10:29:11 +02:00
9891f205f4 Add missing neovim packages
Playbook should be ran without using a virtualenv as it tries to install
global/user wide packages. This is not possible from within a
virtualenv.
2023-02-11 10:40:26 +01:00
b61cc78a65 Use correct state for file module 2023-02-11 10:15:46 +01:00
69f44a414d Use .bashrc.override for DOCKER_HOST 2022-12-03 20:26:08 +01:00
1c59ba439f Remove various autocommands 2022-12-03 19:27:59 +01:00
ff63e93336 Replace vim's default hightlight with treesitter's 2022-12-03 19:27:31 +01:00
65e8420e47 Remove vim-polygot
This plugin set the `noexpandtab` setting for no good reason
2022-11-10 21:57:18 +01:00
11f27e4869 Use opt instead of b 2022-11-10 21:57:08 +01:00
092b78cce6 Add tasks to build python 2022-10-10 10:50:08 +02:00
82c346506d Add Luasnip 2022-10-10 10:14:17 +02:00
9881f4134b Fix existing installed packages test & add tsserver 2022-10-10 10:13:37 +02:00
d5c3653320 Check if aur packages are installed already 2022-09-29 22:18:43 +02:00
55b28b21bd Change intense color 2022-09-29 21:45:23 +02:00
0a125b00bd Change terminal 2022-09-29 21:42:19 +02:00
7cc21dd3f9 Fix neovim colors path 2022-09-08 22:22:35 +02:00
74a974be5e Add neovim configuration files 2022-09-08 22:19:20 +02:00
6cd67e88ad Remove typescript language server 2022-09-07 21:55:01 +02:00
e2227cd87d Add language server for scss/sass/css 2022-09-03 09:17:38 +02:00
7a635a437b Pin Telescope version as suggested by docs 2022-09-03 09:02:44 +02:00
0e6d5bdff0 Add tree-sitter & telescope setup 2022-09-02 21:02:00 +02:00
ba225a09a7 Use read-only URL when ssh fails 2022-07-31 21:59:44 +02:00
ba2ae319b6 Add missing loop statement 2022-07-14 22:01:23 +02:00
7f1f1f0efb Use flag syntax 2022-05-15 21:04:48 +02:00
e205c6c0cf Rerun prettier 2022-05-15 19:19:11 +02:00
d9eeeb3684 Update fontsize 2022-05-15 15:53:28 +02:00
dfff572025 Copy new ftplugin folder for neovim 2022-04-26 21:47:20 +02:00
a6f0bc729c Update konsole config 2021-12-30 20:42:44 +01:00
208eca8c05 Merge branch 'aur-helper' 2021-11-28 22:02:16 +01:00
e1ed19dea5 Display package name when building aur packages 2021-11-28 22:02:00 +01:00
3d26eaa10c Add desktop configuration 2021-11-28 14:21:27 +01:00
cede4ea365 Add separate file for aur task & add rootless docker tasks 2021-11-28 12:04:41 +01:00
52a8bc8a7f Install configured lsp servers 2021-11-25 19:29:48 +01:00
4c35875333 Initial commit 2021-11-25 14:13:15 +01:00
195b9600bb Remove support for ubuntu/debian 2021-11-25 10:28:20 +01:00
5f3cdb3efb Update neovim configuration 2021-11-25 10:23:45 +01:00
c1b9f491e4 Add missing package 2021-06-05 10:26:37 +02:00
6d79543fc9 Merge branch 'master' of git.fudiggity.nl:ansible/development 2021-06-04 22:11:44 +02:00
64fde68038 Update configuration & remove old packages 2021-06-04 22:10:04 +02:00
3e4d60091e Remove old settings 2021-06-04 20:58:39 +02:00
af58cdc396 Load vars from vars_files 2021-05-31 20:34:20 +02:00
0d16af9d83 Update default venv dependencies 2021-05-29 16:25:25 +02:00
b28f961d7d Use vars for specifying python interpreter 2021-04-23 21:32:53 +02:00
8cc4d46b96 Use (fixed path) python3 interpreter by default 2021-04-23 21:11:28 +02:00
c38742df47 Rerun prettier 2021-02-13 22:42:10 +01:00
4dfc755e05 Remove deleted dotfile 2021-02-13 22:40:55 +01:00
f7ef91cb35 Fix errors 2021-02-13 22:20:35 +01:00
3094ca8ce7 Update console configuration 2021-02-13 22:07:51 +01:00
05beb0ece3 Remove skip option
Common role was updated
2021-01-30 17:05:23 +01:00
0e5b42dcec Move platform specific vars
These will be ignored when not present
2021-01-30 10:26:43 +01:00
af7211830d Use simpler file structure 2021-01-29 21:47:47 +01:00
61 changed files with 1601 additions and 235 deletions

View file

@ -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

View file

@ -1,5 +0,0 @@
singleQuote: true
printWidth: 90
tabWidth: 2
useTabs: false
bracketSpacing: true

View file

@ -1,5 +1,6 @@
[defaults]
roles_path = ./roles
inventory = inventory.yml
[privilege_escalation]
become_ask_pass = True

View file

@ -0,0 +1,3 @@
{
"data-root": "/mnt/docker"
}

14
files/nvim.conform.lua Normal file
View 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
View 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
View 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
View 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
View 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: []

View 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
View 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'

View 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

View 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

View 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

View file

@ -0,0 +1,7 @@
packages:
- python3
- git
- vim
- npm
- libtree-sitter0
- ripgrep

27
inventory.yml Normal file
View 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

View file

@ -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

View file

@ -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

View 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
View 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
View 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
View 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
View 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
View 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 ]

View file

@ -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
View 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'

View file

@ -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'

View file

@ -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
View 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'

View file

@ -0,0 +1,3 @@
# {{ ansible_managed }}
PATH="{{ neovim.install_path }}/bin:$PATH"

54
templates/gitconfig.j2 Normal file
View 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 %}

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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')

View 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 %}

View 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 }
}

View 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,
},
},
}

View file

@ -0,0 +1,7 @@
-- {{ ansible_managed }}
local gitsigns = require('gitsigns');
gitsigns.setup({
numhl = true;
})

View file

@ -0,0 +1,10 @@
-- {{ ansible_managed }}
local indent_blankline = require("ibl");
indent_blankline.setup {
scope = {
show_start = false,
show_end = false,
}
}

View 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,
},
}

View 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'}
},
}

View 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();

View 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'

View 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 })

View 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 }
},
},
})

View 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,
},
}

View file

@ -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
View 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

View file

@ -1,11 +0,0 @@
packages:
- python
- poetry
- git
- vim
- neovim
- npm
- ctags
- kitty
- docker
- docker-compose

View file

@ -1,10 +0,0 @@
packages:
- git
- vim
- neovim
- python3
- python3-pip
- python3-venv
- python3-setuptools
- exuberant-ctags
- apt-transport-https

View file

@ -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

View file

@ -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