feat: Init nvim from jalil-salame/nvim-config

Step one of Issue #15
This commit is contained in:
Jalil David Salamé Messina 2024-02-16 20:10:20 +01:00
parent a4dbd22402
commit d47b04a887
Signed by: jalil
GPG key ID: F016B9E770737A0B
11 changed files with 538 additions and 97 deletions

88
nvim/plugins/cmp.nix Normal file
View file

@ -0,0 +1,88 @@
{
enable = true;
# Snippets
snippet.luasnip.enable = true;
# Completion Sources
sources = {
buffer.enable = true;
buffer.groupIndex = 3;
calc.enable = true;
calc.groupIndex = 2;
conventionalcommits.enable = true;
conventionalcommits.groupIndex = 1;
# cmdline.enable = true;
crates.enable = true;
crates.groupIndex = 1;
digraphs.enable = true;
digraphs.groupIndex = 3;
# emoji.enable = true;
# fuzzy_buffer.enable = true;
# fuzzy_path.enable = true;
luasnip.enable = true;
luasnip.groupIndex = 1;
nvim_lsp.enable = true;
nvim_lsp.groupIndex = 1;
nvim_lsp_document_symbol.enable = true;
nvim_lsp_document_symbol.groupIndex = 1;
nvim_lsp_signature_help.enable = true;
nvim_lsp_signature_help.groupIndex = 1;
path.enable = true;
path.groupIndex = 2;
# rg.enable = true;
spell.enable = true;
spell.groupIndex = 2;
treesitter.enable = true;
treesitter.groupIndex = 2;
zsh.enable = true;
zsh.groupIndex = 1;
};
# Menu Icons
formatting.format = "require('lspkind').cmp_format { mode = 'symbol', maxwidth = 50 }";
mappingPresets = [ "insert" ];
mapping = {
"<C-n>" = {
modes = [ "i" "s" ];
action = ''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end
'';
};
"<C-p>" = {
modes = [ "i" "s" ];
action = ''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
fallback()
end
end
'';
};
"<C-u>" = ''
cmp.mapping(function(fallback)
if require("luasnip").choice_active() then
require("luasnip").next_choice()
else
fallback()
end
end)
'';
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete {}";
"<C-e>" = "cmp.mapping.close()";
"<CR>" = "cmp.mapping.confirm { select = true }";
};
}

17
nvim/plugins/default.nix Normal file
View file

@ -0,0 +1,17 @@
{
colorizer.enable = true;
colorizer.userDefaultOptions.names = false; # disable named colors (i.e. red)
gitsigns.enable = true;
lspconfig = import ./lspconfig.nix;
lspkind.enable = true;
lualine = import ./lualine.nix;
luasnip.enable = true;
luasnip.extraConfig = { update_events = "TextChanged,TextChangedI"; };
nvim-cmp = import ./cmp.nix;
telescope.enable = true;
treesitter.enable = true;
treesitter.indent = true;
treesitter.incrementalSelection.enable = true;
treesitter-context.enable = true;
trouble.enable = true;
}

View file

@ -0,0 +1,19 @@
{
enable = true;
servers.bashls.enable = true;
servers.clangd.enable = true;
servers.html.enable = true;
# servers.lua-language-server.enable = true;
servers.jsonls.enable = true;
servers.nil.enable = true;
servers.ocamllsp.enable = true;
servers.pyright.enable = true;
servers.rnix-lsp.enable = true;
servers.ruff-lsp.enable = true;
# servers.rust-analyzer.enable = true;
# servers.serve_d.enable = true;
servers.taplo.enable = true;
servers.texlab.enable = true;
servers.typst-lsp.enable = true;
# servers.vimls.enable = true;
}

50
nvim/plugins/lualine.nix Normal file
View file

@ -0,0 +1,50 @@
{
enable = true;
theme = "gruvbox";
sections = {
lualine_a = [ "mode" ];
lualine_b = [ "filename" "branch" ];
lualine_c = [
{
lsp_progress = {
separators = {
component = " ";
progress = " | ";
percentage = {
pre = "";
post = "%% ";
};
title = {
pre = "";
post = ": ";
};
lsp_client_name = {
pre = "[";
post = "]";
};
spinner = {
pre = "";
post = "";
};
message = {
pre = "(";
post = ")";
commenced = "In Progress";
completed = "Completed";
};
};
display_components = [ "lsp_client_name" "spinner" "title" "percentage" "message" ];
timer = {
progress_enddelay = 500;
spinner = 1000;
lsp_client_name_enddelay = 1000;
};
spinner_symbols = [ "🌑 " "🌒 " "🌓 " "🌔 " "🌕 " "🌖 " "🌗 " "🌘 " ];
};
}
];
lualine_x = [ ];
lualine_y = [ "encoding" "fileformat" "filetype" ];
lualine_z = [ "location" ];
};
}