1
0
Fork 0

2 last months

This commit is contained in:
Avery 2024-06-28 18:15:13 +02:00
parent f845745874
commit 15b909473e
Signed by: Avery
GPG key ID: B684FD451B692E04
63 changed files with 963 additions and 1103 deletions

View file

@ -0,0 +1,59 @@
{ inputs, pkgs, ... }: {
imports = [ ./nixvim ];
home = {
packages = with pkgs; [
git-credential-manager
gnupg
pass
# dotnet-sdk_7
dotnet-sdk_8 # tModLoader
unityhub
];
};
programs = {
git = {
enable = true;
extraConfig = {
credential = {
credentialStore = "gpg";
helper = "${pkgs.git-credential-manager}/bin/git-credential-manager";
"https://codeberg.org".provider = "generic";
"https://git.rcia.dev".provider = "generic";
};
merge.tool = "nvim -d";
};
signing = {
key = "B684FD451B692E04";
signByDefault = true;
};
userEmail = "aveeryy@protonmail.com";
userName = "Avery";
};
lazygit = {
enable = true;
settings = {
gui.theme = {
activeBorderColor = [ "#89b4fa" "bold" ];
inactiveBorderColor = [ "#a6adc8" ];
optionsTextColor = [ "#89b4fa" ];
selectedLineBgColor = [ "#313244" ];
selectedRangeBgColor = [ "#313244" ];
cherryPickedCommitBgColor = [ "#45475a" ];
cherryPickedCommitFgColor = [ "#89b4fa" ];
unstagedChangesColor = [ "#f38ba8" ];
defaultFgColor = [ "#cdd6f4" ];
searchingActiveBorderColor = [ "#f9e2af" ];
};
};
};
};
services = {
gpg-agent = {
defaultCacheTtl = 3600;
enable = true;
enableSshSupport = true;
enableZshIntegration = true;
pinentryPackage = pkgs.pinentry-qt;
};
};
}

View file

