dotfiles/programs/nvim/default.nix
2025-07-15 10:47:33 +02:00

99 lines
2.4 KiB
Nix

{ pkgs, inputs, ... }:
{
home = {
sessionVariables = {
EDITOR = "nvim";
};
};
imports = [
./options.nix
./plugins.nix
./keys.nix
];
programs.nixvim = {
enable = true;
globals.mapleader = " ";
globals.maplocalleader = " ";
viAlias = true;
vimAlias = true;
# Highlight and remove extra white spaces
# same color as cursorline as per
# https://github.com/joshdick/onedark.vim/blob/390b893d361c356ac1b00778d849815f2aa44ae4/autoload/onedark.vim
highlight.ExtraWhitespace.bg = "#2C323C";
match.ExtraWhitespace = "\\s\\+$";
clipboard.providers.wl-copy.enable = true;
performance = {
byteCompileLua.enable = true;
combinePlugins = {
enable = true;
standalonePlugins = [
# clashes with lualine
"onedark.nvim"
];
};
};
extraLuaPackages = ps: [ ps.magick ];
extraPackages = [ pkgs.imagemagick ];
# package = (import inputs.unstable { inherit (pkgs) system; }).neovim-unwrapped;
package = pkgs.neovim-unwrapped;
colorschemes.onedark = {
enable = true;
settings = {
style = "deep";
highlights = {
# bright green doccomments
"@lsp.type.comment".fg = "#77B767";
"@comment.documentation.rust".fg = "#77B767";
"@comment.documentation".fg = "#77B767";
"@comment".fg = "#426639";
# "Visual".bg = "#2a2e36";
# "Cursorline".bg = "#2a2e36";
};
};
};
extraConfigLuaPre = ''
require("neoconf").setup({})
'';
extraConfigLua =
''
require("render-markdown").setup {
latex_converter = '${pkgs.python312Packages.pylatexenc}/bin/latex2text',
}
''
# local lspconfig = require 'lspconfig'
# local configs = require 'lspconfig.configs'
# if not configs.foo_lsp then
# configs.noteslsp = {
# default_config = {
# -- cmd = {'${pkgs.custom.noteslsp}/bin/noteslsp'},
# cmd = {'./noteslsp/target/debug/noteslsp'},
# filetypes = {'markdown'},
# root_dir = function(fname)
# return lspconfig.util.find_git_ancestor(fname)
# end,
# settings = {}
# ,
# },
# }
# end
#
# lspconfig.noteslsp.setup{}
# ''
+ (builtins.readFile ./config.lua);
};
}