Added nixvim

This commit is contained in:
2025-04-10 11:26:13 +02:00
parent 5b6f8916f8
commit a82e6c87e0
16 changed files with 478 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
{ ... }:
{
imports = [
./nvim
./tmux.nix
./fish.nix
./git.nix

26
home/nvim/cmp.nix Normal file
View File

@@ -0,0 +1,26 @@
{ ... }:
{
programs.nixvim.plugins.lspkind.enable = true;
programs.nixvim.plugins.cmp-nvim-lsp-signature-help.enable = true;
programs.nixvim.plugins.cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "nvim_lsp_signature_help"; }
{ name = "path"; }
{ name = "buffer"; }
];
mapping = {
"<Tab>" = "cmp.mapping.select_next_item()";
"<S-Tab>" = "cmp.mapping.select_prev_item()";
"<C-j>" = "cmp.mapping.scroll_docs(4)";
"<C-k>" = "cmp.mapping.scroll_docs(-4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-Esc>" = "cmp.mapping.close()";
"<CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })";
};
};
};
}

23
home/nvim/default.nix Normal file
View File

@@ -0,0 +1,23 @@
{ pkgs, ... }:
{
imports = [
./opts.nix
./lsp.nix
./cmp.nix
./keymaps.nix
./plugins
];
programs.nixvim = {
enable = true;
colorschemes.catppuccin.enable = true;
extraPackages = with pkgs; [
wl-clipboard
];
clipboard.register = "unnamedplus";
clipboard.providers.wl-copy.enable = true;
clipboard.providers.wl-copy.package = pkgs.wl-clipboard;
clipboard.providers.xclip.enable = true;
clipboard.providers.xclip.package = pkgs.xclip;
};
}

133
home/nvim/keymaps.nix Normal file
View File

@@ -0,0 +1,133 @@
{ ... }:
{
programs.nixvim.keymaps = [
{
action = ":bnext<CR>";
key = "<A-l>";
options = {
silent = true;
desc = "Next tab";
};
mode = "n";
}
{
action = ":bprevious<CR>";
key = "<A-h>";
options = {
silent = true;
desc = "Previous tab";
};
mode = "n";
}
{
action = ":bdelete<CR>";
key = "<S-q>";
options = {
silent = true;
desc = "Next tab";
};
mode = "n";
}
{
action = "<C-\\><C-n>";
key = "<Esc>";
options = {
silent = true;
desc = "Exit terminal insert mode";
};
mode = "t";
}
{
action = ":w<CR>";
key = "<C-s>";
options = {
silent = true;
desc = "Save";
};
mode = "n";
}
{
action = ":q<CR>";
key = "<C-q>";
options = {
silent = true;
desc = "Quit";
};
mode = "n";
}
{
action = ":wincmd l<CR>";
key = "<Space>wl";
options = {
silent = true;
desc = "Go to left panel";
};
mode = "n";
}
{
action = ":wincmd k<CR>";
key = "<Space>wk";
options = {
silent = true;
desc = "Go to upper panel";
};
mode = "n";
}
{
action = ":wincmd j<CR>";
key = "<Space>wj";
options = {
silent = true;
desc = "Go to down panel";
};
mode = "n";
}
{
action = ":wincmd h<CR>";
key = "<Space>wh";
options = {
silent = true;
desc = "Go to left panel";
};
mode = "n";
}
{
action = "$";
key = "gl";
options = {
silent = true;
desc = "Go to end line";
};
mode = [ "n" "v" ];
}
{
action = "^";
key = "gh";
options = {
silent = true;
desc = "Go to start line";
};
mode = [ "n" "v" ];
}
# Neotree
{
action = ":Neotree toggle<CR>";
key = "<Space>e";
options = {
silent = true;
desc = "Toggle file explorer";
};
mode = "n";
}
# ToggleTerm
{
action = ":ToggleTerm direction=float<CR>";
key = "<Space>t";
options = {
silent = true;
desc = "Toggle terminal";
};
mode = "n";
}
];
}

31
home/nvim/lsp.nix Normal file
View File

@@ -0,0 +1,31 @@
{ ... }:
{
programs.nixvim.plugins.lsp = {
enable = true;
servers = {
clangd.enable = true;
nil_ls.enable = true;
gopls.enable = true;
jdtls.enable = true;
lua_ls.enable = true;
rust_analyzer = {
enable = true;
installCargo = true;
installRustc = true;
installRustfmt = true;
};
zls.enable = true;
nim_langserver.enable = true;
pylsp.enable = true;
emmet_language_server.enable = true;
ts_ls.enable = true;
};
keymaps = {
lspBuf = {
"<Space>k" = "hover";
"<Space>r" = "rename";
"<Space>a" = "code_action";
};
};
};
}

17
home/nvim/opts.nix Normal file
View File

@@ -0,0 +1,17 @@
{ ... }:
{
programs.nixvim.opts = {
number = true;
relativenumber = true;
signcolumn = "yes";
splitright = true;
splitbelow = true;
cursorline = true;
scrolloff = 5;
undofile = true;
ignorecase = true;
smartcase = true;
gdefault = true;
termguicolors = true;
};
}

View File

@@ -0,0 +1,10 @@
{ ... }:
{
programs.nixvim.plugins.comment = {
enable = true;
settings.toggler = {
block = "<C-x>";
line = "<C-c>";
};
};
}

View File

@@ -0,0 +1,20 @@
{ ... }:
{
programs.nixvim.plugins.dashboard = {
enable = true;
settings.config = {
header = [
" "
" "
" "
" "
" "
" "
" "
" "
" "
];
footer = [ "Made with " ];
};
};
}

View File

@@ -0,0 +1,22 @@
{ ... }:
{
imports = [
./telescope.nix
./treesitter.nix
./comment.nix
./lualine.nix
./dashboard.nix
./neotree.nix
];
programs.nixvim.plugins = {
web-devicons.enable = true;
bufferline.enable = true;
toggleterm.enable = true;
gitsigns.enable = true;
which-key.enable = true;
autoclose.enable = true;
markview.enable = true;
nvim-surround.enable = true;
};
}

View File

@@ -0,0 +1,6 @@
{ ... }:
{
programs.nixvim.plugins.lualine = {
enable = true;
};
}

View File

@@ -0,0 +1,10 @@
{ ... }:
{
programs.nixvim.plugins.neo-tree = {
enable = true;
window = {
width = 30;
};
};
}

View File

@@ -0,0 +1,10 @@
{ ... }:
{
programs.nixvim.plugins.telescope = {
enable = true;
keymaps = {
"<Space>f" = "find_files";
"<Space>g" = "live_grep";
};
};
}

View File

@@ -0,0 +1,11 @@
{ ... }:
{
programs.nixvim.plugins.treesitter = {
enable = true;
settings = {
highlight = {
enable = true;
};
};
};
}