Compare commits
18
Commits
main
...
c63cf063b3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c63cf063b3 | ||
|
|
2ababf0c46 | ||
|
|
74cbe41650 | ||
|
|
b5dabd49f1 | ||
|
|
38be1f6e74 | ||
|
|
3fd521f08a | ||
|
|
60f924c1d5 | ||
|
|
e1949666b1 | ||
|
|
cb3f3f43cb | ||
|
|
73ad16b985 | ||
|
|
1755c68818 | ||
|
|
ef31da19ba | ||
|
|
ef6c8dca4f | ||
|
|
fd4c38e01b | ||
|
|
2dc040f17d | ||
|
|
331411e35b | ||
|
|
0931940cfa | ||
|
|
a28dafa553 |
@@ -0,0 +1,4 @@
|
|||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
+32
-35
@@ -1,49 +1,46 @@
|
|||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
|
"LuaSnip": { "branch": "master", "commit": "642b0c595e11608b4c18219e93b88d7637af27bc" },
|
||||||
"blink-ripgrep.nvim": { "branch": "main", "commit": "2e14682667d332520de254c2b21f6e77ae2c1b87" },
|
"blink-ripgrep.nvim": { "branch": "main", "commit": "7a3bedb0c978e7fbde3c68127df544e23554e22b" },
|
||||||
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
"blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||||
"fidget.nvim": { "branch": "main", "commit": "64463022a1f2ff1318ab22a2ea4125ed9313a483" },
|
"fidget.nvim": { "branch": "main", "commit": "889e2e96edef4e144965571d46f7a77bcc4d0ddf" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||||
"fzf-lua": { "branch": "main", "commit": "ab0d0135746c564ca31cd2c8a84c170802be6d16" },
|
"gitsigns.nvim": { "branch": "main", "commit": "dd3f588bacbeb041be6facf1742e42097f62165d" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "6bd29494e3f79ff08be1d35bc1926ed23c22ed9a" },
|
"gruvbox.nvim": { "branch": "main", "commit": "154eb5ff5b96d0641307113fa385eaf0d36d9796" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
|
||||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||||
"hererocks": { "branch": "master", "commit": "88ef4650f1e62bb9a9f931eab024b2a167f17a5a" },
|
"indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" },
|
||||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
"lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" },
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
"lualine.nvim": { "branch": "master", "commit": "131a558e13f9f28b15cd235557150ccb23f89286" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "0c2823e0418f3d9230ff8b201c976e84de1cb401" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "4cfe411526a7a99c18281135e8b4765ae6330d15" },
|
"mason.nvim": { "branch": "main", "commit": "cb8445f8ce85d957416c106b780efd51c6298f89" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
|
||||||
"mini.pairs": { "branch": "main", "commit": "d5a29b6254dad07757832db505ea5aeab9aad43a" },
|
"mini.pairs": { "branch": "main", "commit": "d5a29b6254dad07757832db505ea5aeab9aad43a" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
|
"neo-tree.nvim": { "branch": "v3.x", "commit": "84c75e7a7e443586f60508d12fc50f90d9aee14e" },
|
||||||
"none-ls.nvim": { "branch": "main", "commit": "0b457958cb958c16850b5a1fb38bbcd982909181" },
|
"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": "5bfcc89fd155b4ffc02d18ab3b7d19c2d4e246a7" },
|
"nvim-lspconfig": { "branch": "master", "commit": "9bafffaeaae363c5211080e06e04ed5b422fd5ad" },
|
||||||
"nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" },
|
"nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" },
|
||||||
"nvim-sops": { "branch": "main", "commit": "cb2209562d00ef8c6c88bdec836d9edb8fbb96ef" },
|
"nvim-sops": { "branch": "main", "commit": "1791eec21e78c9736ae504f02712a2f509c69b2c" },
|
||||||
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
|
"nvim-surround": { "branch": "main", "commit": "2e93e154de9ff326def6480a4358bfc149d5da2c" },
|
||||||
"nvim-treesitter": { "branch": "main", "commit": "737088f8571293f6a1ef8cd6c858d5daf9a38162" },
|
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||||
"nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
|
"nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" },
|
"nvim-web-devicons": { "branch": "master", "commit": "4fc505ac7bd7692824a142e96e5f529c133862f8" },
|
||||||
"oil.nvim": { "branch": "master", "commit": "81b8a91735ad5cd24a6b3137f14a89f19176364f" },
|
"oil.nvim": { "branch": "master", "commit": "0fcc83805ad11cf714a949c98c605ed717e0b83e" },
|
||||||
"parrot.nvim": { "branch": "main", "commit": "5d7e72bdc3efe2638e1bd94ff55028ecc40edd7a" },
|
"plenary": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||||
"plenary": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
|
||||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||||
"render-markdown.nvim": { "branch": "main", "commit": "acddb80d9a12e33c03ca288de39c9963396f358a" },
|
"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": "b3affa6db7eab80fca2a2db5b73b473144507039" },
|
"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": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" },
|
"telescope.nvim": { "branch": "master", "commit": "f04ab730b8f9c6bf3f54a206d0dcddfd70c52d59" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
||||||
"undotree": { "branch": "master", "commit": "178d19e00a643f825ea11d581b1684745d0c4eda" },
|
"undotree": { "branch": "master", "commit": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d" },
|
||||||
"vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" },
|
"vim-dadbod": { "branch": "master", "commit": "6d1d41da4873a445c5605f2005ad2c68c99d8770" },
|
||||||
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
|
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
|
||||||
"vim-dadbod-ui": { "branch": "master", "commit": "48c4f271da13d380592f4907e2d1d5558044e4e5" },
|
"vim-dadbod-ui": { "branch": "master", "commit": "07e92e22114cc5b1ba4938d99897d85b58e20475" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
"vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" },
|
||||||
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }
|
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
})
|
})
|
||||||
|
|||||||
+24
-19
@@ -1,27 +1,32 @@
|
|||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
extension = {
|
extension = {
|
||||||
['tf'] = 'terraform',
|
['tf'] = 'terraform',
|
||||||
},
|
|
||||||
pattern = {
|
|
||||||
['.*/playbooks/.*%.ya?ml'] = 'yaml.ansible',
|
|
||||||
['.*/roles/.*%.ya?ml'] = 'yaml.ansible',
|
|
||||||
['.*/tasks/.*%.ya?ml'] = 'yaml.ansible',
|
|
||||||
['.*/plays/.*%.ya?ml'] = 'yaml.ansible',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.filetype.add({
|
|
||||||
extension = {
|
|
||||||
j2 = 'jinja',
|
j2 = 'jinja',
|
||||||
jinja = 'jinja',
|
jinja = 'jinja',
|
||||||
jinja2 = 'jinja',
|
jinja2 = 'jinja',
|
||||||
}
|
},
|
||||||
})
|
pattern = {
|
||||||
|
-- gitlab-ci
|
||||||
vim.filetype.add({
|
['%.gitlab%-ci%.ya?ml'] = 'yaml.gitlab',
|
||||||
pattern = {
|
['pipelines/.*%.ya?ml'] = 'yaml.gitlab',
|
||||||
['%.gitlab%-ci%.ya?ml'] = 'yaml.gitlab',
|
-- values files
|
||||||
['pipelines/.*%.ya?ml'] = 'yaml.gitlab',
|
['.*/helm/.*values.*%.ya?ml'] = 'yaml.helm-values',
|
||||||
},
|
['values%.ya?ml'] = 'yaml.helm-values',
|
||||||
|
-- ansible
|
||||||
|
['.*/molecule/.*%.ya?ml'] = 'yaml.ansible',
|
||||||
|
['.*/roles/.*%.ya?ml'] = 'yaml.ansible',
|
||||||
|
['.*/tasks/.*%.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/.*%.ya?ml'] = 'helm',
|
||||||
|
['.*/templates/.*%.tpl'] = 'helm',
|
||||||
|
['helmfile%.ya?ml'] = 'helm',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+34
-11
@@ -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
|
||||||
@@ -33,8 +36,6 @@ return {
|
|||||||
---@type MasonLspconfigSettings
|
---@type MasonLspconfigSettings
|
||||||
require('mason-lspconfig').setup({
|
require('mason-lspconfig').setup({
|
||||||
automatic_enable = true,
|
automatic_enable = true,
|
||||||
-- Replace the language servers listed here
|
|
||||||
-- with the ones you want to install
|
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'ts_ls',
|
'ts_ls',
|
||||||
'lua_ls',
|
'lua_ls',
|
||||||
@@ -46,19 +47,21 @@ 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'
|
||||||
---@type lspconfig.Config
|
---@type lspconfig.Config
|
||||||
vim.lsp.config('pylsp', {
|
vim.lsp.config('pylsp', {
|
||||||
settings = {
|
settings = {
|
||||||
['pylsp'] = {
|
pylsp = {
|
||||||
plugins = {
|
plugins = {
|
||||||
autopep8 = {
|
autopep8 = {
|
||||||
enabled = false,
|
enabled = false,
|
||||||
@@ -77,19 +80,39 @@ return {
|
|||||||
|
|
||||||
vim.lsp.config('helm_ls', {
|
vim.lsp.config('helm_ls', {
|
||||||
settings = {
|
settings = {
|
||||||
['helm_ls'] = {
|
helm_ls = {
|
||||||
helmLint = { enabled = false },
|
|
||||||
yamlls = { enabled = false },
|
yamlls = { enabled = false },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local schemas_dir = vim.fs.joinpath(vim.fn.stdpath('config'), '/schemas')
|
||||||
|
vim.lsp.config('yamlls', {
|
||||||
|
filetypes = { 'yaml', 'yaml.gitlab' },
|
||||||
|
settings = {
|
||||||
|
yaml = {
|
||||||
|
customTags = { "!reference sequence" },
|
||||||
|
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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
return {
|
|
||||||
'frankroeder/parrot.nvim',
|
|
||||||
version = '2.5.1',
|
|
||||||
dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' },
|
|
||||||
config = function()
|
|
||||||
local parrot_opts = {
|
|
||||||
providers = {
|
|
||||||
anthropic = {
|
|
||||||
name = 'anthropic',
|
|
||||||
endpoint = 'https://api.anthropic.com/v1/messages',
|
|
||||||
model_endpoint = 'https://api.anthropic.com/v1/models',
|
|
||||||
api_key = { '/usr/local/bin/sops', '--config', '/dev/null', '-d', vim.fn.expand('$HOME') .. '/.claude-api' },
|
|
||||||
headers = function(self)
|
|
||||||
return {
|
|
||||||
['Content-Type'] = 'application/json',
|
|
||||||
['x-api-key'] = self.api_key,
|
|
||||||
['anthropic-version'] = '2023-06-01',
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
params = {
|
|
||||||
chat = { max_tokens = 4096 },
|
|
||||||
command = { max_tokens = 4096 },
|
|
||||||
},
|
|
||||||
models = {
|
|
||||||
'claude-opus-4-6',
|
|
||||||
'claude-sonet-4-5',
|
|
||||||
'claude-haiku-4-5',
|
|
||||||
},
|
|
||||||
preprocess_payload = function(payload)
|
|
||||||
for _, message in ipairs(payload.messages) do
|
|
||||||
message.content = message.content:gsub('^%s*(.-)%s*$', "%1")
|
|
||||||
end
|
|
||||||
if payload.messages[1] and payload.messages[1].role == 'system' then
|
|
||||||
-- remove the first message that serves as the system prompt as anthropic
|
|
||||||
-- expects the system prompt to be part of the API call body and not the messages
|
|
||||||
payload.system = payload.messages[1].content
|
|
||||||
table.remove(payload.messages, 1)
|
|
||||||
end
|
|
||||||
return payload
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
user_input_ui = 'buffer',
|
|
||||||
}
|
|
||||||
|
|
||||||
local parrot = require('parrot')
|
|
||||||
parrot.setup(parrot_opts)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,91 +1,91 @@
|
|||||||
return {
|
return {
|
||||||
'FabianWirth/search.nvim',
|
'FabianWirth/search.nvim',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
'nvim-lua/plenary.nvim',
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope.nvim',
|
'nvim-telescope/telescope.nvim',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
|
||||||
}
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
local telescope = require('telescope')
|
local telescope = require('telescope')
|
||||||
local telescopeConfig = require('telescope.config')
|
local telescopeConfig = require('telescope.config')
|
||||||
|
|
||||||
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
local vimgrep_arguments = { unpack(telescopeConfig.values.vimgrep_arguments) }
|
||||||
table.insert(vimgrep_arguments, '--hidden')
|
table.insert(vimgrep_arguments, '--hidden')
|
||||||
table.insert(vimgrep_arguments, '--glob')
|
table.insert(vimgrep_arguments, '--glob')
|
||||||
table.insert(vimgrep_arguments, '!**/.git/*')
|
table.insert(vimgrep_arguments, '!**/.git/*')
|
||||||
|
|
||||||
telescope.setup({
|
telescope.setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
vimgrep_arguments = vimgrep_arguments,
|
vimgrep_arguments = vimgrep_arguments,
|
||||||
file_ignore_patterns = { "^.git/" }
|
file_ignore_patterns = { "^.git/" }
|
||||||
},
|
},
|
||||||
extensions = {
|
extensions = {
|
||||||
fzf = {}
|
fzf = {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
telescope.load_extension('fzf')
|
telescope.load_extension('fzf')
|
||||||
|
|
||||||
local search = require('search')
|
local search = require('search')
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require('telescope.builtin')
|
||||||
|
|
||||||
search.setup({
|
search.setup({
|
||||||
mappings = { -- optional: configure the mappings for switching tabs (will be set in normal and insert mode(!))
|
mappings = { -- optional: configure the mappings for switching tabs (will be set in normal and insert mode(!))
|
||||||
next = '<Tab>',
|
next = '<Tab>',
|
||||||
prev = '<S-Tab>'
|
prev = '<S-Tab>'
|
||||||
},
|
},
|
||||||
tabs = {
|
tabs = {
|
||||||
{ name = 'Files', tele_func = builtin.find_files, tele_opts = { no_ignore = false, hidden = true, } },
|
{ name = 'Files', tele_func = builtin.find_files, tele_opts = { no_ignore = false, hidden = true, } },
|
||||||
{ name = 'Advanced Grep', tele_func = require('crentist.telescope.advanced_grep').advanced_grep },
|
{ name = 'Advanced Grep', tele_func = require('crentist.telescope.advanced_grep').advanced_grep },
|
||||||
{ name = 'Buffers', tele_func = builtin.buffers },
|
{ name = 'Buffers', tele_func = builtin.buffers },
|
||||||
},
|
},
|
||||||
append_tabs = { -- append_tabs will add the provided tabs to the default ones
|
append_tabs = { -- append_tabs will add the provided tabs to the default ones
|
||||||
{
|
{
|
||||||
'Commits', -- or name = 'Commits'
|
'Commits', -- or name = 'Commits'
|
||||||
builtin.git_commits, -- or tele_func = require('telescope.builtin').git_commits
|
builtin.git_commits, -- or tele_func = require('telescope.builtin').git_commits
|
||||||
available = function() -- optional
|
available = function() -- optional
|
||||||
return vim.fn.isdirectory('.git') == 1
|
return vim.fn.isdirectory('.git') == 1
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'Stash',
|
'Stash',
|
||||||
builtin.git_stash,
|
builtin.git_stash,
|
||||||
available = function()
|
available = function()
|
||||||
return vim.fn.isdirectory('.git') == 1
|
return vim.fn.isdirectory('.git') == 1
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'All files',
|
'All files',
|
||||||
builtin.find_files,
|
builtin.find_files,
|
||||||
tele_opts = { no_ignore = true, hidden = true },
|
tele_opts = { no_ignore = true, hidden = true },
|
||||||
available = function()
|
available = function()
|
||||||
return vim.fn.isdirectory('.git') == 1
|
return vim.fn.isdirectory('.git') == 1
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>pf', search.open, {})
|
vim.keymap.set('n', '<leader>pf', search.open, {})
|
||||||
vim.keymap.set('n', '<leader>pb', function()
|
vim.keymap.set('n', '<leader>pb', function()
|
||||||
search.open({ tab_name = 'Buffers' })
|
search.open({ tab_name = 'Buffers' })
|
||||||
end)
|
end)
|
||||||
vim.keymap.set('n', '<leader>pws', function()
|
vim.keymap.set('n', '<leader>pws', function()
|
||||||
local word = vim.fn.expand('<cword>')
|
local word = vim.fn.expand('<cword>')
|
||||||
builtin.grep_string({ search = word })
|
builtin.grep_string({ search = word })
|
||||||
end)
|
end)
|
||||||
vim.keymap.set('n', '<leader>pWs', function()
|
vim.keymap.set('n', '<leader>pWs', function()
|
||||||
local word = vim.fn.expand('<cWORD>')
|
local word = vim.fn.expand('<cWORD>')
|
||||||
builtin.grep_string({ search = word })
|
builtin.grep_string({ search = word })
|
||||||
end)
|
end)
|
||||||
vim.keymap.set('n', '<leader>ps', function()
|
vim.keymap.set('n', '<leader>ps', function()
|
||||||
builtin.grep_string({ search = vim.fn.input('Grep > ') })
|
builtin.grep_string({ search = vim.fn.input('Grep > ') })
|
||||||
end)
|
end)
|
||||||
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
|
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ return {
|
|||||||
"vimdoc",
|
"vimdoc",
|
||||||
"latex",
|
"latex",
|
||||||
"json",
|
"json",
|
||||||
"yaml",
|
|
||||||
"git_config",
|
"git_config",
|
||||||
"git_rebase",
|
"git_rebase",
|
||||||
"gitattributes",
|
"gitattributes",
|
||||||
@@ -43,6 +42,7 @@ return {
|
|||||||
}
|
}
|
||||||
ts.setup()
|
ts.setup()
|
||||||
ts.install(installed_parsers)
|
ts.install(installed_parsers)
|
||||||
|
vim.treesitter.language.register('yaml', 'yaml_gitlab')
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,3 +45,7 @@ vim.keymap.set("n", "<C-M-k>", "<cmd>cprev<CR>")
|
|||||||
|
|
||||||
vim.keymap.set("n", "<F12>", "<cmd>PrtChatToggle<CR>")
|
vim.keymap.set("n", "<F12>", "<cmd>PrtChatToggle<CR>")
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>cp', function()
|
||||||
|
vim.fn.setreg('+', vim.fn.expand('%'))
|
||||||
|
end, { desc = 'Copy file path' })
|
||||||
|
|
||||||
|
|||||||
@@ -34,3 +34,5 @@ vim.opt.colorcolumn = "80"
|
|||||||
|
|
||||||
vim.opt.diffopt = 'internal,filler,closeoff,algorithm:histogram'
|
vim.opt.diffopt = 'internal,filler,closeoff,algorithm:histogram'
|
||||||
|
|
||||||
|
vim.opt.mouse = ''
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
--- @class SopsRunner
|
||||||
|
--- @field config SopsConfig
|
||||||
|
--- @field run fun(self: SopsRunner, args: table, envs: table): string|nil, string|nil a simple run, accepts a list of arguments
|
||||||
|
--- @field to_table fun(self: SopsRunner, file: string): table|nil, string|nil convert structured file to lua table
|
||||||
|
--- @field decrypt fun(self: SopsRunner, file: string, args: table?): string|nil, string|nil decrypt encrypted file
|
||||||
|
--- @field debug fun(self: SopsRunner): nil
|
||||||
|
|
||||||
|
--- @class SopsConfig
|
||||||
|
--- @field sops_bin? string
|
||||||
|
--- @field extra_args? table
|
||||||
|
|
||||||
|
--- @param opts SopsConfig
|
||||||
|
--- @return SopsRunner
|
||||||
|
M.create_runner = function (opts)
|
||||||
|
opts = opts or {}
|
||||||
|
opts.sops_bin = opts.sops_bin or 'sops'
|
||||||
|
opts.extra_args = opts.extra_args or {}
|
||||||
|
|
||||||
|
local runner = {
|
||||||
|
config = {
|
||||||
|
sops_bin = opts.sops_bin or 'sops',
|
||||||
|
extra_args = opts.extra_args or {}
|
||||||
|
} --[[@as SopsConfig]]
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Generic runner
|
||||||
|
--- @param self SopsRunner
|
||||||
|
--- @param args table
|
||||||
|
--- @param envs table|nil
|
||||||
|
--- @return string|nil, string|nil
|
||||||
|
function runner:run(args, envs)
|
||||||
|
envs = envs or {}
|
||||||
|
local command = {self.config.sops_bin}
|
||||||
|
vim.list_extend(command, self.config.extra_args)
|
||||||
|
vim.list_extend(command, args)
|
||||||
|
|
||||||
|
local result = vim.system(command, {text = true, env = envs}):wait()
|
||||||
|
if result.code ~= 0 then
|
||||||
|
return nil, "Command returned non-zero exit code: " .. result.stderr
|
||||||
|
end
|
||||||
|
|
||||||
|
return result.stdout, nil
|
||||||
|
end
|
||||||
|
|
||||||
|
function runner:decrypt(file, extra_args)
|
||||||
|
extra_args = extra_args or {}
|
||||||
|
|
||||||
|
local run_args = {}
|
||||||
|
vim.list_extend(run_args, extra_args)
|
||||||
|
|
||||||
|
table.insert(run_args, '-d')
|
||||||
|
table.insert(run_args, file) -- a separate call to ensure that file is always passed the last
|
||||||
|
|
||||||
|
return self:run(run_args)
|
||||||
|
end
|
||||||
|
function runner:debug()
|
||||||
|
local edit_script = vim.fn.fnamemodify('scripts/editor.sh', ':p')
|
||||||
|
vim.print(edit_script)
|
||||||
|
end
|
||||||
|
|
||||||
|
function runner:edit(file, extra_args)
|
||||||
|
extra_args = extra_args or {}
|
||||||
|
|
||||||
|
local edit_script = vim.fn.fnamemodify('scripts/editor.sh', ':p')
|
||||||
|
vim.print(edit_script)
|
||||||
|
|
||||||
|
local edit_args = {}
|
||||||
|
|
||||||
|
vim.list_extend(edit_args, extra_args)
|
||||||
|
|
||||||
|
table.insert(edit_args, 'edit')
|
||||||
|
table.insert(edit_args, file)
|
||||||
|
|
||||||
|
return self:run(edit_args, {EDITOR="./scripts/editor.sh"})
|
||||||
|
end
|
||||||
|
|
||||||
|
function runner:to_table(file)
|
||||||
|
local expanded_file = vim.fn.fnamemodify(file, ':p')
|
||||||
|
local result, err = self:decrypt(expanded_file, {'--output-type', 'json'})
|
||||||
|
if err then
|
||||||
|
return nil, 'Failed converting to json: ' .. err
|
||||||
|
end
|
||||||
|
|
||||||
|
return vim.fn.json_decode(result), nil
|
||||||
|
end
|
||||||
|
return runner --[[@as SopsRunner]]
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
||||||
Reference in New Issue
Block a user