{ config, pkgs, lib, ... }: let cfg = config.programs.v.nvim; in with lib; { options.programs.v.nvim = { enable = mkEnableOption "nvim"; }; config = mkIf cfg.enable { programs.nixvim = { enable = true; package = pkgs.neovim-unwrapped; vimAlias = true; luaLoader.enable = true; globals.mapleader = " "; options.number = true; clipboard = { providers.wl-copy.enable = true; }; keymaps = [ { mode = "n"; key = "ff"; action = "require('telescope.builtin').find_files"; lua = true; } { mode = "n"; key = "fg"; action = "require('telescope.builtin').live_grep"; lua = true; } { mode = "n"; key = ""; action = "require('Comment.api').toggle.linewise.current"; lua = true; } { mode = "x"; key = ""; action = '' function() local esc = vim.api.nvim_replace_termcodes( '', true, false, true ) vim.api.nvim_feedkeys(esc, 'nx', false) require('Comment.api').toggle.linewise(vim.fn.visualmode()) end ''; lua = true; } { mode = "n"; key = "g="; action = "vim.lsp.buf.format"; lua = true; } { mode = "n"; key = "t"; action = ":FloatermToggle myfloat"; } { mode = "t"; key = ""; action = "function() vim.cmd(':FloatermToggle myfloat') end"; lua = true; } { mode = "n"; key = ""; action = ":bn"; } { mode = "n"; key = ""; action = ":bp"; } { mode = "n"; key = ""; action = "<<_"; } { mode = "v"; key = ""; action = ">gv"; } { mode = "v"; key = ""; action = "" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})"; "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; "" = "cmp.mapping.confirm({ select = true })"; "" = "cmp.mapping.complete()"; "" = "cmp.mapping.close()"; }; sources = [ { name = "nvim_lsp_signature_help"; } { name = "path"; } { name = "nvim_lsp"; } { name = "luasnip"; } { name = "buffer"; # Words from other open buffers can also be suggested. option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; } ]; }; }; }; }; }; }