{ config, pkgs, ... }: { home.packages = with pkgs; [ ripgrep ]; programs.nixvim = { enable = true; vimAlias = true; colorscheme = "dracula"; options = { shiftwidth = 4; expandtab = false; preserveindent = true; number = true; relativenumber = true; tabstop = 4; smartcase = true; colorcolumn = "120"; wrap = false; }; globals = { mapleader = " "; dracula_colorterm = 0; }; maps = { normalVisualOp = { ";" = ":"; ":" = ";"; }; normal = { # remove ex mode shortcut "Q" = ""; # Open the tree "n" = ":NvimTreeFocus"; #trigger the fuzzy finder (telescope) "f" = ":Telescope find_files"; "g" = ":Telescope git_files"; "r" = ":Telescope live_grep"; # diacnostics "e" = "vim.diagnostic.open_float"; "q" = "vim.diagnostic.setloclist"; #quickfixlist binds "" = ":cnext"; "" = ":cprev"; #locallist binds "" = ":lnext"; "" = ":lprev"; #split keybinds "s" = ":sp"; "v" = ":vs"; "h" = "h"; "j" = "j"; "k" = "k"; "l" = "l"; }; }; plugins = { airline = { enable = true; powerline = true; }; nvim-tree = { enable = true; autoClose = true; openOnSetup = true; openOnSetupFile = true; }; telescope = { enable = true; }; lsp = { enable = true; onAttach = '' require("lsp-format").on_attach(client) -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap=true, silent=true, buffer=bufnr } vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) ''; servers = { pyright = { enable = true; }; rnix-lsp = { enable = true; }; }; }; nvim-cmp = { enable = true; sources = [ { name = "nvim_lsp"; } { name = "path"; } { name = "buffer"; } ]; }; }; extraPlugins = with pkgs.vimPlugins; [ vim-nix dracula-vim nerdcommenter lsp-format-nvim ]; highlight.ColorColumn.ctermbg = "darkgray"; extraConfigLuaPre = '' local lsp_format = require("lsp-format") ''; }; }