Compare commits
28 commits
legacy-for
...
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 |
19 changed files with 186 additions and 88 deletions
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
|
||||
})
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
session_name=${PWD##*/}
|
||||
project_directory="$HOME/development/$session_name"
|
||||
enable_formatting="false"
|
||||
|
||||
tmux has-session -t $session_name
|
||||
|
||||
|
|
@ -11,8 +10,7 @@ then
|
|||
tmux new-session \
|
||||
-c $project_directory \
|
||||
-ds $session_name \
|
||||
-e "project_dir=$project_directory" \
|
||||
-e "enable_formatting=$enable_formatting"
|
||||
-e "project_dir=$project_directory"
|
||||
|
||||
# FIRST WINDOW
|
||||
tmux send-keys -t $session_name:0 'source ./env/bin/activate' C-m
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ neovim_plugins:
|
|||
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'
|
||||
|
|
@ -42,5 +43,8 @@ neovim_plugins:
|
|||
- 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: []
|
||||
|
|
|
|||
|
|
@ -14,4 +14,10 @@ packages:
|
|||
- slirp4netns
|
||||
- tree-sitter
|
||||
- ripgrep
|
||||
- fd
|
||||
- uv
|
||||
- fakeroot
|
||||
- debugedit
|
||||
- which
|
||||
- gcc
|
||||
- make
|
||||
|
|
|
|||
|
|
@ -1,18 +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'
|
||||
- package: "@ansible/ansible-language-server"
|
||||
server_name: "ansiblels"
|
||||
auto_setup: true
|
||||
|
||||
- package: yaml-language-server
|
||||
server_name: 'yamlls'
|
||||
server_name: "yamlls"
|
||||
auto_setup: false
|
||||
|
||||
- package: bash-language-server
|
||||
server_name: 'bashls'
|
||||
server_name: "bashls"
|
||||
auto_setup: true
|
||||
|
||||
neovim:
|
||||
version: 'v0.10.4'
|
||||
install_path: '/opt/nvim'
|
||||
download_checksum: sha256:95aaa8e89473f5421114f2787c13ae0ec6e11ebbd1a13a1bd6fcf63420f8073f
|
||||
version: "v0.11.4"
|
||||
install_path: "/opt/nvim"
|
||||
download_checksum: sha256:a74740047e73b2b380d63a474282814063d10650cd6cc95efa16d1713c7e616c
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ personal:
|
|||
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
|
||||
|
||||
|
|
@ -20,3 +23,5 @@ arch:
|
|||
<<: *xps
|
||||
desktop:
|
||||
<<: *desktop
|
||||
htpc:
|
||||
<<: *htpc
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
- name: Development provisioning
|
||||
hosts:
|
||||
- xps
|
||||
- desktop
|
||||
- fudiggity
|
||||
- personal
|
||||
- arch
|
||||
- debian
|
||||
pre_tasks:
|
||||
- name: Verifying that a limit is set
|
||||
ansible.builtin.fail:
|
||||
|
|
|
|||
|
|
@ -1,4 +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
|
||||
|
|
|
|||
|
|
@ -38,9 +38,15 @@
|
|||
- src: '{{ ansible_env.HOME }}/dotfiles/.profile'
|
||||
dest: '{{ ansible_env.HOME }}/.profile'
|
||||
|
||||
- src: '{{ ansible_env.HOME }}/dotfiles/.tmux.conf'
|
||||
- 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'
|
||||
|
||||
|
|
@ -49,3 +55,15 @@
|
|||
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'
|
||||
|
|
|
|||
|
|
@ -121,5 +121,5 @@
|
|||
- src: 'templates/nvim/lua/filetype.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/_filetype.lua'
|
||||
|
||||
- src: 'templates/nvim/lua/formatting.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/formatting.lua'
|
||||
- src: 'templates/nvim/lua/diagnostic.lua.j2'
|
||||
dest: '{{ xdg_config_dir }}/nvim/lua/diagnostic.lua'
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ require('indent-blankline')
|
|||
require('_nvim-tree')
|
||||
require('lua-line')
|
||||
require('_source-link')
|
||||
require('formatting')
|
||||
require('diagnostic')
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ local background_callback = function()
|
|||
if vim.o.background == 'dark' then
|
||||
vim.cmd('colorscheme github_dark_dimmed')
|
||||
else
|
||||
vim.cmd('colorscheme github_light')
|
||||
vim.cmd('colorscheme github_light_tritanopia')
|
||||
end
|
||||
|
||||
-- force a full redraw:
|
||||
|
|
@ -29,7 +29,7 @@ Use the `Introspect` option to inspect available options:
|
|||
|
||||
dbus-send \
|
||||
--session \
|
||||
--print-reply ]
|
||||
--print-reply \
|
||||
--reply-timeout=2000 \
|
||||
--type=method_call \
|
||||
--dest=org.freedesktop.portal.Desktop \
|
||||
|
|
|
|||
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 }
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
-- {{ ansible_managed }}
|
||||
|
||||
local enable_formatting = vim.env.enable_formatting == 'true';
|
||||
local legacy_formatting = nil;
|
||||
|
||||
-- TODO: move to utils file
|
||||
-- TODO: add efm-languageserver to lsp.lua
|
||||
if vim.env.VIRTUAL_ENV ~= nil and enable_formatting == true then
|
||||
local formatters = vim.fs.find(
|
||||
{ 'isort', 'black' },
|
||||
{ limit = 1, type = 'file', path = vim.fs.joinpath(vim.env.VIRTUAL_ENV, 'bin') }
|
||||
)
|
||||
|
||||
legacy_formatting = #formatters > 0;
|
||||
end
|
||||
|
||||
if (enable_formatting) then
|
||||
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.server_capabilities.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format {
|
||||
async = false,
|
||||
id = args.data.client_id,
|
||||
filter = function(format_client)
|
||||
return format_client.name ~= 'ruff' or not legacy_formatting
|
||||
end
|
||||
}
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
|
@ -7,29 +7,29 @@ local on_attach = function(client, bufnr)
|
|||
|
||||
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>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, 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)
|
||||
vim.keymap.set('n', '<space>la', vim.lsp.buf.code_action, opts)
|
||||
|
||||
end
|
||||
|
||||
|
||||
--enable some language servers with the additional completion capabilities
|
||||
--offered by nvim-cmp
|
||||
local servers = {
|
||||
local auto_setup_servers = {
|
||||
{% for item in language_servers %}
|
||||
{% if item.auto_setup and not loop.last %}
|
||||
'{{ item.server_name }}',
|
||||
|
|
@ -43,10 +43,8 @@ local servers = {
|
|||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
for _, lsp in ipairs(auto_setup_servers) do
|
||||
vim.lsp.config[lsp] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
|
@ -60,42 +58,49 @@ local python_root_dir = function(fname)
|
|||
util.path.dirname(fname)
|
||||
end
|
||||
|
||||
nvim_lsp.ruff.setup {
|
||||
vim.lsp.config['ruff'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = python_root_dir
|
||||
}
|
||||
|
||||
|
||||
nvim_lsp.pyright.setup {
|
||||
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
|
||||
|
||||
nvim_lsp.html.setup {
|
||||
vim.lsp.config['html'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
filetypes = { 'html', 'htmldjango' },
|
||||
settings = {
|
||||
html = {
|
||||
format = {
|
||||
templating = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nvim_lsp.cssls.setup {
|
||||
vim.lsp.config['cssls'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
}
|
||||
|
||||
nvim_lsp.jsonls.setup {
|
||||
vim.lsp.config['jsonls'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
}
|
||||
|
||||
nvim_lsp.lua_ls.setup {
|
||||
vim.lsp.config['lua_ls'] = {
|
||||
on_attach = on_attach,
|
||||
capabilities = snippet_capabilities,
|
||||
settings = {
|
||||
|
|
@ -108,12 +113,24 @@ nvim_lsp.lua_ls.setup {
|
|||
}
|
||||
|
||||
{% endif %}
|
||||
nvim_lsp.yamlls.setup {
|
||||
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')
|
||||
|
||||
|
|
@ -179,11 +196,3 @@ cmp.setup {
|
|||
end,
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config {
|
||||
float = {
|
||||
suffix = function(diagnostic)
|
||||
return (' %s | [%s]'):format(diagnostic.code, diagnostic.source)
|
||||
end
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,5 +55,12 @@ vim.o.termguicolors = true
|
|||
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'
|
||||
|
|
|
|||
|
|
@ -5,20 +5,33 @@ 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', 'fb', builtin.buffers, 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 = {
|
||||
vertical = { width = 0.5, height = 0.7 }
|
||||
prompt_position = 'bottom',
|
||||
vertical = { width = 0.8, height = 0.9 }
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue