This commit is contained in:
meml0rz
2024-11-13 17:46:28 +01:00
parent dd9e21ccc5
commit 2a3c9a1ede
4 changed files with 81 additions and 46 deletions

View File

@ -2,32 +2,72 @@ _:
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 end
return valid_bufs end
return valid_bufs
end end
''; '';
in in
{ {
programs.nixvim.plugins = { programs.nixvim.plugins = {
blink-cmp = {
enable = true;
};
cmp = { cmp = {
enable = true; enable = true;
autoEnableSources = true; autoEnableSources = true;
settings = { settings = {
completion = {
keyword_length = 1;
completeopt = [
"menu"
"menuone"
"noinsert"
"noselect"
];
};
sorting = {
comparators = [
"require('cmp.config.compare').offset"
"require('cmp.config.compare').exact"
"require('cmp.config.compare').score"
"require('cmp.config.compare').recently_used"
"require('cmp.config.compare').locality"
"require('cmp.config.compare').kind"
"require('cmp.config.compare').length"
"require('cmp.config.compare').order"
];
};
mapping = { mapping = {
"<C-b>" = "cmp.mapping.scroll_docs(-4)"; "<C-Down>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)"; "<c-Up>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()"; "<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.abort()"; "<C-e>" = "cmp.mapping.abort()";
"<C-Left>" = "cmp.mapping.abort()"; "<C-Left>" = "cmp.mapping.abort()";
"<Up>" = "cmp.mapping.select_prev_item()"; "<Tab>".__raw = ''
"<Down>" = "cmp.mapping.select_next_item()"; cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end, { "i", "s" })
'';
"<S-Tab>".__raw = ''
cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" })
'';
"<CR>" = "cmp.mapping.confirm({ select = false })"; "<CR>" = "cmp.mapping.confirm({ select = false })";
}; };
@ -86,14 +126,6 @@ in
name = "git"; name = "git";
priority = 250; priority = 250;
} }
{
name = "calc";
priority = 150;
}
{
name = "emoji";
priority = 100;
}
]; ];
}; };
}; };

View File

@ -1,5 +1,7 @@
{ {
programs.nixvim.plugins = { programs.nixvim.plugins = {
clangd-extensions.enable = true;
crates-nvim.enable = true;
lsp-format = { lsp-format = {
enable = true; enable = true;
}; };

View File

@ -6,6 +6,7 @@
settings = { settings = {
updateInInsert = false; updateInInsert = false;
}; };
sources = { sources = {
code_actions = { code_actions = {
gitsigns.enable = true; gitsigns.enable = true;

View File

@ -26,38 +26,38 @@
vim.opt.softtabstop = 4 vim.opt.softtabstop = 4
vim.opt.number = true; vim.opt.number = true;
vim.cmd [[ vim.cmd [[
cnoreabbrev W! w! cnoreabbrev W! w!
cnoreabbrev Q! q! cnoreabbrev Q! q!
cnoreabbrev Qall! qall! cnoreabbrev Qall! qall!
cnoreabbrev Wq wq cnoreabbrev Wq wq
cnoreabbrev Wa wa cnoreabbrev Wa wa
cnoreabbrev wQ wq cnoreabbrev wQ wq
cnoreabbrev WQ wq cnoreabbrev WQ wq
cnoreabbrev W w cnoreabbrev W w
cnoreabbrev Q q cnoreabbrev Q q
cnoreabbrev Qall qall cnoreabbrev Qall qall
]] ]]
local _border = "rounded" local _border = "rounded"
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
vim.lsp.handlers.hover, { vim.lsp.handlers.hover, {
border = _border border = _border
} }
) )
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
vim.lsp.handlers.signature_help, { vim.lsp.handlers.signature_help, {
border = _border border = _border
} }
) )
vim.diagnostic.config{ vim.diagnostic.config{
float={border=_border} float={border=_border}
}; };
require('lspconfig.ui.windows').default_options = { require('lspconfig.ui.windows').default_options = {
border = _border border = _border
} }
''; '';
}; };
} }