Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 1 | { pkgs, ... }: { |
Skyler Grey | e699532 | 2022-06-12 09:29:17 +0100 | [diff] [blame] | 2 | programs.neovim = { |
| 3 | enable = true; |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 4 | coc = { |
| 5 | enable = true; |
| 6 | settings = { |
| 7 | "suggest.noselect" = false; |
| 8 | }; |
| 9 | }; |
Skyler Grey | e699532 | 2022-06-12 09:29:17 +0100 | [diff] [blame] | 10 | viAlias = true; |
| 11 | vimAlias = true; |
| 12 | vimdiffAlias = true; |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 13 | extraConfig = '' |
Skyler Grey | 60fcac9 | 2022-08-10 08:21:42 +0100 | [diff] [blame] | 14 | let mapleader = "," |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 15 | set whichwrap=b,s,<,>,[,] |
Skyler Grey | a3999c0 | 2022-06-24 14:05:13 +0100 | [diff] [blame] | 16 | set linebreak |
Skyler Grey | 2e80a19 | 2022-06-15 14:23:01 +0100 | [diff] [blame] | 17 | set wrap |
| 18 | set number |
Skyler Grey | a949ffd | 2022-06-23 23:32:48 +0100 | [diff] [blame] | 19 | set cursorline |
Skyler Grey | 32da193 | 2022-07-05 08:37:59 +0100 | [diff] [blame] | 20 | set expandtab |
Skyler Grey | 8d2f105 | 2022-07-09 21:02:17 +0100 | [diff] [blame] | 21 | set mouse=a |
Skyler Grey | a0b7aea | 2022-07-12 12:01:49 +0100 | [diff] [blame] | 22 | set splitright |
Skyler Grey | 1e4cbc7 | 2022-07-12 12:39:02 +0100 | [diff] [blame] | 23 | set splitbelow |
Skyler Grey | 4196611 | 2022-07-09 21:38:53 +0100 | [diff] [blame] | 24 | set clipboard=unnamedplus |
Skyler Grey | 0bd9594 | 2022-07-27 13:16:29 +0100 | [diff] [blame] | 25 | set smartcase |
Skyler Grey | 5f20cf2 | 2022-08-04 21:59:38 +0100 | [diff] [blame] | 26 | set scrolloff=5 |
Skyler Grey | a949ffd | 2022-06-23 23:32:48 +0100 | [diff] [blame] | 27 | colorscheme onehalfdark |
| 28 | |
Skyler Grey | 6ad0c6d | 2022-08-10 09:54:25 +0100 | [diff] [blame] | 29 | command W w |
| 30 | command Wq wq |
| 31 | |
| 32 | fun! SetupCommandAlias(from, to) |
| 33 | exec 'cnoreabbrev <expr> '.a:from |
| 34 | \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")' |
| 35 | \ .'? ("'.a:to.'") : ("'.a:from.'"))' |
| 36 | endfun |
| 37 | |
| 38 | call SetupCommandAlias("git","Git") |
| 39 | |
Skyler Grey | 60fcac9 | 2022-08-10 08:21:42 +0100 | [diff] [blame] | 40 | let g:camelcasemotion_key = '<leader>' |
| 41 | |
Skyler Grey | a949ffd | 2022-06-23 23:32:48 +0100 | [diff] [blame] | 42 | if exists('+termguicolors') |
| 43 | let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" |
| 44 | let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" |
| 45 | set termguicolors |
| 46 | endif |
Skyler Grey | 4802852 | 2022-06-23 23:37:22 +0100 | [diff] [blame] | 47 | |
Skyler Grey | 76d302d | 2022-08-02 23:15:29 +0100 | [diff] [blame] | 48 | let g:better_whitespace_enabled=1 |
| 49 | let g:strip_whitespace_on_save=1 |
| 50 | let g:strip_only_modified_lines=1 |
| 51 | let g:strip_whitelines_at_eof=1 |
| 52 | let g:show_spaces_that_precede_tabs=1 |
| 53 | nnoremap ]w :NextTrailingWhitespace<CR> |
| 54 | nnoremap [w :PrevTrailingWhitespace<CR> |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 55 | |
Skyler Grey | 9963f39 | 2022-08-06 13:05:56 +0100 | [diff] [blame] | 56 | nmap <silent> ]c :call CocAction('diagnosticNext')<cr> |
| 57 | nmap <silent> [c :call CocAction('diagnosticPrevious')<cr> |
Skyler Grey | bc1490d | 2022-08-10 11:39:19 +0100 | [diff] [blame] | 58 | nmap <silent> <Leader>fs <Plug>(coc-codeaction-selected) |
Skyler Grey | d98ed50 | 2022-08-10 11:41:00 +0100 | [diff] [blame^] | 59 | nmap <silent> <Leader>fg <Plug>(coc-codeaction-cursor) |
| 60 | nmap <silent> <Leader>ff <Plug>(coc-codeaction) |
Skyler Grey | 1232ee8 | 2022-08-10 11:35:14 +0100 | [diff] [blame] | 61 | nmap <Leader>e <Cmd>CocCommand explorer<CR> |
Skyler Grey | 4dad3c1 | 2022-08-04 22:15:51 +0100 | [diff] [blame] | 62 | |
Skyler Grey | 4802852 | 2022-06-23 23:37:22 +0100 | [diff] [blame] | 63 | set statusline=%t "tail of the filename |
| 64 | set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding |
| 65 | set statusline+=%{&ff}] "file format |
| 66 | set statusline+=%h "help file flag |
| 67 | set statusline+=%m "modified flag |
| 68 | set statusline+=%r "read only flag |
| 69 | set statusline+=%y "filetype |
| 70 | set statusline+=%= "left/right separator |
| 71 | set statusline+=%c, "cursor column |
| 72 | set statusline+=%l/%L "cursor line/total lines |
| 73 | set statusline+=\ %P "percent through file |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 74 | |
Skyler Grey | 76d302d | 2022-08-02 23:15:29 +0100 | [diff] [blame] | 75 | let g:VM_theme_set_by_colorscheme = 1 |
| 76 | highlight VM_Extend ctermfg=NONE guifg=NONE ctermbg=239 guibg=#474e5d |
| 77 | highlight VM_Cursor ctermfg=188 guifg=#dcdfe4 ctermbg=168 guibg=#e06c75 |
| 78 | highlight VM_Insert ctermfg=236 guifg=#282c34 ctermbg=176 guibg=#c678dd |
| 79 | highlight VM_Mono ctermfg=236 guifg=#282c34 ctermbg=75 guibg=#61afef |
| 80 | |
Skyler Grey | b4d0284 | 2022-08-06 09:18:51 +0100 | [diff] [blame] | 81 | highlight Pmenu ctermfg=188 guifg=#dcdfe4 ctermbg=239 guibg=#474e5d |
| 82 | highlight PmenuSel ctermfg=236 guifg=#282c34 ctermbg=75 guibg=#61afef |
| 83 | highlight PmenuSbar ctermfg=237 guifg=#313640 ctermbg=237 guibg=#313640 |
| 84 | highlight PmenuThumb ctermfg=188 guifg=#dcdfe4 ctermbg=188 guibg=#dcdfe4 |
| 85 | |
Skyler Grey | 40ebe3c | 2022-08-06 09:57:57 +0100 | [diff] [blame] | 86 | highlight CocErrorSign ctermfg=168 guifg=#e06c75 ctermbg=NONE guibg=NONE |
| 87 | highlight CocInfoSign ctermfg=75 guifg=#61afef ctermbg=NONE guibg=NONE |
| 88 | highlight CocWarningSign ctermfg=180 guifg=#e5c07b ctermbg=NONE guibg=NONE |
| 89 | |
Skyler Grey | 8d2f105 | 2022-07-09 21:02:17 +0100 | [diff] [blame] | 90 | nnoremap <silent> K :call <SID>show_documentation()<CR> |
| 91 | |
Skyler Grey | 1689430 | 2022-08-06 12:36:27 +0100 | [diff] [blame] | 92 | autocmd BufWritePre * Neoformat |
Skyler Grey | bee1367 | 2022-08-06 12:18:24 +0100 | [diff] [blame] | 93 | |
| 94 | let g:neoformat_try_node_exe = 1 |
| 95 | |
Skyler Grey | 8d2f105 | 2022-07-09 21:02:17 +0100 | [diff] [blame] | 96 | function! s:show_documentation() |
| 97 | if (index(['vim','help'], &filetype) >= 0) |
| 98 | execute 'h '.expand('<cword>') |
| 99 | else |
| 100 | call CocAction('doHover') |
| 101 | endif |
| 102 | endfunction |
| 103 | |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 104 | lua << EOF |
| 105 | require('neorg').setup { |
| 106 | load = { |
| 107 | ["core.defaults"] = {} |
| 108 | } |
| 109 | } |
Skyler Grey | 5510953 | 2022-07-04 18:31:29 +0100 | [diff] [blame] | 110 | |
Skyler Grey | b328357 | 2022-06-24 21:25:29 +0100 | [diff] [blame] | 111 | require('orgmode').setup_ts_grammar() |
Skyler Grey | 810c00e | 2022-06-24 21:16:22 +0100 | [diff] [blame] | 112 | |
| 113 | require('nvim-treesitter.configs').setup { |
| 114 | highlight = { |
| 115 | enable = true, |
Skyler Grey | b328357 | 2022-06-24 21:25:29 +0100 | [diff] [blame] | 116 | additional_vim_regex_highlighting = {'org'}, |
Skyler Grey | 810c00e | 2022-06-24 21:16:22 +0100 | [diff] [blame] | 117 | }, |
Skyler Grey | 76d302d | 2022-08-02 23:15:29 +0100 | [diff] [blame] | 118 | rainbow = { |
| 119 | enable = true, |
| 120 | extended_mode = true, |
| 121 | max_file_lines = nil, |
| 122 | }, |
Skyler Grey | 4597d65 | 2022-08-03 00:23:19 +0100 | [diff] [blame] | 123 | incremental_selection = { |
| 124 | enable = true, |
| 125 | keymaps = { |
| 126 | init_selection = "gnn", |
| 127 | node_incremental = "grn", |
| 128 | scope_incremental = "grc", |
| 129 | node_decremental = "grm", |
| 130 | }, |
| 131 | }, |
Skyler Grey | 810c00e | 2022-06-24 21:16:22 +0100 | [diff] [blame] | 132 | indent = { |
| 133 | enable = true, |
| 134 | }, |
| 135 | } |
Skyler Grey | c0a5245 | 2022-07-09 21:06:53 +0100 | [diff] [blame] | 136 | |
| 137 | require('git-conflict').setup() |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 138 | EOF |
Skyler Grey | 4597d65 | 2022-08-03 00:23:19 +0100 | [diff] [blame] | 139 | |
| 140 | set foldmethod=expr |
| 141 | set foldexpr=nvim_treesitter#foldexpr() |
Skyler Grey | 36eef4e | 2022-08-03 00:37:44 +0100 | [diff] [blame] | 142 | |
| 143 | set viewoptions-=options |
| 144 | autocmd BufWinLeave ?* mkview! |
| 145 | autocmd BufWinEnter ?* normal zR |
| 146 | autocmd BufWinEnter ?* silent! loadview |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 147 | ''; |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 148 | |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 149 | plugins = [ |
Skyler Grey | 8d2f105 | 2022-07-09 21:02:17 +0100 | [diff] [blame] | 150 | pkgs.vimPlugins.git-conflict-nvim |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 151 | pkgs.vimPlugins.vim-nix |
Skyler Grey | e96d011 | 2022-06-15 15:39:56 +0100 | [diff] [blame] | 152 | pkgs.vimPlugins.copilot-vim |
Skyler Grey | f2b5e26 | 2022-06-15 15:59:50 +0100 | [diff] [blame] | 153 | pkgs.vimPlugins.coc-tsserver |
Skyler Grey | 5510953 | 2022-07-04 18:31:29 +0100 | [diff] [blame] | 154 | pkgs.vimPlugins.coc-eslint |
Skyler Grey | 78260a2 | 2022-08-06 11:29:45 +0100 | [diff] [blame] | 155 | pkgs.vimPlugins.coc-rust-analyzer |
| 156 | pkgs.vimPlugins.coc-spell-checker |
| 157 | pkgs.vimPlugins.coc-json |
| 158 | pkgs.vimPlugins.coc-jest |
| 159 | pkgs.vimPlugins.coc-css |
| 160 | pkgs.vimPlugins.coc-explorer |
| 161 | pkgs.vimPlugins.neoformat |
Skyler Grey | 5886723 | 2022-06-23 22:02:10 +0100 | [diff] [blame] | 162 | pkgs.vimPlugins.zoomwintab-vim |
| 163 | pkgs.vimPlugins.onehalf |
Skyler Grey | 619d860 | 2022-06-24 14:20:51 +0100 | [diff] [blame] | 164 | pkgs.vimPlugins.neorg |
Skyler Grey | b328357 | 2022-06-24 21:25:29 +0100 | [diff] [blame] | 165 | pkgs.vimPlugins.orgmode |
Skyler Grey | f49e4f3 | 2022-07-20 20:47:35 +0100 | [diff] [blame] | 166 | pkgs.vimPlugins.vim-sleuth |
Skyler Grey | 249d9d0 | 2022-07-12 13:19:17 +0100 | [diff] [blame] | 167 | pkgs.vimPlugins.vim-visual-multi |
Skyler Grey | 76d302d | 2022-08-02 23:15:29 +0100 | [diff] [blame] | 168 | pkgs.vimPlugins.vim-better-whitespace |
Skyler Grey | 8ae90a2 | 2022-08-04 10:34:25 +0100 | [diff] [blame] | 169 | pkgs.vimPlugins.nvim-ts-rainbow |
Skyler Grey | e61027a | 2022-08-06 12:22:29 +0100 | [diff] [blame] | 170 | pkgs.vimPlugins.editorconfig-nvim |
Skyler Grey | 25b9652 | 2022-08-09 09:00:52 +0100 | [diff] [blame] | 171 | pkgs.vimPlugins.camelcasemotion |
Skyler Grey | dc7de36 | 2022-08-10 09:48:09 +0100 | [diff] [blame] | 172 | pkgs.vimPlugins.fugitive |
Skyler Grey | 8ae90a2 | 2022-08-04 10:34:25 +0100 | [diff] [blame] | 173 | (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)) |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 174 | ]; |
Skyler Grey | e699532 | 2022-06-12 09:29:17 +0100 | [diff] [blame] | 175 | }; |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 176 | |
| 177 | home.sessionVariables.EDITOR = "${pkgs.neovim}/bin/nvim"; |
Skyler Grey | 73c55fc | 2022-06-12 09:18:59 +0100 | [diff] [blame] | 178 | } |