{ pkgs, lib, inputs, host, user, ... }: { programs.nixvim = { plugins = { lsp = { enable = true; inlayHints = true; keymaps = { diagnostic = { "lE" = "open_float"; "[" = "goto_prev"; "]" = "goto_next"; }; lspBuf = { "gD" = "declaration"; "gd" = "definition"; "gr" = "references"; "gI" = "implementation"; "gy" = "type_definition"; }; }; servers = { ruff.enable = true; pyright.enable = true; lua_ls.enable = true; bashls.enable = true; nixd = { enable = true; package = inputs.nixd.packages.${pkgs.system}.nixd; settings = { formatting.command = [ "nixfmt" ]; nixd.nixpkgs.expr = "import { }"; options = let flake = # nix ''(builtins.getFlake "/home/${user}/.config/nixos")''; in { nixos.expr = # nix ''${flake}.nixosConfigurations.${host}.options''; home_manager.expr = # nix ''${flake}.homeConfigurations."${user}@${host}".options''; }; }; }; nil_ls = { enable = true; package = inputs.nil.packages.${pkgs.system}.nil; settings = { # formatting.command = ["nixfmt"]; nix.flake = { autoArchive = true; }; }; }; texlab.enable = true; r_language_server = { enable = true; package = null; cmd = [ "${pkgs.myR}/bin/R" "--slave" "-e" "languageserver::run()" ]; filetypes = [ "r" "rmd" ]; }; }; }; conform-nvim = { enable = true; settings = { format_on_save = { lsp_fallback = "fallback"; timeout_ms = 500; }; notify_on_error = true; formatters_by_ft = { bash = [ "shfmt" "shellcheck" "shellharden" ]; css = [ "prettier" ]; scss = [ "prettier" ]; html = [ "prettier" ]; json = [ "prettier" ]; jsonc = [ "prettier" ]; lua = [ "stylua" ]; markdown = [ "prettier" "injected" ]; nix = [ "nixfmt" "injected" ]; yaml = [ "yamlfmt" ]; python = [ "ruff" ]; tex = [ "latexindent" ]; }; formatters = { injeced.lang_to_ext = { lua = "lua"; }; shfmt.command = lib.getExe pkgs.shfmt; shellcheck.command = lib.getExe pkgs.shellcheck; shellharden.command = lib.getExe pkgs.shellharden; stylua.command = lib.getExe pkgs.stylua; yamlfmt.command = lib.getExe pkgs.yamlfmt; latexindent.prepend_args = [ ''-y="defaultIndent=' '"'' ]; }; }; }; lsp-format = { enable = true; }; lspsaga = { enable = true; lightbulb.virtualText = true; lightbulb.sign = false; }; trouble.enable = true; lsp-signature.enable = true; otter.enable = true; }; }; programs.nixvim.keymaps = [ { mode = "n"; key = "K"; action = ":Lspsaga hover_doc"; } { mode = "n"; key = "lo"; action = ":Lspsaga outline"; } { mode = "n"; key = "lr"; action = ":Lspsaga rename"; } { mode = "n"; key = "la"; action = ":Lspsaga code_action"; } { mode = "n"; key = "lf"; action = ":Lspsaga finder"; } ]; programs.nixvim.extraPlugins = with pkgs.vimPlugins; [ nvim-docs-view ]; }