@ -0,0 +1,104 @@
{ inputs, lib, ... }: {
programs.nixvim = {
extraConfigLua = ''
function has_words_before()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0
and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
function leave_snippet()
if
((vim.v.event.old_mode == "s" and vim.v.event.new_mode == "n") or vim.v.event.old_mode == "i")
and require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end
-- stop snippets when you leave to normal mode
vim.api.nvim_command([[
autocmd ModeChanged * lua leave_snippet()
]])
'';
plugins = {
cmp = {
enable = true;
settings = {
formatting.format = lib.mkForce ''
function(entry, vim_item)
if vim.tbl_contains({ "path" }, entry.source.name) then
local icon, hl_group =
require("nvim-web-devicons").get_icon(entry:get_completion_item().label)
if icon then
vim_item.kind = icon
vim_item.kind_hl_group = hl_group
return vim_item
end
end
return require("lspkind").cmp_format({ with_text = true })(entry, vim_item)
end
'';
mapping = {
"<CR>" = "cmp.mapping.confirm({ select = false })";
"<Tab>" = ''
cmp.mapping(
function(callback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_locally_jumpable() then
require("luasnip").expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
callback()
end
end
, {"i", "s"})
'';
"<S-Tab>" = ''
cmp.mapping(
function(callback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
require("luasnip").jump(-1)
else
callback()
end
end
, {"i", "s"})
'';
};
snippet.expand = ''
function(args)
require("luasnip").lsp_expand(args.body)
end
'';
sources = [
{
name = "luasnip";
priority = 40;
}
{
name = "nvim_lsp";
priority = 30;
entry_filter = ''
function(entry, _)
return entry:get_kind() ~= require("cmp").lsp.CompletionItemKind.Text
end
'';
}
];
};
};
lspkind = { enable = true; };
luasnip = {
enable = true;
fromVscode = [ { } ];
};
friendly-snippets.enable = true;
};
};
}

View file

@ -0,0 +1,43 @@
{ inputs, pkgs, ... }: {
imports = [
./completion.nix
./lsp.nix
./lualine.nix
./neo-tree.nix
./none-ls.nix
./treesitter.nix
];
programs.nixvim = {
enable = true;
colorschemes.catppuccin = {
enable = true;
settings = {
flavour = "mocha";
no_italic = true;
integrations = {
cmp = true;
neotree = true;
};
};
};
globals.mapleader = " ";
opts = {
number = true;
cursorline = true;
tabstop = 4;
shiftwidth = 4;
expandtab = true;
ttyfast = true;
wrap = false;
mousemoveevent = true;
signcolumn = "yes";
};
plugins.nvim-autopairs.enable = true;
extraPlugins = with pkgs.vimPlugins; [ nvim-web-devicons ];
};
}

View file

@ -0,0 +1,17 @@
{ inputs, ... }: {
programs.nixvim.plugins = {
lsp = {
enable = true;
servers = {
pyright.enable = true;
rust-analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
svelte.enable = true;
};
};
};
}

View file

@ -0,0 +1,14 @@
{ ... }: {
programs.nixvim.plugins.lualine = {
enable = true;
componentSeparators = {
left = "";
right = "";
};
sectionSeparators = {
left = "";
right = "";
};
disabledFiletypes.statusline = [ "neo-tree" ];
};
}

View file

@ -0,0 +1,161 @@
{ ... }: {
programs.nixvim = {
keymaps = [
{
action = "<cmd>Neotree toggle<CR>";
key = "<leader>fi";
}
];
plugins.neo-tree = {
enable = true;
closeIfLastWindow = true;
enableGitStatus = true;
enableDiagnostics = true;
sourceSelector = {
winbar = true;
statusline = false;
tabsLayout = "equal";
sources = [
{ source = "filesystem"; displayName = " 󰉓 Archivos "; }
];
};
defaultComponentConfigs = {
container = {
enableCharacterFade = true;
};
indent = {
indentSize = 2;
padding = 1;
withMarkers = true;
indentMarker = "";
lastIndentMarker = "";
highlight = "NeoTreeIndentMarker";
withExpanders = true;
expanderCollapsed = "";
expanderExpanded = "";
expanderHighlight = "NeoTreeExpander";
};
icon = {
folderClosed = "";
folderOpen = "";
folderEmpty = "";
default = " ";
highlight = "NeoTreeFileIcon";
};
modified = {
symbol = "[+]";
highlight = "NeoTreeModified";
};
name = {
trailingSlash = false;
useGitStatusColors = true;
highlight = "NeoTreeFileName";
};
gitStatus = {
symbols = {
added = "";
modified = "";
deleted = "";
renamed = "";
untracked = "";
ignored = "";
unstaged = "U";
staged = "";
conflict = "";
};
};
diagnostics = {
symbols = {
error = "";
warn = "";
hint = "";
info = "";
};
highlights = {
hint = "DiagnosticSignHint";
info = "DiagnosticSignInfo";
warn = "DiagnosticSignWarn";
error = "DiagnosticSignError";
};
};
};
window = {
position = "left";
width = 40;
mappingOptions = {
noremap = true;
nowait = true;
};
};
filesystem = {
bindToCwd = true;
filteredItems = {
visible = false;
hideDotfiles = false;
hideGitignored = false;
hideByName = [
"nodeModules"
];
};
groupEmptyDirs = false;
useLibuvFileWatcher = true;
};
buffers = {
groupEmptyDirs = true;
};
renderers = {
directory = [
"indent"
"icon"
"current_filter"
{
name = "container";
content = [
{
name = "name";
zindex = 10;
}
{
name = "symlink_target";
zindex = 10;
highlight = "NeoTreeSymbolicLinkTarget";
}
{
name = "clipboard";
zindex = 10;
}
{
name = "diagnostics";
errorsOnly = true;
zindex = 20;
align = "right";
hideWhenExpanded = false;
}
{
name = "git_status";
zindex = 10;
align = "right";
hideWhenExpanded = true;
}
];
}
];
file = [
"indent"
"icon"
{
name = "container";
content = [
{ name = "name"; zindex = 10; }
{ name = "clipboard"; zindex = 10;}
{ name = "bufnr"; zindex = 10;}
{ name = "modified"; zindex = 20; align = "right";}
{ name = "diagnostics"; zindex = 20; align = "right";}
{ name = "git_status"; zindex = 15; align = "right";}
];
}
];
};
};
};
}

View file

@ -0,0 +1,31 @@
{ ... }: {
programs.nixvim.plugins.none-ls = {
enable = true;
onAttach = ''
function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end
end
'';
sources = {
formatting = {
black.enable = true;
nixfmt.enable = true;
prettier = {
enable = true;
withArgs = ''
{extra_filetypes = {"svelte"}}
'';
};
};
};
};
}

View file

@ -0,0 +1,7 @@
{ ... }: {
programs.nixvim.plugins.treesitter = {
enable = true;
indent = true;
nixvimInjections = true;
};
}