niksos/modules/tui/neovim.nix

170 lines
5.8 KiB
Nix

{
config,
inputs,
lib,
pkgs,
...
}: with lib; let
cfg = config.myOptions.programs.neovim;
inherit (config.myOptions.other.system) username;
in {
options.myOptions.programs.neovim.enable = mkEnableOption "neovim";
config = mkIf cfg.enable {
environment.sessionVariables = {
EDITOR = "nvim";
};
home-manager.users.${username} = {
imports = [ inputs.nvf.homeManagerModules.default ];
programs.neovim-flake = {
enable = true;
settings.vim = {
package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim;
viAlias = false;
vimAlias = false;
enableLuaLoader = true;
scrollOffset = 7;
preventJunkFiles = true;
tabWidth = 4;
autoIndent = false;
cmdHeight = 1;
useSystemClipboard = false;
# a fix for the weird treesitter thingy
syntaxHighlighting = false;
theme = {
enable = true;
name = "catppuccin";
style = "mocha";
transparent = true;
};
maps = {
normal = {
"<leader>v" = {
action = "<CMD>Neotree toggle<CR>";
silent = true;
};
"<leader>m" = {
action = "<CMD>MarkdownPreviewToggle<CR>";
silent = true;
};
};
terminal = {
# get out of terminal mode in toggleterm
"<ESC>" = {
action = "<C-\\><C-n>";
silent = true;
};
};
};
filetree.neo-tree = {
enable = true;
};
statusline.lualine = {
enable = true;
theme = "catppuccin";
};
extraPlugins = with pkgs.vimPlugins; {
zen-mode.package = zen-mode-nvim;
};
treesitter = {
enable = true;
fold = true;
context.enable = true;
};
autocomplete = {
enable = true;
alwaysComplete = false;
};
# TODO neo-tree
terminal.toggleterm = {
enable = true;
setupOpts.direction = "float";
mappings.open = "<C-\\>";
# TODO shading_factor
# TODO shade_terminals
# TODO size
};
git = {
enable = true;
gitsigns = {
enable = true;
# TODO enable / disable all the settings
};
};
lsp = {
enable = true;
lspSignature.enable = true;
lspconfig.enable = true;
lsplines.enable = true;
mappings = {
addWorkspaceFolder = "<leader>wa";
codeAction = "<leader>a";
format = "<C-f>";
goToDeclaration = "gD";
goToDefinition = "gd";
hover = "K";
listImplementations = "gi";
listReferences = "gr";
listWorkspaceFolders = "<leader>wl";
nextDiagnostic = "<leader>k";
previousDiagnostic = "<leader>j";
openDiagnosticFloat = "<leader>e";
removeWorkspaceFolder = "<leader>wr";
renameSymbol = "<leader>r";
signatureHelp = "<C-k>";
};
};
languages = {
enableDAP = true;
enableExtraDiagnostics = true;
enableFormat = true;
enableLSP = true;
enableTreesitter = true;
bash.enable = true;
clang = {
enable = true;
cHeader = true;
};
java.enable = true;
markdown.enable = true;
nix.enable = true;
rust = {
enable = true;
crates.enable = true;
};
};
utility = {
motion.leap.enable = true;
preview.markdownPreview.enable = true;
# TODO settings.theme = "dark";
};
visuals.fidget-nvim.enable = true;
# TODO laytan/cloak.nvim
telescope.enable = true;
comments.comment-nvim.enable = true;
# TODO learn and add harpoon
};
};
};
};
}