Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 1 | { pkgs, ... }: { |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 2 | programs.neovim = { |
| 3 | enable = true; |
| 4 | coc = { |
| 5 | enable = true; |
| 6 | settings = { |
| 7 | "suggest.noselect" = false; |
Skyler Grey | 536f909 | 2022-08-12 21:20:14 +0100 | [diff] [blame^] | 8 | "cSpell.checkOnlyEnabledFileTypes" = false; |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 9 | }; |
| 10 | }; |
| 11 | viAlias = true; |
| 12 | vimAlias = true; |
| 13 | vimdiffAlias = true; |
| 14 | extraConfig = '' |
| 15 | let mapleader = "," |
| 16 | let g:VM_leader = "\\" |
| 17 | set whichwrap=b,s,<,>,[,] |
| 18 | set linebreak |
| 19 | set wrap |
| 20 | set number |
| 21 | set cursorline |
| 22 | set expandtab |
| 23 | set mouse=a |
| 24 | set splitright |
| 25 | set splitbelow |
| 26 | set clipboard=unnamedplus |
| 27 | set ignorecase |
| 28 | set smartcase |
Skyler Grey | d948b22 | 2022-08-12 14:28:21 +0100 | [diff] [blame] | 29 | set nocompatible |
| 30 | set hidden |
| 31 | set encoding=utf-8 |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 32 | set scrolloff=5 |
| 33 | colorscheme onehalfdark |
Skyler Grey | a949ffd | 2022-06-23 23:32:48 +0100 | [diff] [blame] | 34 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 35 | command W w |
| 36 | command Wq wq |
Skyler Grey | 6ad0c6d | 2022-08-10 09:54:25 +0100 | [diff] [blame] | 37 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 38 | fun! SetupCommandAlias(from, to) |
Skyler Grey | 6ad0c6d | 2022-08-10 09:54:25 +0100 | [diff] [blame] | 39 | exec 'cnoreabbrev <expr> '.a:from |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 40 | \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")' |
| 41 | \ .'? ("'.a:to.'") : ("'.a:from.'"))' |
| 42 | endfun |
Skyler Grey | 6ad0c6d | 2022-08-10 09:54:25 +0100 | [diff] [blame] | 43 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 44 | call SetupCommandAlias("git","Git") |
Skyler Grey | 6ad0c6d | 2022-08-10 09:54:25 +0100 | [diff] [blame] | 45 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 46 | let g:camelcasemotion_key = '<leader>' |
Skyler Grey | 60fcac9 | 2022-08-10 08:21:42 +0100 | [diff] [blame] | 47 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 48 | if exists('+termguicolors') |
Skyler Grey | a949ffd | 2022-06-23 23:32:48 +0100 | [diff] [blame] | 49 | let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" |
| 50 | let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" |
| 51 | set termguicolors |
Skyler Grey | 8d2f105 | 2022-07-09 21:02:17 +0100 | [diff] [blame] | 52 | endif |
Skyler Grey | 8d2f105 | 2022-07-09 21:02:17 +0100 | [diff] [blame] | 53 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 54 | let g:better_whitespace_enabled=1 |
| 55 | let g:strip_whitespace_on_save=1 |
| 56 | let g:strip_only_modified_lines=1 |
| 57 | let g:strip_whitelines_at_eof=1 |
| 58 | let g:show_spaces_that_precede_tabs=1 |
| 59 | nnoremap ]w :NextTrailingWhitespace<CR> |
| 60 | nnoremap [w :PrevTrailingWhitespace<CR> |
| 61 | |
Skyler Grey | 849ee15 | 2022-08-12 13:30:07 +0100 | [diff] [blame] | 62 | let g:airline#extensions#tabline#enabled = 1 |
Skyler Grey | d948b22 | 2022-08-12 14:28:21 +0100 | [diff] [blame] | 63 | let g:airline#extensions#tabline#formatter = 'unique_tail_improved' |
| 64 | let g:airline_powerline_fonts = 1 |
Skyler Grey | 8bad258 | 2022-08-12 15:17:20 +0100 | [diff] [blame] | 65 | let g:airline#extensions#hunks#coc_git = 1 |
| 66 | let g:airline#extensions#whitespace#enabled = 1 |
| 67 | |
Skyler Grey | fceb669 | 2022-08-12 16:56:59 +0100 | [diff] [blame] | 68 | nnoremap <silent> <leader>gg :LazyGit<CR> |
| 69 | |
Skyler Grey | 8bad258 | 2022-08-12 15:17:20 +0100 | [diff] [blame] | 70 | let g:airline#extensions#tabline#buffer_idx_mode = 1 |
| 71 | nmap <leader>1 <Plug>AirlineSelectTab1 |
| 72 | nmap <leader>2 <Plug>AirlineSelectTab2 |
| 73 | nmap <leader>3 <Plug>AirlineSelectTab3 |
| 74 | nmap <leader>4 <Plug>AirlineSelectTab4 |
| 75 | nmap <leader>5 <Plug>AirlineSelectTab5 |
| 76 | nmap <leader>6 <Plug>AirlineSelectTab6 |
| 77 | nmap <leader>7 <Plug>AirlineSelectTab7 |
| 78 | nmap <leader>8 <Plug>AirlineSelectTab8 |
| 79 | nmap <leader>9 <Plug>AirlineSelectTab9 |
| 80 | nmap <leader>0 <Plug>AirlineSelectTab0 |
| 81 | nmap <leader>- <Plug>AirlineSelectPrevTab |
| 82 | nmap <leader>+ <Plug>AirlineSelectNextTab |
Skyler Grey | 8bad258 | 2022-08-12 15:17:20 +0100 | [diff] [blame] | 83 | let g:airline_skip_empty_sections = 1 |
Skyler Grey | d948b22 | 2022-08-12 14:28:21 +0100 | [diff] [blame] | 84 | |
| 85 | let g:ctrlp_map = '<c-p>' |
| 86 | let g:ctrlp_cmd = 'CtrlP' |
Skyler Grey | 849ee15 | 2022-08-12 13:30:07 +0100 | [diff] [blame] | 87 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 88 | nmap <silent> ]c :call CocAction('diagnosticNext')<cr> |
| 89 | nmap <silent> [c :call CocAction('diagnosticPrevious')<cr> |
| 90 | nmap <silent> <Leader>fs <Plug>(coc-codeaction-selected) |
| 91 | nmap <silent> <Leader>fg <Plug>(coc-codeaction-cursor) |
| 92 | nmap <silent> <Leader>ff <Plug>(coc-codeaction) |
| 93 | nmap <Leader>fe <Cmd>CocCommand explorer<CR> |
| 94 | |
| 95 | vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR> |
| 96 | |
| 97 | set statusline=%t "tail of the filename |
| 98 | set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding |
| 99 | set statusline+=%{&ff}] "file format |
| 100 | set statusline+=%h "help file flag |
| 101 | set statusline+=%m "modified flag |
| 102 | set statusline+=%r "read only flag |
| 103 | set statusline+=%y "filetype |
| 104 | set statusline+=%= "left/right separator |
| 105 | set statusline+=%c, "cursor column |
| 106 | set statusline+=%l/%L "cursor line/total lines |
| 107 | set statusline+=\ %P "percent through file |
| 108 | |
| 109 | let g:VM_theme_set_by_colorscheme = 1 |
| 110 | highlight VM_Extend ctermfg=NONE guifg=NONE ctermbg=239 guibg=#474e5d |
| 111 | highlight VM_Cursor ctermfg=188 guifg=#dcdfe4 ctermbg=168 guibg=#e06c75 |
| 112 | highlight VM_Insert ctermfg=236 guifg=#282c34 ctermbg=176 guibg=#c678dd |
| 113 | highlight VM_Mono ctermfg=236 guifg=#282c34 ctermbg=75 guibg=#61afef |
| 114 | |
| 115 | highlight Pmenu ctermfg=188 guifg=#dcdfe4 ctermbg=239 guibg=#474e5d |
| 116 | highlight PmenuSel ctermfg=236 guifg=#282c34 ctermbg=75 guibg=#61afef |
| 117 | highlight PmenuSbar ctermfg=237 guifg=#313640 ctermbg=237 guibg=#313640 |
| 118 | highlight PmenuThumb ctermfg=188 guifg=#dcdfe4 ctermbg=188 guibg=#dcdfe4 |
| 119 | |
| 120 | highlight CocErrorSign ctermfg=168 guifg=#e06c75 ctermbg=NONE guibg=NONE |
| 121 | highlight CocInfoSign ctermfg=75 guifg=#61afef ctermbg=NONE guibg=NONE |
| 122 | highlight CocWarningSign ctermfg=180 guifg=#e5c07b ctermbg=NONE guibg=NONE |
| 123 | |
| 124 | nnoremap <silent> K :call <SID>show_documentation()<CR> |
| 125 | |
| 126 | autocmd BufWritePre * Neoformat |
| 127 | |
| 128 | let g:neoformat_try_node_exe = 1 |
| 129 | |
| 130 | function! s:show_documentation() |
| 131 | if (index(['vim','help'], &filetype) >= 0) |
| 132 | execute 'h '.expand('<cword>') |
| 133 | else |
| 134 | call CocAction('doHover') |
| 135 | endif |
| 136 | endfunction |
| 137 | |
| 138 | lua << EOF |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 139 | require('neorg').setup { |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 140 | load = { |
| 141 | ["core.defaults"] = {} |
| 142 | } |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 143 | } |
Skyler Grey | 5510953 | 2022-07-04 18:31:29 +0100 | [diff] [blame] | 144 | |
Skyler Grey | b328357 | 2022-06-24 21:25:29 +0100 | [diff] [blame] | 145 | require('orgmode').setup_ts_grammar() |
Skyler Grey | 810c00e | 2022-06-24 21:16:22 +0100 | [diff] [blame] | 146 | |
| 147 | require('nvim-treesitter.configs').setup { |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 148 | highlight = { |
| 149 | enable = true, |
| 150 | additional_vim_regex_highlighting = {'org'}, |
Skyler Grey | 4597d65 | 2022-08-03 00:23:19 +0100 | [diff] [blame] | 151 | }, |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 152 | rainbow = { |
| 153 | enable = true, |
| 154 | extended_mode = true, |
| 155 | max_file_lines = nil, |
| 156 | }, |
| 157 | incremental_selection = { |
| 158 | enable = true, |
| 159 | keymaps = { |
| 160 | init_selection = "gnn", |
| 161 | node_incremental = "grn", |
| 162 | scope_incremental = "grc", |
| 163 | node_decremental = "grm", |
| 164 | }, |
| 165 | }, |
| 166 | indent = { |
| 167 | enable = true, |
| 168 | }, |
Skyler Grey | 810c00e | 2022-06-24 21:16:22 +0100 | [diff] [blame] | 169 | } |
Skyler Grey | c0a5245 | 2022-07-09 21:06:53 +0100 | [diff] [blame] | 170 | |
| 171 | require('git-conflict').setup() |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 172 | EOF |
Skyler Grey | 4597d65 | 2022-08-03 00:23:19 +0100 | [diff] [blame] | 173 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 174 | set foldmethod=expr |
| 175 | set foldexpr=nvim_treesitter#foldexpr() |
Skyler Grey | 36eef4e | 2022-08-03 00:37:44 +0100 | [diff] [blame] | 176 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 177 | set viewoptions-=options |
| 178 | autocmd BufWinLeave ?* mkview! |
| 179 | autocmd BufWinEnter ?* normal zR |
Skyler Grey | dfd501b | 2022-08-11 09:48:47 +0100 | [diff] [blame] | 180 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 181 | function! s:loadViewOrUnfold() |
Skyler Grey | dfd501b | 2022-08-11 09:48:47 +0100 | [diff] [blame] | 182 | try |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 183 | loadview |
Skyler Grey | dfd501b | 2022-08-11 09:48:47 +0100 | [diff] [blame] | 184 | catch |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 185 | folddoclosed foldopen |
Skyler Grey | dfd501b | 2022-08-11 09:48:47 +0100 | [diff] [blame] | 186 | endtry |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 187 | endfunction |
Skyler Grey | dfd501b | 2022-08-11 09:48:47 +0100 | [diff] [blame] | 188 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 189 | autocmd BufWinEnter ?* call s:loadViewOrUnfold() |
Skyler Grey | d948b22 | 2022-08-12 14:28:21 +0100 | [diff] [blame] | 190 | |
| 191 | |
| 192 | :let g:airline_highlighting_cache = 1 |
Skyler Grey | 8bad258 | 2022-08-12 15:17:20 +0100 | [diff] [blame] | 193 | autocmd VimEnter * call vista#RunForNearestMethodOrFunction() |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 194 | ''; |
Skyler Grey | 686ca7f | 2022-06-24 14:30:05 +0100 | [diff] [blame] | 195 | |
Skyler Grey | 1dc04f2 | 2022-08-12 21:04:38 +0100 | [diff] [blame] | 196 | plugins = with pkgs.vimPlugins; [ |
| 197 | git-conflict-nvim |
| 198 | vim-nix |
| 199 | copilot-vim |
| 200 | coc-tsserver |
| 201 | coc-eslint |
| 202 | coc-rust-analyzer |
| 203 | coc-spell-checker |
| 204 | coc-json |
| 205 | coc-jest |
| 206 | coc-css |
| 207 | coc-explorer |
| 208 | coc-git |
| 209 | neoformat |
| 210 | zoomwintab-vim |
| 211 | onehalf |
| 212 | neorg |
| 213 | orgmode |
| 214 | vim-sleuth |
| 215 | vim-visual-multi |
| 216 | vim-better-whitespace |
| 217 | nvim-ts-rainbow |
| 218 | editorconfig-nvim |
| 219 | camelcasemotion |
| 220 | fugitive |
| 221 | vim-flog |
| 222 | airline |
| 223 | vista-vim |
| 224 | vim-gitgutter |
| 225 | ctrlp-vim |
| 226 | vim-airline-clock |
| 227 | vim-airline-themes |
| 228 | lazygit-nvim |
| 229 | (nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)) |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 230 | ]; |
| 231 | }; |
Skyler Grey | c96cd8a | 2022-06-15 12:28:27 +0100 | [diff] [blame] | 232 | |
Skyler Grey | 1dc04f2 | 2022-08-12 21:04:38 +0100 | [diff] [blame] | 233 | home.packages = with pkgs; [ |
| 234 | universal-ctags |
| 235 | nodePackages.cspell |
Skyler Grey | d948b22 | 2022-08-12 14:28:21 +0100 | [diff] [blame] | 236 | ]; |
| 237 | |
Skyler Grey | 49c030f | 2022-08-12 11:48:56 +0100 | [diff] [blame] | 238 | home.sessionVariables.EDITOR = "${pkgs.neovim}/bin/nvim"; |
Skyler Grey | 73c55fc | 2022-06-12 09:18:59 +0100 | [diff] [blame] | 239 | } |