neovim.nix (1994B)
1 { pkgs, ... }: 2 3 let 4 sortblock = pkgs.callPackage ../scripts/neovim-sortblock.nix { }; 5 lastmod = pkgs.callPackage ../scripts/neovim-lastmod.nix { }; 6 in 7 { 8 programs.neovim = { 9 enable = true; 10 withPython3 = false; 11 withRuby = false; 12 defaultEditor = true; 13 plugins = with pkgs.vimPlugins; [ vim-nix sortblock lastmod ]; 14 extraConfig = '' 15 " Options 16 set smartcase 17 set nocompatible 18 let mapleader ="," 19 set backspace=indent,eol,start 20 set clipboard+=unnamedplus 21 set ignorecase 22 set linebreak 23 set mouse=a 24 set nohlsearch 25 set number 26 set title 27 set titlestring=%f\ %m 28 set whichwrap+=<,>,h,l,[,] 29 set list listchars=nbsp:¬,tab:»·,trail:·,extends:> 30 set shiftwidth=2 31 set softtabstop=2 32 set tabstop=2 33 syntax on 34 " Remapping 35 map <C-H> <C-W> 36 map <C-Del> X<Esc>ce<del> 37 map <F8> :setlocal spell! spelllang=en_gb<CR> 38 xnoremap <A-z> :s/^.<CR>gv " alt-z removes first character of line 39 nnoremap <A-z> 0x " alt-z in normal mode removes first char 40 " Abbreviations 41 :iab <expr> _date strftime("%F") 42 :iab <expr> _time strftime("%H:%M") 43 :iab <expr> _stamp strftime("%F\T%H:%M:00") 44 " Tidy lines on save 45 autocmd BufWritePre * %s/\s\+$//e 46 autocmd BufWritepre * %s/\n\+\%$//e 47 ''; 48 initLua = '' 49 -- Keybinds 50 vim.keymap.set('i', '<C-v>', '<C-r>+', { desc = 'Paste from system clipboard' }) 51 vim.keymap.set('c', '<C-v>', '<C-r>+', { desc = 'Paste from system clipboard (cmdline)' }) 52 -- Plugins in ../scripts/neovim-* 53 require("sortblock").setup() 54 require("lastmod") 55 -- Uppercase/Lowercase functions 56 vim.api.nvim_create_user_command("Uppercase", function() 57 vim.cmd("'<,'>s/.*/\\U&/") 58 end, { range = true }) 59 vim.api.nvim_create_user_command("Lowercase", function() 60 vim.cmd("'<,'>s/.*/\\L&/") 61 end, { range = true }) 62 ''; 63 }; 64 }