Files
nixos-blueprint/modules/home/programs/editor/nixvim.nix
unexplrd a20fc14152 upd
2025-02-18 16:40:03 +02:00

271 lines
6.8 KiB
Nix

{
pkgs,
# pkgs-51b85c,
lib,
config,
...
}: {
options = {
editor.neovim.enable =
lib.mkEnableOption "enable neovim text editor";
};
config = lib.mkIf config.editors.neovim.enable {
# stylix.targets.nixvim.enable = true;
home.packages = with pkgs; [neovide];
programs.nixvim = {
enable = true;
enableMan = true;
# package = ;
plugins.lualine.enable = true;
plugins.treesitter = {
enable = true;
folding = true;
};
plugins = {
yazi.enable = true;
noice = {
enable = true;
popupmenu.backend = "nui";
};
notify.enable = true;
telescope.enable = true;
transparent.enable = true;
lsp-format.enable = true;
lsp-lines.enable = true;
lsp-status.enable = true;
which-key.enable = true;
web-devicons.enable = true;
# vimtex = {
# enable = true;
# texlivePackage = pkgs.tectonic; #pkgs.texlive.combined.scheme-full;
# settings = {
# compiler_method = "tectonic";
# view_method = "zathura_simple";
# compiler_tectonic = {
# "aux_dir" = {};
# "out_dir" = {};
# "callback" = 1;
# "continuous" = 0;
# "executable" = "latexmk";
# "hooks" = {};
# "options" = [
# "--synctex"
# "--keep-logs"
# "-Z shell-escape"
# "-Z continue-on-errors"
# ];
# };
# compiler_latexmk = {
# "aux_dir" = {};
# "out_dir" = {};
# "callback" = 1;
# "continuous" = 0;
# "executable" = "latexmk";
# "hooks" = {};
# "options" = [
# "-xelatex"
# "-recorder"
# "-file-line-error"
# "-synctex=1"
# "-interaction=nonstopmode"
# "-shell-escape"
# ];
# };
# };
# };
treesitter-textobjects.enable = true;
cmp-latex-symbols.enable = true;
dap.enable = true;
rustaceanvim.enable = true;
lsp = {
enable = true;
servers = {
clangd.enable = true;
#rust_analyzer = {
# enable = true;
# installRustc = true;
# installCargo = true;
#};
lua_ls.enable = true;
nil_ls.enable = true;
};
};
};
plugins = {
cmp-nvim-lsp = {enable = true;}; # lsp
cmp-buffer = {enable = true;};
cmp-path = {enable = true;}; # file system paths
cmp_luasnip = {enable = true;}; # snippets
cmp-cmdline = {enable = true;}; # autocomplete for cmdline
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{name = "nvim_lsp";}
{name = "path";}
{name = "buffer";}
];
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
};
experimental = {
ghost_text = true;
};
};
};
luasnip = {
enable = true;
settings = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
};
};
clipboard = {
providers.wl-copy.enable = true;
};
globals.mapleader = " ";
globals.maplocalleader = ",";
opts = {
# Show line numbers
number = true;
# Show relative line numbers
relativenumber = true;
# Use the system clipboard
clipboard = "unnamedplus";
# Number of spaces that represent a <TAB>
tabstop = 2;
softtabstop = 2;
# Show tabline always
showtabline = 2;
# Use spaces instead of tabs
expandtab = true;
# Enable smart indentation
smartindent = true;
# Number of spaces to use for each step of (auto)indent
shiftwidth = 2;
# Enable break indent
breakindent = true;
# Highlight the screen line of the cursor
cursorline = true;
# Minimum number of screen lines to keep above and below the cursor
scrolloff = 8;
# Enable mouse support
mouse = "a";
# Set folding method to manual
foldmethod = "manual";
# Disable folding by default
foldenable = false;
# Wrap long lines at a character in 'breakat'
linebreak = true;
# Disable spell checking
spell = false;
# Disable swap file creation
swapfile = false;
# Time in milliseconds to wait for a mapped sequence to complete
timeoutlen = 300;
# Enable 24-bit RGB color in the TUI
termguicolors = true;
# Don't show mode in the command line
showmode = false;
# Open new split below the current window
splitbelow = true;
# Keep the screen when splitting
splitkeep = "screen";
# Open new split to the right of the current window
splitright = true;
# Hide command line unless needed
cmdheight = 0;
# Remove EOB
fillchars = {
eob = " ";
};
};
keymaps = [
{
mode = "n";
key = "j";
action = "gj";
}
{
mode = "n";
key = "k";
action = "gk";
}
{
mode = "n";
key = "n";
action = "nzzzv";
}
{
mode = "n";
key = "N";
action = "Nzzzv";
}
{
mode = "n";
key = "<C-d>";
action = "<C-d>zz";
}
{
mode = "n";
key = "<C-u>";
action = "<C-u>zz";
}
{
mode = "n";
key = "<leader>yy";
action = "<cmd>Yazi<cr>";
options = {desc = "open yazi";};
}
{
mode = "n";
key = "<leader>fo";
action = "<cmd>Telescope oldfiles<cr>";
options = {desc = "Telescope oldfiles";};
}
{
mode = "n";
key = "<leader>ff";
action = "<cmd>Telescope find_files<cr>";
options = {desc = "Telescope find files";};
}
];
};
};
}