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