Skip to content

Commit

Permalink
chore: add snippets into config
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinm6 committed Dec 30, 2024
1 parent 5564cb1 commit 78cac08
Show file tree
Hide file tree
Showing 76 changed files with 19,731 additions and 96 deletions.
185 changes: 89 additions & 96 deletions lua/plugins/editor/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,117 +5,110 @@
-- Last Modified: 21 Dec 2024, 14:30
-------------------------------------

local snippets_path = vim.fn.has "mac" == 1 and vim.fn.expand "~/dev/snippets"
or vim.fn.stdpath "data" .. "/lazy/snippets"

return {
{ "kevinm6/snippets", dev = true },
{
"saghen/blink.cmp",
event = { "InsertEnter", "CmdlineEnter" },
version = "v0.*",
opts = {
keymap = {
preset = "default",
["<Up>"] = {},
["<Down>"] = {},
"saghen/blink.cmp",
event = { "InsertEnter", "CmdlineEnter" },
version = "v0.*",
opts = {
keymap = {
preset = "default",
["<Up>"] = {},
["<Down>"] = {},
["<C-k>"] = { "select_prev", "fallback" },
["<C-j>"] = { "select_next", "fallback" },
["<C-l>"] = { "select_and_accept" },
["<C-i>"] = { "snippet_forward", "fallback" },
["<C-S-i>"] = { "snippet_backward", "fallback" },
["<C-Space>"] = { "show", "show_documentation", "hide_documentation" },

cmdline = {
["<C-i>"] = { "select_and_accept", "fallback" },
["<C-k>"] = { "select_prev", "fallback" },
["<C-j>"] = { "select_next", "fallback" },
["<C-l>"] = { "select_and_accept" },
["<C-i>"] = { "snippet_forward", "fallback" },
["<C-S-i>"] = { "snippet_backward", "fallback" },
["<C-Space>"] = { "show", "show_documentation", "hide_documentation" },

cmdline = {
["<C-i>"] = { "select_and_accept", "fallback" },
["<C-k>"] = { "select_prev", "fallback" },
["<C-j>"] = { "select_next", "fallback" },
["<C-Space>"] = { "show", "hide" },
["<C-e>"] = { "cancel" },
},
},
appearance = {
nerd_font_variant = "mono",
["<C-Space>"] = { "show", "hide" },
["<C-e>"] = { "cancel" },
},
},
appearance = {
nerd_font_variant = "mono",
},

sources = {
default = { "snippets", "lsp", "path", "buffer", "lazydev" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
snippets = {
opts = {
search_paths = { snippets_path },
extended_filetypes = {
lua = { "luadoc", "nvim_lua" },
sh = { "shelldoc" },
java = { "javadoc", "java_tests" },
},
sources = {
default = { "snippets", "lsp", "path", "buffer", "lazydev" },
providers = {
lazydev = {
name = "LazyDev",
module = "lazydev.integrations.blink",
score_offset = 100,
},
snippets = {
opts = {
extended_filetypes = {
lua = { "luadoc", "nvim_lua" },
sh = { "shelldoc" },
java = { "javadoc", "java_tests" },
},
},
},
min_keyword_length = function(ctx)
return ctx.mode == "cmdline" and 2 or 0
end,
},
signature = {
enabled = true,
window = {
max_width = math.ceil(vim.o.columns * 0.6),
max_height = math.ceil(vim.o.lines * 0.4),
},
min_keyword_length = function(ctx)
return ctx.mode == "cmdline" and 2 or 0
end,
},
signature = {
enabled = true,
window = {
max_width = math.ceil(vim.o.columns * 0.6),
max_height = math.ceil(vim.o.lines * 0.4),
},
completion = {
keyword = {
regex = "[-_/]\\|\\k",
exclude_from_prefix_regex = "[\\.]",
},
accept = {
auto_brackets = { enabled = true },
},
list = {
selection = function(ctx)
return ctx.mode == "cmdline" and "auto_insert" or "preselect"
end,
},
menu = {
scrollbar = false,
min_width = 32,
winblend = vim.o.pumblend,
draw = {
treesitter = { "lsp" },
-- align_to_component = "kind_icon",
-- columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } },
columns = { { "kind_icon" }, { "label", "label_description", gap = 1 } },
components = {
label = { ellipsis = true, width = { fill = true, max = 32 } },
label_description = { ellipsis = true, width = { fill = true, max = 26 } },
kind_icon = {
ellipsis = false,
text = function(ctx)
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
return kind_icon
end,
},
},
completion = {
keyword = {
regex = "[-_/]\\|\\k",
exclude_from_prefix_regex = "[\\.]",
},
accept = {
auto_brackets = { enabled = true },
},
list = {
selection = function(ctx)
return ctx.mode == "cmdline" and "auto_insert" or "preselect"
end,
},
menu = {
scrollbar = false,
min_width = 32,
winblend = vim.o.pumblend,
draw = {
treesitter = { "lsp" },
-- align_to_component = "kind_icon",
-- columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind" } },
columns = { { "kind_icon" }, { "label", "label_description", gap = 1 } },
components = {
label = { ellipsis = true, width = { fill = true, max = 32 } },
label_description = { ellipsis = true, width = { fill = true, max = 26 } },
kind_icon = {
ellipsis = false,
text = function(ctx)
local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind)
return kind_icon
end,
},
},
},
documentation = {
auto_show = true,
window = {
min_width = 24,
scrollbar = false,
direction_priority = {
menu_north = { "e", "n", "w", "s" },
menu_south = { "e", "n", "s", "w" },
},
},
documentation = {
auto_show = true,
window = {
min_width = 24,
scrollbar = false,
direction_priority = {
menu_north = { "e", "n", "w", "s" },
menu_south = { "e", "n", "s", "w" },
},
},
ghost_text = { enabled = true },
},
ghost_text = { enabled = true },
},
},
}
}
Loading

0 comments on commit 78cac08

Please sign in to comment.