{ pkgs, config, lib, helpers, inputs, ... }: { imports = [ inputs.nixvim.homeManagerModules.nixvim ]; options = { nvim.enable = lib.mkEnableOption "enable nvim"; }; config = lib.mkIf config.nvim.enable { programs.nixvim = { opts = { number = true; relativenumber = true; tabstop = 4; softtabstop = 4; smartindent = true; expandtab = true; scrolloff = 5; }; colorschemes.catppuccin.enable = true; globals.mapleader = " "; keymaps = [ # Most used { action = ":Telescope file_browser"; key = "."; } { action = ":Telescope buffers sort_lastused=true"; key = ","; } # File related { action = ":Telescope frecency"; key = "fr"; } { action = ":Telescope find_files"; key = "ff"; } { action = ":Telescope find_files cwd=~/nixfiles"; key = "fn"; } { action = ":Telescope projects"; key = "op"; } # Terminal { action = ":ToggleTerm direction=vertical"; key = "ot"; } { action = ":ToggleTerm direction=horizontal"; key = "oT"; } { action = ""; key = ""; mode = "t"; } ]; autoCmd = [ { event = "FileType"; pattern = [ "sql" "mysql" "plsql" ]; command = "lua require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} })"; } ]; # lsps plugins = { lsp = { enable = true; servers = { pyright.enable = true; nixd.enable = true; }; }; cmp = { enable = true; autoEnableSources = true; settings = { snippet.expand = "luasnip"; sources = [ {name = "nvim_lsp";} {name = "luasnip";} {name = "path";} {name = "buffer";} ]; mapping = { "" = "cmp.mapping.confirm({select = false})"; "" = "cmp.mapping.select_next_item(cmp_select_opts)"; "" = "cmp.mapping.select_prev_item(cmp_select_opts)"; "" = "cmp.mapping.confirm({select = true})"; }; }; }; luasnip.enable = true; }; plugins = { nix.enable = true; comment-nvim.enable = true; nvim-autopairs.enable = true; intellitab.enable = true; project-nvim.enable = true; undotree.enable = true; treesitter = { enable = true; indent = true; nixvimInjections = true; }; codeium-vim = { enable = true; settings = { disable_binds = true; manual = true; no_map_tab = true; }; keymaps.accept = ""; }; toggleterm = { enable = true; autochdir = true; persistSize = false; size = "function(term) if term.direction == 'horizontal' then return 15 elseif term.direction == 'vertical' then return vim.o.columns * 0.4 end end"; }; telescope = { enable = true; defaults = { mappings = { i = { "" = "move_selection_next"; "" = "move_selection_previous"; "" = "toggle_selection"; "" = "select_default"; }; n = { "" = "toggle_selection"; "" = "move_selection_next"; "" = "move_selection_previous"; "" = "select_default"; }; }; }; extensions = { file-browser = { enable = true; path = "%:p:h"; }; frecency.enable = true; project-nvim.enable = true; }; }; lualine = { enable = true; sectionSeparators = { left = " "; right = " "; }; componentSeparators = { left = " "; right = " "; }; }; }; extraPlugins = with pkgs; with vimPlugins; [ vim-dadbod-ui vim-dadbod-completion direnv-vim ]; extraPackages = with pkgs; [ sqls ]; extraConfigLua = builtins.readFile ./extralua.lua; }; }; }