26 Commits

Author SHA1 Message Date
869be617bf parrot: add F12 keymap to toggle chat 2025-12-10 09:50:27 +02:00
fddc6b8ee1 blink: enable friendly-snippets 2025-12-10 09:48:31 +02:00
70dfeab75c parrot: replace input with buffer instead of ui.input 2025-12-10 09:48:16 +02:00
7dad3514e0 parrot: update models 2025-12-10 09:48:04 +02:00
cd7f789302 fix C-l keybind 2025-12-10 09:38:27 +02:00
405ec5da4f remove vim-helm 2025-12-09 10:22:11 +02:00
788ef34c04 upgrade plugins 2025-12-09 10:21:56 +02:00
a44a75b745 Revert "upgrade nvim plugins"
This reverts commit 74e77ca34a.
2025-12-08 16:56:33 +02:00
74e77ca34a upgrade nvim plugins 2025-12-06 15:22:11 +02:00
a4a48adc08 upgrade blink, switch to C-n for completion 2025-12-06 15:19:33 +02:00
3dbb63738b fugitive keymaps 2025-12-03 12:45:48 +02:00
3c768051f5 json ftplugin 2025-12-03 12:44:21 +02:00
39b68e0d54 restructure snippets 2025-12-03 12:44:11 +02:00
24bb947547 advanced_grep: allow looking for directories or files 2025-11-04 10:25:00 +02:00
9d9934f133 add testing directory 2025-11-04 10:09:43 +02:00
7e7a4a5543 fix advanced search auto globbing feature 2025-11-04 10:02:32 +02:00
f38e7720e1 dadbod ui location, enable completion for mysql 2025-10-24 10:13:10 +03:00
0b756ba15f replace helm-ls configuration with the nvim 0.11 2025-10-24 10:12:46 +03:00
bd6f9a6279 replace selected text keymap 2025-10-24 10:11:40 +03:00
6abfea8c60 fix git filepattern for treesitter 2025-10-24 10:11:25 +03:00
0e4c1c54c4 https://github.com/neovim/neovim/issues/22696
remove diffopt to avoid bad experience in 3-way merges
2025-10-24 10:10:24 +03:00
42ca780fac parrot: reformat 2025-10-15 10:13:22 +03:00
89a49ccc5d nvim: explicitly set winborder to empty string for now 2025-10-15 10:13:05 +03:00
cd2434ca93 oil: restore border 2025-10-15 10:12:37 +03:00
fed56619b9 blink-cmp: upgrade to 1.7.0 2025-10-15 09:55:40 +03:00
03492410b0 telescope: refactor search panels and how they handle hidden files 2025-10-15 09:46:28 +03:00
21 changed files with 289 additions and 241 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
lua/testing

7
after/ftplugin/json.lua Normal file
View File

@@ -0,0 +1,7 @@
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.expandtab = true
vim.opt_local.conceallevel = 0

View File

