This commit is contained in:
meml0rz
2024-11-13 01:04:02 +01:00
parent 140307560e
commit 0d6dab2bb0
4 changed files with 256 additions and 247 deletions

View File

@ -1,125 +1,125 @@
_: _:
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 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-b>" = "cmp.mapping.scroll_docs(-4)"; "<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)"; "<C-f>" = "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()";
"<CR>" = "cmp.mapping.confirm({ select = false })"; "<CR>" = "cmp.mapping.confirm({ select = false })";
};
preselect = "cmp.PreselectMode.None";
snippet.expand = "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 = "path";
priority = 300;
}
{
name = "cmdline";
priority = 300;
}
{
name = "git";
priority = 250;
}
{
name = "calc";
priority = 150;
}
{
name = "emoji";
priority = 100;
}
];
};
}; };
friendly-snippets.enable = true; preselect = "cmp.PreselectMode.None";
luasnip.enable = true;
lspkind = { snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
enable = true;
cmp = { sources = [
enable = true; {
menu = { name = "nvim_lsp";
buffer = ""; priority = 1000;
calc = ""; option = {
cmdline = ""; inherit get_bufnrs;
codeium = "󱜙";
emoji = "󰞅";
git = "";
luasnip = "󰩫";
neorg = "";
nvim_lsp = "";
nvim_lua = "";
path = "";
spell = "";
treesitter = "󰔱";
};
}; };
}; }
{
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;
}
];
};
}; };
friendly-snippets.enable = true;
luasnip.enable = true;
lspkind = {
enable = true;
cmp = {
enable = true;
menu = {
buffer = "";
calc = "";
cmdline = "";
codeium = "󱜙";
emoji = "󰞅";
git = "";
luasnip = "󰩫";
neorg = "";
nvim_lsp = "";
nvim_lua = "";
path = "";
spell = "";
treesitter = "󰔱";
};
};
};
};
} }

View File

@ -1,19 +1,23 @@
{ config, pkgs, nixvim, ... }:
{ {
imports = [ config,
nixvim.homeManagerModules.nixvim pkgs,
./cmp.nix nixvim,
./lsp.nix ...
./neotree.nix }:
./opts.nix {
./lualine.nix imports = [
./alpha.nix nixvim.homeManagerModules.nixvim
./dev.nix ./cmp.nix
./nonels.nix ./lsp.nix
]; ./neotree.nix
programs.nixvim = { ./opts.nix
enable = true; ./lualine.nix
colorschemes.oxocarbon.enable = true; ./alpha.nix
}; ./dev.nix
./nonels.nix
];
programs.nixvim = {
enable = true;
colorschemes.oxocarbon.enable = true;
};
} }

View File

@ -1,71 +1,71 @@
{ {
programs.nixvim.plugins = { programs.nixvim.plugins = {
lsp-format = { lsp-format = {
enable = true; enable = true;
};
lsp = {
enable = true;
inlayHints = true;
servers = {
html = {
enable = true;
};
lua_ls = {
enable = true;
};
nixd = {
enable = true;
extraOptions = {
nixos = {
expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.aurelionite.options";
};
home_manager = {
expr = "(builtins.getFlake \"/etc/nixos\").homeConfigurations.aurelionite.options";
};
};
};
marksman = {
enable = true;
};
pyright = {
enable = true;
};
gopls = {
enable = true;
};
yamlls = {
enable = true;
};
};
keymaps = {
silent = true;
lspBuf = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gr = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
"<leader>cr" = {
action = "rename";
desc = "Rename";
};
};
};
};
}; };
lsp = {
enable = false;
inlayHints = true;
servers = {
html = {
enable = true;
};
lua_ls = {
enable = true;
};
nixd = {
enable = true;
extraOptions = {
nixos = {
expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.aurelionite.options";
};
home_manager = {
expr = "(builtins.getFlake \"/etc/nixos\").homeConfigurations.aurelionite.options";
};
};
};
marksman = {
enable = true;
};
pyright = {
enable = true;
};
gopls = {
enable = true;
};
yamlls = {
enable = true;
};
};
keymaps = {
silent = true;
lspBuf = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gr = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
"<leader>cr" = {
action = "rename";
desc = "Rename";
};
};
};
};
};
} }

View File

@ -1,58 +1,63 @@
{ config, pkgs, nixvim, ... }:
{ {
programs.nixvim = { config,
extraConfigLua = '' pkgs,
local map = vim.api.nvim_set_keymap nixvim,
local opts = { noremap = true, silent = true } ...
}:
{
programs.nixvim = {
extraConfigLua = ''
local map = vim.api.nvim_set_keymap
local opts = { noremap = true, silent = true }
vim.g.mapleader = " " vim.g.mapleader = " "
map('n', '<c-t>', ":ToggleTerm size=40 direction=float<CR>", opts) map('n', '<c-t>', ":ToggleTerm size=40 direction=float<CR>", opts)
map('n', '<c-n>', ":Neotree filesystem reveal right toggle<CR>", opts) map('n', '<c-n>', ":Neotree filesystem reveal right toggle<CR>", opts)
map('v', '<Tab>', '>gv', opts) map('v', '<Tab>', '>gv', opts)
map('v', '<S-Tab>', '<gv', opts) map('v', '<S-Tab>', '<gv', opts)
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 2
vim.opt.tabstop = 4 vim.opt.tabstop = 2
vim.opt.cursorline = true vim.opt.cursorline = true
vim.opt.expandtab = true vim.opt.expandtab = true
vim.opt.autoindent = true vim.opt.autoindent = true
vim.opt.smartindent = true vim.opt.smartindent = true
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
} }
''; '';
}; };
} }