{ config, pkgs, inputs, ... }: { imports = [ inputs.nixvim.homeModules.nixvim ]; programs.nixvim = { enable = true; # fix rust_analyzer error extraConfigLua = '' for _, method in ipairs({ 'textDocument/diagnostic', 'workspace/diagnostic' }) do local default_diagnostic_handler = vim.lsp.handlers[method] vim.lsp.handlers[method] = function(err, result, context, config) if err ~= nil and err.code == -32802 then return end return default_diagnostic_handler(err, result, context, config) end end''; keymaps = [ { key = ";"; action = ":"; } { key = "gg"; action = "Man"; options = { silent = true; remap = false; }; } ]; globals.mapleader = " "; clipboard.register = "unnamedplus"; opts = { tabstop = 4; shiftwidth = 4; expandtab = false; mouse = "a"; }; colorschemes.gruvbox = { enable = true; settings = { integrations = { cmp = true; }; terminal_colors = true; }; }; plugins = { lazy.enable = true; todo-comments.enable = true; telescope = { enable = true; keymaps = { "ff" = "find_files"; "lg" = "live_grep"; }; }; lsp = { enable = true; servers = { ts_ls.enable = true; lua_ls.enable = true; bashls.enable = true; html.enable = true; jsonls.enable = true; cmake.enable = true; sqls.enable = true; nixd.enable = true; tailwindcss.enable = true; rust_analyzer = { enable = false; installRustc = true; installCargo = true; }; }; }; lspkind.enable = true; cmp = { enable = true; autoEnableSources = true; settings = { snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; mapping = { "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; }; sources = [ { name = "path"; } { name = "nvim_lsp"; } { name = "luasnip"; } # the worst thing in existence # {name = "crates";} { name = "buffer"; } ]; }; }; rustaceanvim = { enable = true; settings = { tools.enable_clippy = true; }; }; web-devicons.enable = true; }; extraPlugins = with pkgs.vimPlugins; [ vim-toml ]; }; }