kekl
This commit is contained in:
@ -1,154 +1,126 @@
|
|||||||
_:
|
_:
|
||||||
let
|
let
|
||||||
get_bufnrs.__raw = ''
|
get_bufnrs.__raw = ''
|
||||||
function()
|
function()
|
||||||
local buf_size_limit = 1024 * 1024 -- 1MB size limit
|
local buf_size_limit = 1024 * 1024 -- 1MB size limit
|
||||||
local bufs = vim.api.nvim_list_bufs()
|
local bufs = vim.api.nvim_list_bufs()
|
||||||
local valid_bufs = {}
|
local valid_bufs = {}
|
||||||
for _, buf in ipairs(bufs) do
|
for _, buf in ipairs(bufs) do
|
||||||
if vim.api.nvim_buf_is_loaded(buf) and vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf)) < buf_size_limit then
|
if vim.api.nvim_buf_is_loaded(buf) and vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf)) < buf_size_limit then
|
||||||
table.insert(valid_bufs, buf)
|
table.insert(valid_bufs, buf)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return valid_bufs
|
||||||
end
|
end
|
||||||
end
|
'';
|
||||||
return valid_bufs
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.nixvim.plugins = {
|
programs.nixvim.plugins = {
|
||||||
cmp = {
|
cmp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autoEnableSources = true;
|
autoEnableSources = true;
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
mapping = {
|
mapping = {
|
||||||
"<C-d>" = # Lua
|
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||||
"cmp.mapping.scroll_docs(-4)";
|
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||||
"<C-f>" = # Lua
|
"<C-Space>" = "cmp.mapping.complete()";
|
||||||
"cmp.mapping.scroll_docs(4)";
|
"<C-e>" = "cmp.mapping.close()";
|
||||||
"<C-Space>" = # Lua
|
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
|
||||||
"cmp.mapping.complete()";
|
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
|
||||||
"<C-e>" = # Lua
|
"<CR>" = "cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace })";
|
||||||
"cmp.mapping.close()";
|
};
|
||||||
"<Tab>" = # Lua
|
|
||||||
"cmp.mapping(cmp.mapping.select_next_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
|
preselect = "cmp.PreselectMode.None";
|
||||||
"<S-Tab>" = # Lua
|
|
||||||
"cmp.mapping(cmp.mapping.select_prev_item({behavior = cmp.SelectBehavior.Select}), {'i', 's'})";
|
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
|
||||||
"<CR>" = # Lua
|
|
||||||
"cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace })";
|
sources = [
|
||||||
|
{
|
||||||
|
name = "nvim_lsp";
|
||||||
|
priority = 1000;
|
||||||
|
option = {
|
||||||
|
inherit get_bufnrs;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "nvim_lsp_signature_help";
|
||||||
|
priority = 1000;
|
||||||
|
option = {
|
||||||
|
inherit get_bufnrs;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "nvim_lsp_document_symbol";
|
||||||
|
priority = 1000;
|
||||||
|
option = {
|
||||||
|
inherit get_bufnrs;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "treesitter";
|
||||||
|
priority = 850;
|
||||||
|
option = {
|
||||||
|
inherit get_bufnrs;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "luasnip";
|
||||||
|
priority = 750;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "buffer";
|
||||||
|
priority = 500;
|
||||||
|
option = {
|
||||||
|
inherit get_bufnrs;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "path";
|
||||||
|
priority = 300;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "cmdline";
|
||||||
|
priority = 300;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "git";
|
||||||
|
priority = 250;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "calc";
|
||||||
|
priority = 150;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "emoji";
|
||||||
|
priority = 100;
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
preselect = # Lua
|
|
||||||
"cmp.PreselectMode.None";
|
|
||||||
|
|
||||||
snippet.expand = # Lua
|
|
||||||
"function(args) require('luasnip').lsp_expand(args.body) end";
|
|
||||||
|
|
||||||
sources = [
|
|
||||||
{
|
|
||||||
name = "nvim_lsp";
|
|
||||||
priority = 1000;
|
|
||||||
option = {
|
|
||||||
inherit get_bufnrs;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "nvim_lsp_signature_help";
|
|
||||||
priority = 1000;
|
|
||||||
option = {
|
|
||||||
inherit get_bufnrs;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "nvim_lsp_document_symbol";
|
|
||||||
priority = 1000;
|
|
||||||
option = {
|
|
||||||
inherit get_bufnrs;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "treesitter";
|
|
||||||
priority = 850;
|
|
||||||
option = {
|
|
||||||
inherit get_bufnrs;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "luasnip";
|
|
||||||
priority = 750;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "buffer";
|
|
||||||
priority = 500;
|
|
||||||
option = {
|
|
||||||
inherit get_bufnrs;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "copilot";
|
|
||||||
priority = 400;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "rg";
|
|
||||||
priority = 300;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "path";
|
|
||||||
priority = 300;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "cmdline";
|
|
||||||
priority = 300;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "spell";
|
|
||||||
priority = 300;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "git";
|
|
||||||
priority = 250;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "zsh";
|
|
||||||
priority = 250;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "calc";
|
|
||||||
priority = 150;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
name = "emoji";
|
|
||||||
priority = 100;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
friendly-snippets.enable = true;
|
friendly-snippets.enable = true;
|
||||||
luasnip.enable = true;
|
luasnip.enable = true;
|
||||||
|
|
||||||
lspkind = {
|
lspkind = {
|
||||||
enable = true;
|
|
||||||
|
|
||||||
cmp = {
|
|
||||||
enable = true;
|
enable = true;
|
||||||
|
cmp = {
|
||||||
menu = {
|
enable = true;
|
||||||
buffer = "";
|
menu = {
|
||||||
calc = "";
|
buffer = "";
|
||||||
cmdline = "";
|
calc = "";
|
||||||
codeium = "";
|
cmdline = "";
|
||||||
emoji = "";
|
codeium = "";
|
||||||
git = "";
|
emoji = "";
|
||||||
luasnip = "";
|
git = "";
|
||||||
neorg = "";
|
luasnip = "";
|
||||||
nvim_lsp = "";
|
neorg = "";
|
||||||
nvim_lua = "";
|
nvim_lsp = "";
|
||||||
path = "";
|
nvim_lua = "";
|
||||||
spell = "";
|
path = "";
|
||||||
treesitter = "";
|
spell = "";
|
||||||
|
treesitter = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user