8 Commits
7 changed files with 147 additions and 54 deletions
+50
View File
@@ -13,3 +13,53 @@ surround.buffer_setup({
} }
}) })
local ansible_paths = {}
local fname = vim.api.nvim_buf_get_name(0)
if fname:find('tasks/') then
ansible_paths = {
vim.fs.dirname(fname:gsub('tasks', 'files')),
vim.fs.dirname(fname:gsub('tasks', 'templates'))
}
end
vim.bo.path = table.concat(ansible_paths, ',')
-- TODO: ansible role navigation
-- When gd is pressed on a role name (e.g., "caddy", "geerlingguy.docker"),
-- open that role's directory in oil.
--
-- Implementation approach:
-- 1. Find ansible root by searching upward for ansible.cfg (bounded by getcwd)
-- - If not found, fallback to searching for .git directory
-- - If neither found, show warning and do nothing
-- 2. Parse roles_path from ansible.cfg
-- - Split by ':' to get multiple directories
-- - Resolve relative paths against ansible root
-- 3. Check if word under cursor matches any role directory
-- - Search each role directory for matching subdirectory
-- 4. If match found: :Oil <role_path>
-- - Else: fallback to vim.lsp.buf.definition()
--
-- Key functions to implement:
-- - find_file_ascending(start_dir, filename, boundary_dir)
-- Search upward for a file (e.g., ansible.cfg), stopping at boundary_dir
--
-- - find_directory_ascending(start_dir, dirname, boundary_dir)
-- Search upward for a directory (e.g., .git), stopping at boundary_dir
--
-- - get_ansible_root(buf_path)
-- Return the ansible project root directory by searching for ansible.cfg
-- or .git directory
--
-- - parse_roles_path(ansible_root)
-- Parse ansible.cfg to extract roles_path configuration
-- Return list of absolute role directories
-- Fallback to ansible_root .. "/roles" if roles_path not in config
--
-- - find_role_path(role_name, role_dirs)
-- Search each role directory for a matching subdirectory
-- Return full path if found, nil otherwise
--
-- - ansible_gd()
-- Main function bound to gd keymap
-- Get word under cursor, find role path, open in oil or fallback to LSP
+19 -19
View File
@@ -1,43 +1,43 @@
{ {
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, "LuaSnip": { "branch": "master", "commit": "642b0c595e11608b4c18219e93b88d7637af27bc" },
"blink-ripgrep.nvim": { "branch": "main", "commit": "75e7dbc4e2b12ea8db63c97e4dd3edd793381c05" }, "blink-ripgrep.nvim": { "branch": "main", "commit": "7a3bedb0c978e7fbde3c68127df544e23554e22b" },
"blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" }, "blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, "fidget.nvim": { "branch": "main", "commit": "889e2e96edef4e144965571d46f7a77bcc4d0ddf" },
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
"fzf-lua": { "branch": "main", "commit": "c9e7b7bfbd01f949164988ee1684035468e1995c" }, "fzf-lua": { "branch": "main", "commit": "64590411e6cf3d603d1e1bdad3a3d051f2f5a91a" },
"gitsigns.nvim": { "branch": "main", "commit": "50c205548d8b037b7ff6378fca6d21146f0b6161" }, "gitsigns.nvim": { "branch": "main", "commit": "dd3f588bacbeb041be6facf1742e42097f62165d" },
"gruvbox.nvim": { "branch": "main", "commit": "334d5fd49fc8033f26408425366c66c6390c57bb" }, "gruvbox.nvim": { "branch": "main", "commit": "154eb5ff5b96d0641307113fa385eaf0d36d9796" },
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
"indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "037398b9ce4a53ba48d5f94765c641a1fd16d906" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "0c2823e0418f3d9230ff8b201c976e84de1cb401" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, "mason.nvim": { "branch": "main", "commit": "cb8445f8ce85d957416c106b780efd51c6298f89" },
"mini.pairs": { "branch": "main", "commit": "d5a29b6254dad07757832db505ea5aeab9aad43a" }, "mini.pairs": { "branch": "main", "commit": "d5a29b6254dad07757832db505ea5aeab9aad43a" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "84c75e7a7e443586f60508d12fc50f90d9aee14e" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "84c75e7a7e443586f60508d12fc50f90d9aee14e" },
"none-ls.nvim": { "branch": "main", "commit": "c9317c2a8629d4e39e7cf47be74cb67f3ab37cda" }, "none-ls.nvim": { "branch": "main", "commit": "241ff8214b4ec051eb51e74a61ff729c0271b429" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-colorizer.lua": { "branch": "master", "commit": "5cfe7fffbd01e17b3c1e14af85d5febdef88bd8c" },
"nvim-lspconfig": { "branch": "master", "commit": "0203a9608d63eda57679b01e69f33a7b4c34b0d1" }, "nvim-lspconfig": { "branch": "master", "commit": "9bafffaeaae363c5211080e06e04ed5b422fd5ad" },
"nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" }, "nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" },
"nvim-sops": { "branch": "main", "commit": "1791eec21e78c9736ae504f02712a2f509c69b2c" }, "nvim-sops": { "branch": "main", "commit": "1791eec21e78c9736ae504f02712a2f509c69b2c" },
"nvim-surround": { "branch": "main", "commit": "61319d4bd1c5e336e197defa15bd104c51f0fb29" }, "nvim-surround": { "branch": "main", "commit": "2e93e154de9ff326def6480a4358bfc149d5da2c" },
"nvim-treesitter": { "branch": "main", "commit": "7caec274fd19c12b55902a5b795100d21531391f" }, "nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
"nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" }, "nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" },
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" }, "nvim-web-devicons": { "branch": "master", "commit": "4fc505ac7bd7692824a142e96e5f529c133862f8" },
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" }, "oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
"parrot.nvim": { "branch": "main", "commit": "5d7e72bdc3efe2638e1bd94ff55028ecc40edd7a" }, "parrot.nvim": { "branch": "main", "commit": "5d7e72bdc3efe2638e1bd94ff55028ecc40edd7a" },
"plenary": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"render-markdown.nvim": { "branch": "main", "commit": "e3c18ddd27a853f85a6f513a864cf4f2982b9f26" }, "render-markdown.nvim": { "branch": "main", "commit": "3f3eea97b80839f629c951ca660ffd125bfa5b34" },
"search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" }, "search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" },
"statuscol.nvim": { "branch": "main", "commit": "c46172d0911aa5d49ba5f39f4351d1bb7aa289cc" }, "statuscol.nvim": { "branch": "main", "commit": "c46172d0911aa5d49ba5f39f4351d1bb7aa289cc" },
"tabby.nvim": { "branch": "main", "commit": "3c130e1fcb598ce39a9c292847e32d7c3987cf11" }, "tabby.nvim": { "branch": "main", "commit": "3c130e1fcb598ce39a9c292847e32d7c3987cf11" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
"telescope.nvim": { "branch": "master", "commit": "e6cdb4dc528c5dc4ca8da86e83ef4e3c84b0729c" }, "telescope.nvim": { "branch": "master", "commit": "f04ab730b8f9c6bf3f54a206d0dcddfd70c52d59" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" }, "undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" },
"vim-dadbod": { "branch": "master", "commit": "6d1d41da4873a445c5605f2005ad2c68c99d8770" }, "vim-dadbod": { "branch": "master", "commit": "6d1d41da4873a445c5605f2005ad2c68c99d8770" },
+2 -2
View File
@@ -13,8 +13,8 @@ autocmd('LspAttach', {
local opts = { buffer = e.buf } local opts = { buffer = e.buf }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.jump({ count = 1 }) end, opts) vim.keymap.set("n", "[d", function() vim.diagnostic.jump({ count = -1 }) end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.jump({ count = -1 }) end, opts) vim.keymap.set("n", "]d", function() vim.diagnostic.jump({ count = 1 }) end, opts)
vim.keymap.set("n", "<M-F>", function() vim.lsp.buf.format() end, opts) vim.keymap.set("n", "<M-F>", function() vim.lsp.buf.format() end, opts)
end end
}) })
+15 -7
View File
@@ -6,19 +6,27 @@ vim.filetype.add({
jinja2 = 'jinja', jinja2 = 'jinja',
}, },
pattern = { pattern = {
-- gitlab-ci
['%.gitlab%-ci%.ya?ml'] = 'yaml.gitlab',
['pipelines/.*%.ya?ml'] = 'yaml.gitlab',
-- values files
['.*/helm/.*values.*%.ya?ml'] = 'yaml.helm-values',
['values%.ya?ml'] = 'yaml.helm-values',
-- ansible
['.*/molecule/.*%.ya?ml'] = 'yaml.ansible',
['.*/roles/.*%.ya?ml'] = 'yaml.ansible', ['.*/roles/.*%.ya?ml'] = 'yaml.ansible',
['.*/tasks/.*%.ya?ml'] = 'yaml.ansible', ['.*/tasks/.*%.ya?ml'] = 'yaml.ansible',
['.*/plays/.*%.ya?ml'] = 'yaml.ansible', ['.*/plays/.*%.ya?ml'] = 'yaml.ansible',
['.*/plays/.*/files/.*%.ya?ml'] = { 'yaml', { priority = 10 } }, -- these are not ansible files
-- protobuf
['buf.yaml'] = 'buf-config',
['buf.gen.yaml'] = 'buf-config',
['buf.policy.yaml'] = 'buf-config',
['buf.lock'] = 'buf-config',
-- templates -- templates
['.*/templates/.*%.ya?ml'] = 'helm', ['.*/templates/.*%.ya?ml'] = 'helm',
['.*/templates/.*%.tpl'] = 'helm', ['.*/templates/.*%.tpl'] = 'helm',
['helmfile%.ya?ml'] = 'helm', ['helmfile%.ya?ml'] = 'helm',
-- values files },
['.*/helm/.*values.*%.ya?ml'] = 'yaml.helm-values',
['values%.ya?ml'] = 'yaml.helm-values',
-- gitlab-ci
['%.gitlab%-ci%.ya?ml'] = 'yaml.gitlab',
['pipelines/.*%.ya?ml'] = 'yaml.gitlab',
},
}) })
+1 -1
View File
@@ -35,7 +35,7 @@ return {
end end
}, },
{ {
'norcalli/nvim-colorizer.lua', 'catgoose/nvim-colorizer.lua',
config = function() config = function()
require('colorizer').setup({ '*' }) require('colorizer').setup({ '*' })
end end
+34 -17
View File
@@ -1,20 +1,37 @@
return { return {
'kristijanhusak/vim-dadbod-ui', 'kristijanhusak/vim-dadbod-ui',
dependencies = { dependencies = {
{ 'tpope/vim-dadbod', lazy = true }, { 'tpope/vim-dadbod', lazy = true },
{ 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, -- Optional
}, },
cmd = { cmd = {
'DBUI', 'DBUI',
'DBUIToggle', 'DBUIToggle',
'DBUIAddConnection', 'DBUIAddConnection',
'DBUIFindBuffer', 'DBUIFindBuffer',
}, },
init = function() init = function()
-- Your DBUI configuration -- Your DBUI configuration
vim.g.db_ui_use_nerd_fonts = 1 vim.g.db_ui_use_nerd_fonts = 1
vim.g.db_ui_auto_execute_table_helpers = 1 vim.g.db_ui_auto_execute_table_helpers = 1
vim.g.db_ui_win_position = 'left' vim.g.db_ui_win_position = 'left'
end,
local sops = require('crentist.sops')
local sops_runner = sops.create_runner({})
local decrypted_dbs = sops_runner:to_table('~/.dotfiles/dbs.yaml')
if decrypted_dbs then
vim.g.dbs = decrypted_dbs.databases
end
local refresh_db = function()
decrypted_dbs = sops_runner:to_table('~/.dotfiles/dbs.yaml')
if decrypted_dbs then
vim.g.dbs = decrypted_dbs.databases
end
end
vim.api.nvim_create_user_command('DBRefresh', refresh_db, {})
end,
} }
+26 -8
View File
@@ -15,13 +15,16 @@ return {
library = { library = {
-- See the configuration section for more details -- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found -- Load luvit types when the `vim.uv` word is found
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } }, { path = '${3rd}/luv/library', words = { 'vim%.uv' } },
{ path = '/usr/share/swayimg/', words = { 'swayimg' } },
{ path = '/usr/share/hypr/stubs', words = { 'hypr' } },
}, },
}, },
}, },
}, },
config = function() config = function()
vim.lsp.codelens.enable(true)
vim.diagnostic.config({ virtual_text = false }) vim.diagnostic.config({ virtual_text = false })
-- load snippets from friendly-snippets -- load snippets from friendly-snippets
@@ -44,12 +47,14 @@ return {
'terraformls', 'terraformls',
'helm_ls', 'helm_ls',
'marksman', 'marksman',
'buf_ls',
'tflint',
}, },
}) })
local lazydev = require('lazydev') local lazydev = require('lazydev')
vim.lsp.config('lua_ls', { vim.lsp.config('lua_ls', {
root_dir = function(bufnr, on_dir) on_dir(lazydev.find_workspace(bufnr)) end root_dir = function(bufnr, on_dir) on_dir(lazydev.find_workspace(bufnr)) end,
}) })
---@module 'lspconfig' ---@module 'lspconfig'
@@ -81,19 +86,32 @@ return {
} }
}) })
local schemas_dir = vim.fs.joinpath(vim.fn.stdpath('config'), '/schemas')
vim.lsp.config('yamlls', { vim.lsp.config('yamlls', {
filetypes = { 'yaml' }, filetypes = { 'yaml', 'yaml.gitlab' },
settings = { settings = {
yaml = { enable = true, }, yaml = {
schemaStore = { enable = false },
schemas = {
['https://gitlab.com/gitlab-org/gitlab-foss/-/raw/master/app/assets/javascripts/editor/schema/ci.json'] = {
'**/*.gitlab-ci.yml',
'**/pipelines/*.yml',
'**/pipelines/*.yaml',
},
[vim.fs.joinpath(schemas_dir, '/vector-v0.53.0-schema.json')] = {
'**/vector.yaml'
},
['https://github.com/SchemaStore/schemastore/raw/refs/heads/master/src/schemas/json/kustomization.json'] = {
'**/kustomization.yaml'
}
}
},
} }
}) })
vim.lsp.config('terraformls', { vim.lsp.config('terraformls', {
filetypes = { 'terraform', 'terraform-vars' }, filetypes = { 'terraform', 'terraform-vars' },
-- run terraformls once for a git repo root_markers = { { 'main.tf', '.terraform.lock.hcl' }, '.git' }
root_dir = function(bufnr, on_dir)
on_dir(vim.fs.root(bufnr, '.git'))
end
}) })
end end
} }