@@ -1,50 +1,49 @@
{
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
"blink-ripgrep.nvim": { "branch": "main", "commit": "d6e2b1356a8c184d4d254f7d32635f4b637d0bf0" },
"blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" },
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
"blink-ripgrep.nvim": { "branch": "main", "commit": "64e26b597303d9ed175f8ed832df8328731b93cd" },
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" },
"fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" },
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"fzf-lua": { "branch": "main", "commit": "db3ccffe79480543d8e0f7b0cac0d9b220f9486e" },
"gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" },
"fzf-lua": { "branch": "main", "commit": "43bda24f711e0c13428f16056002aebc20b38e04" },
"gitsigns.nvim": { "branch": "main", "commit": "5813e4878748805f1518cee7abb50fd7205a3a48" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" },
"hererocks": { "branch": "master", "commit": "160228946bed9998f5e3b168bd0b66ba2690f8f3" },
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
"hererocks": { "branch": "master", "commit": "f540b58acb0952bc82f5465b3c45999d2fe39ece" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
"lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" },
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "6bdb14f230de0904229ec367b410fb817e59b072" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "4c60a198e3f92098778a32a1c76d2bd7ba46a3b5" },
"none-ls.nvim": { "branch": "main", "commit": "5cf63841461b49989972d35bf886e076a1ab3649" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c55bd8a8fb191e24176c206a7af1dd51ce7276a5" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
"none-ls.nvim": { "branch": "main", "commit": "5abf61927023ea83031753504adb19630ba80eef" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lspconfig": { "branch": "master", "commit": "5bfcc89fd155b4ffc02d18ab3b7d19c2d4e246a7" },
"nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" },
"nvim-navic": { "branch": "master", "commit": "7d914a39a1ef8f4e22c2c4381abeef7c556f5a13" },
"nvim-sops": { "branch": "main", "commit": "cb2209562d00ef8c6c88bdec836d9edb8fbb96ef" },
"nvim-surround": { "branch": "main", "commit": "a868c256c861044beb9794b4dd126480dcdfbdad" },
"nvim-treesitter": { "branch": "main", "commit": "0606c7a9dcaa5c5beee0b0f09043e9fdd1ba0a68" },
"nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
"nvim-treesitter": { "branch": "main", "commit": "f47f549f74cea5d5f25a5205c9e127cd882f1d20" },
"nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" },
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
"obsidian.nvim": { "branch": "main", "commit": "6b2a22a74d1c883e797764c28f75aa6b532a1ae4" },
"oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" },
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
"obsidian.nvim": { "branch": "main", "commit": "6939efc2c7145cf83644192c588eccd935b57826" },
"oil.nvim": { "branch": "master", "commit": "cbcb3f997f6f261c577b943ec94e4ef55108dd95" },
"parrot.nvim": { "branch": "main", "commit": "dcae923c7070431c8cb628b19594ab640168684c" },
"plenary": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
"render-markdown.nvim": { "branch": "main", "commit": "d53856423be5ef3c267d26ee261b0981b372f718" },
"render-markdown.nvim": { "branch": "main", "commit": "b2b135347e299ffbf7f4123fb7811899b0c9f4b8" },
"search.nvim": { "branch": "main", "commit": "7b8f2315d031be73e14bc2d82386dfac15952614" },
"statuscol.nvim": { "branch": "main", "commit": "c46172d0911aa5d49ba5f39f4351d1bb7aa289cc" },
"tabby.nvim": { "branch": "main", "commit": "b3affa6db7eab80fca2a2db5b73b473144507039" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" },
"trouble.nvim": { "branch": "main", "commit": "c098362fe603d3922095e7db595961e020bdf2d0" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
"telescope.nvim": { "branch": "master", "commit": "e69b434b968a33815e2f02a5c7bd7b8dd4c7d4b2" },
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
"vim-dadbod": { "branch": "master", "commit": "e95afed23712f969f83b4857a24cf9d59114c2e6" },
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
"vim-dadbod-ui": { "branch": "master", "commit": "e8b53c0f3aa6e6127ac2a2d2071d9aade6c6e373" },
"vim-dadbod-ui": { "branch": "master", "commit": "48c4f271da13d380592f4907e2d1d5558044e4e5" },
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
"vim-helm": { "branch": "master", "commit": "2c8525fd98e57472769d137317bca83e477858ce" },
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" }
}

View File

@@ -76,7 +76,7 @@ autocmd({ 'FileType' }, {
'latex',
'json',
'yaml*',
'git*',
'git.+',
'make',
'markdown*',
},

View File

@@ -3,6 +3,6 @@ require("crentist.set")
require("crentist.lazy_init")
require("crentist.autocmd")
require("crentist.filetype")
require("crentist.luasnip")
require("crentist.snippets")
require("crentist.null-ls")

View File

@@ -7,7 +7,7 @@ return {
{ 'L3MON4D3/LuaSnip', version = 'v2.*' }
},
-- use a release tag to download pre-built binaries
version = 'v1.6.*',
version = 'v1.8.*',
---@module 'blink-cmp'
---@type blink.cmp.Config
@@ -35,12 +35,7 @@ return {
}
},
completion = { list = { selection = { preselect = false, auto_insert = true } } },
keymap = {
preset = 'enter',
['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
},
keymap = { preset = 'enter' },
appearance = {
use_nvim_cmp_as_default = true,
nerd_font_variant = 'mono'
@@ -49,7 +44,8 @@ return {
sources = {
default = { 'lazydev', 'lsp', 'snippets', 'ripgrep', 'path', 'buffer' },
per_filetype = {
sql = { 'snippets', 'dadbod', 'buffer', 'ripgrep' }
sql = { 'snippets', 'dadbod', 'buffer', 'ripgrep' },
mysql = { 'snippets', 'dadbod', 'buffer', 'ripgrep' },
},
providers = {
lazydev = {
@@ -94,6 +90,11 @@ return {
dadbod = {
name = 'Dadbod', module = 'vim_dadbod_completion.blink'
},
snippets = {
opts = {
friendly_snippets = true,
}
},
},
},

View File

@@ -14,7 +14,7 @@ return {
-- Your DBUI configuration
vim.g.db_ui_use_nerd_fonts = 1
vim.g.db_ui_auto_execute_table_helpers = 1
vim.g.db_ui_win_position = 'right'
vim.g.db_ui_win_position = 'left'
end,
}

View File

@@ -2,6 +2,7 @@ return {
'tpope/vim-fugitive',
config = function()
vim.keymap.set('n', "<leader>gs", vim.cmd.Git)
vim.keymap.set('n', "<leader><leader>gl", function () vim.cmd.Git({ 'pull' }) end)
vim.api.nvim_create_user_command('Gcm', function() vim.cmd.Git({ 'switch main' }) end, {})
@@ -26,10 +27,6 @@ return {
vim.keymap.set('n', "<leader>P", function()
vim.cmd.Git({ 'pull', '--rebase' })
end, opts)
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
-- needed if i did not set the branch up correctly
vim.keymap.set('n', "<leader>t", ":Git push -u origin ", opts);
end,
})
end

View File

@@ -8,7 +8,6 @@ return {
'L3MON4D3/LuaSnip',
'j-hui/fidget.nvim',
'rafamadriz/friendly-snippets',
{ 'towolf/vim-helm', ft = 'helm' },
{
'folke/lazydev.nvim',
ft = 'lua', -- only load on lua files
@@ -78,27 +77,14 @@ return {
}
})
-- leave it until it works with lsp.config
lspconfig.helm_ls.setup {
vim.lsp.config('helm-ls', {
settings = {
['helm-ls'] = {
yamlls = {
enabled = false,
path = "yaml-language-server",
helmLint = { enabled = false },
yamlls = { enabled = false },
},
}
}
}
}
-- vim.lsp.config('helm-ls', {
-- settings = {
-- ['helm-ls'] = {
-- yamlls = {
-- path = "yaml-language-server",
-- enabled = false,
-- }
-- }
-- }
-- })
})
vim.lsp.config('terraformls', {
filetypes = { 'terraform', 'terraform-vars', 'tf' }

View File

@@ -5,6 +5,18 @@ return {
view_options = {
show_hidden = true,
},
float = {
border = 'rounded',
},
confirmation = {
border = 'rounded',
},
progress = {
border = 'rounded',
},
keymaps_help = {
border = 'rounded',
},
keymaps = {
['<C-h>'] = false,
['<C-j>'] = false,

View File

@@ -1,19 +1,19 @@
return {
'frankroeder/parrot.nvim',
version = "2.3.0",
version = '2.3.0',
dependencies = { 'ibhagwan/fzf-lua', 'nvim-lua/plenary.nvim' },
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" },
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",
['Content-Type'] = "application/json",
['x-api-key'] = self.api_key,
['anthropic-version'] = "2023-06-01",
}
end,
params = {
@@ -21,14 +21,14 @@ return {
command = { max_tokens = 4096 },
},
models = {
"claude-opus-4-1-20250805",
"claude-sonnet-4-20250514",
'claude-opus-4-5-20251101',
'claude-haiku-4-5-20251001',
},
preprocess_payload = function(payload)
for _, message in ipairs(payload.messages) do
message.content = message.content:gsub("^%s*(.-)%s*$", "%1")
message.content = message.content:gsub('^%s*(.-)%s*$', "%1")
end
if payload.messages[1] and payload.messages[1].role == "system" then
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
@@ -37,7 +37,8 @@ return {
return payload
end,
}
}
},
user_input_ui = "buffer",
}
}

View File

@@ -22,13 +22,7 @@ return {
telescope.setup({
defaults = {
vimgrep_arguments = vimgrep_arguments,
file_ignore_patterns = {
'node_modules',
'galaxy-roles',
'galaxy-collections',
'.git',
'.terraform',
}
file_ignore_patterns = { "^.git/" }
},
extensions = {
fzf = {}
@@ -46,7 +40,7 @@ return {
prev = '<S-Tab>'
},
tabs = {
{ name = 'Files', tele_func = builtin.find_files, tele_opts = { no_ignore = true, 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 = 'Buffers', tele_func = builtin.buffers },
},
@@ -65,6 +59,14 @@ return {
return vim.fn.isdirectory('.git') == 1
end
},
{
'All files',
builtin.find_files,
tele_opts = { no_ignore = true, hidden = true },
available = function()
return vim.fn.isdirectory('.git') == 1
end
}
},
})

View File

@@ -1,158 +0,0 @@
-- luasnip.lua
local ls = require('luasnip')
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local fmt = require("luasnip.extras.fmt").fmt
local vscode_loader = require("luasnip.loaders.from_vscode")
vim.keymap.set({ "i", "s" }, "<C-l>", function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, { desc = "Snippet next argument", silent = true })
--------------------
-- Snippets for LUA
--------------------
ls.add_snippets('lua', {
s({ name = 'LuaSnip Snippet', trig = 'snipf' },
fmt([[
s({ name='<name>', trig='<trig>'},
fmt(<template>,
{ <inputs> },
{ <opts> }
)
),
]], {
name = i(1, 'name'),
trig = i(2, 'trig'),
template = i(3, '[[]]'),
inputs = i(4, 'nodes'),
opts = i(5,
'opts')
},
{ delimiters = '<>' }
)
),
s({ name = 'Add snippets block', trig = 'add_snip' },
fmt([[
ls.add_snippets('<filetype>', {
<snippets>
})
]],
{ filetype = i(1, 'Filetype'), snippets = i(2, 'Snippets') },
{ delimiters = '<>' }
)
),
})
--------------------
-- Generic snippets
--------------------
local function com_string(_, snip, to_multiply)
local comment_string = vim.bo.commentstring
local repeats = snip.captures[1]
local result = comment_string:gsub("%%s", ""):gsub(" ", "")
if to_multiply then
return string.sub(
string.rep(result, repeats),
0,
repeats
)
end
return result
end
ls.add_snippets('all', {
s({ name = 'Comment block', trig = '#com(%d+)', regTrig = true },
fmt([[
{comment_block}
{comment} {comment_text}
{comment_block}
]],
{
comment_block = f(com_string, {}, { user_args = { true } }),
comment = f(com_string, {}, { user_args = { false } }),
comment_text = i(1,
'Comment')
}
)
),
})
--------------------
-- Terraform
--------------------
ls.add_snippets('terraform', {
s({ name = 'data_assume', trig = 'tf_assume' },
fmt([[
data "aws_iam_policy_document" "<name>" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["<service>.amazonaws.com"]
}
}
}
]],
{
name = i(1, 'assume'),
service = i(2, 'service')
},
{ delimiters = '<>' }
)
),
})
------------------------------
-- YAML
------------------------------
local yaml_schema_snippet = s(
{ name = 'yaml_schema', trig = 'yaml_schema' },
fmt([[
{comment} yaml-language-server: $schema={path}
]],
{
path = i(1, 'path'),
comment = f(com_string, {}, { user_args = { false } }),
}
)
)
ls.add_snippets('yaml', { yaml_schema_snippet })
ls.add_snippets('helm', { yaml_schema_snippet })
local flux_cd_kustomization = s(
{ name = 'fluxcd_kustomization', trig = 'fluxkust' },
fmt([[
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: {name}
namespace: {namespace}
spec:
interval: {interval}
path: {path}
prune: true
sourceRef:
kind: GitRepository
name: {repository_name}
]],
{
name = i(1, 'name'),
namespace = i(2, 'flux-system'),
interval = i(3, '5m'),
path = i(4, 'path'),
repository_name = i(5, 'repository_name'),
}
)
)
ls.add_snippets('yaml', { flux_cd_kustomization })

View File

@@ -32,6 +32,8 @@ vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>S", [[:%s/\<<C-r><C-a>\>/<C-r><C-a>/gI<Left><Left><Left>]])
vim.keymap.set("v", "<leader>s", [["vy:%s/\<<C-r>v\>/<C-r>v/gI<Left><Left><Left>]])
vim.keymap.set("n", "<C-s>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set("n", "<leader><leader>x", "<cmd>source %<CR>")
@@ -41,3 +43,5 @@ vim.keymap.set("v", "<leader>x", ":lua<CR>")
vim.keymap.set("n", "<C-M-j>", "<cmd>cnext<CR>")
vim.keymap.set("n", "<C-M-k>", "<cmd>cprev<CR>")
vim.keymap.set("n", "<F12>", "<cmd>PrtChatToggle<CR>")

View File

@@ -8,6 +8,8 @@ vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.o.winborder = ''
vim.opt.smartindent = true
vim.opt.wrap = false
@@ -30,3 +32,5 @@ vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"
vim.opt.diffopt = 'internal,filler,closeoff,algorithm:histogram'

View File

@@ -0,0 +1,45 @@
local ls = require('luasnip')
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local fmt = require('luasnip.extras.fmt').fmt
vim.keymap.set({ 'i', 's' }, '<C-l>', function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, { desc = 'Snippet next argument', silent = true })
local function com_string(_, snip, to_multiply)
local comment_string = vim.bo.commentstring
local repeats = snip.captures[1]
local result = comment_string:gsub('%%s', ''):gsub(' ', '')
if to_multiply then
return string.sub(
string.rep(result, repeats),
0,
repeats
)
end
return result
end
ls.add_snippets('all', {
s({ name = 'Comment block', trig = '#com(%d+)', regTrig = true },
fmt([[
{comment_block}
{comment} {comment_text}
{comment_block}
]],
{
comment_block = f(com_string, {}, { user_args = { true } }),
comment = f(com_string, {}, { user_args = { false } }),
comment_text = i(1,
'Comment')
}
)
),
})

View File

@@ -0,0 +1,5 @@
require('crentist.snippets.common')
require('crentist.snippets.lua')
require('crentist.snippets.terraform')
require('crentist.snippets.yaml')

View File

@@ -0,0 +1,38 @@
local ls = require('luasnip')
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local fmt = require('luasnip.extras.fmt').fmt
ls.add_snippets('lua', {
s({ name = 'LuaSnip Snippet', trig = 'snipf' },
fmt([[
s({ name='<name>', trig='<trig>'},
fmt(<template>,
{ <inputs> },
{ <opts> }
)
),
]], {
name = i(1, 'name'),
trig = i(2, 'trig'),
template = i(3, '[[]]'),
inputs = i(4, 'nodes'),
opts = i(5,
'opts')
},
{ delimiters = '<>' }
)
),
s({ name = 'Add snippets block', trig = 'add_snip' },
fmt([[
ls.add_snippets('<filetype>', {
<snippets>
})
]],
{ filetype = i(1, 'Filetype'), snippets = i(2, 'Snippets') },
{ delimiters = '<>' }
)
),
})

View File

@@ -0,0 +1,29 @@
local ls = require('luasnip')
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local fmt = require('luasnip.extras.fmt').fmt
ls.add_snippets('terraform', {
s({ name = 'data_assume', trig = 'tf_assume' },
fmt([[
data "aws_iam_policy_document" "<name>" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["<service>.amazonaws.com"]
}
}
}
]],
{
name = i(1, 'assume'),
service = i(2, 'service')
},
{ delimiters = '<>' }
)
),
})

View File

@@ -0,0 +1,64 @@
local ls = require('luasnip')
local s = ls.snippet
local i = ls.insert_node
local f = ls.function_node
local fmt = require('luasnip.extras.fmt').fmt
------------------------------
-- YAML
------------------------------
local yaml_schema_snippet = s(
{ name = 'yaml_schema', trig = 'yaml_schema' },
fmt([[
{comment} yaml-language-server: $schema={path}
]],
{
path = i(1, 'path'),
comment = f(com_string, {}, { user_args = { false } }),
}
)
)
ls.add_snippets('yaml', { yaml_schema_snippet })
ls.add_snippets('helm', { yaml_schema_snippet })
local flux_cd_kustomization = s(
{ name = 'fluxcd_kustomization', trig = 'fluxkust' },
fmt([[
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: {name}
namespace: {namespace}
spec:
interval: {interval}
path: {path}
prune: true
sourceRef:
kind: GitRepository
name: {repository_name}
]],
{
name = i(1, 'name'),
namespace = i(2, 'flux-system'),
interval = i(3, '5m'),
path = i(4, 'path'),
repository_name = i(5, 'repository_name'),
}
)
)
ls.add_snippets('yaml', { flux_cd_kustomization })
local sleep_command = s(
{ name = 'sleep_command', trig = 'sleep' },
fmt([[
command:
- /bin/sh
- -c
- while true; do sleep 3600; done
]], {})
)
ls.add_snippets('yaml', { sleep_command })

View File

@@ -27,7 +27,17 @@ local advanced_grep = function(opts)
if pieces[2] then
table.insert(args, "-g")
table.insert(args, pieces[2])
local input_glob = pieces[2]
local glob = input_glob
if not input_glob:find("*", 1, true) then
glob = "*" .. input_glob .. "*"
if input_glob:find("d:", 1, true) then
glob = "**/" .. glob .. "/**"
glob = glob:gsub("d:", "")
end
end
table.insert(args, glob)
end
return vim.iter({ args, { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" } })