blob: 86c15bc5218100b1116b5a240c8b58e2d775593f [file] [log] [blame]
Skyler Greyc96cd8a2022-06-15 12:28:27 +01001{ pkgs, ... }: {
Skyler Greye6995322022-06-12 09:29:17 +01002 programs.neovim = {
3 enable = true;
Skyler Greyc96cd8a2022-06-15 12:28:27 +01004 coc = {
5 enable = true;
6 settings = {
7 "suggest.noselect" = false;
8 };
9 };
Skyler Greye6995322022-06-12 09:29:17 +010010 viAlias = true;
11 vimAlias = true;
12 vimdiffAlias = true;
Skyler Greyc96cd8a2022-06-15 12:28:27 +010013 extraConfig = ''
14 set whichwrap=b,s,<,>,[,]
Skyler Greya3999c02022-06-24 14:05:13 +010015 set linebreak
Skyler Grey2e80a192022-06-15 14:23:01 +010016 set wrap
17 set number
Skyler Greya949ffd2022-06-23 23:32:48 +010018 set cursorline
Skyler Grey32da1932022-07-05 08:37:59 +010019 set expandtab
Skyler Grey8d2f1052022-07-09 21:02:17 +010020 set mouse=a
Skyler Greya0b7aea2022-07-12 12:01:49 +010021 set splitright
Skyler Grey1e4cbc72022-07-12 12:39:02 +010022 set splitbelow
Skyler Grey41966112022-07-09 21:38:53 +010023 set clipboard=unnamedplus
Skyler Grey0bd95942022-07-27 13:16:29 +010024 set smartcase
Skyler Grey5f20cf22022-08-04 21:59:38 +010025 set scrolloff=5
Skyler Greya949ffd2022-06-23 23:32:48 +010026 colorscheme onehalfdark
27
28 if exists('+termguicolors')
29 let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
30 let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
31 set termguicolors
32 endif
Skyler Grey48028522022-06-23 23:37:22 +010033
Skyler Grey76d302d2022-08-02 23:15:29 +010034 let g:better_whitespace_enabled=1
35 let g:strip_whitespace_on_save=1
36 let g:strip_only_modified_lines=1
37 let g:strip_whitelines_at_eof=1
38 let g:show_spaces_that_precede_tabs=1
39 nnoremap ]w :NextTrailingWhitespace<CR>
40 nnoremap [w :PrevTrailingWhitespace<CR>
Skyler Grey686ca7f2022-06-24 14:30:05 +010041
Skyler Grey4dad3c12022-08-04 22:15:51 +010042 nmap <silent> [c :call CocAction('diagnosticNext')<cr>
43 nmap <silent> ]c :call CocAction('diagnosticPrevious')<cr>
44
Skyler Grey48028522022-06-23 23:37:22 +010045 set statusline=%t "tail of the filename
46 set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
47 set statusline+=%{&ff}] "file format
48 set statusline+=%h "help file flag
49 set statusline+=%m "modified flag
50 set statusline+=%r "read only flag
51 set statusline+=%y "filetype
52 set statusline+=%= "left/right separator
53 set statusline+=%c, "cursor column
54 set statusline+=%l/%L "cursor line/total lines
55 set statusline+=\ %P "percent through file
Skyler Grey686ca7f2022-06-24 14:30:05 +010056
Skyler Grey76d302d2022-08-02 23:15:29 +010057 let g:VM_theme_set_by_colorscheme = 1
58 highlight VM_Extend ctermfg=NONE guifg=NONE ctermbg=239 guibg=#474e5d
59 highlight VM_Cursor ctermfg=188 guifg=#dcdfe4 ctermbg=168 guibg=#e06c75
60 highlight VM_Insert ctermfg=236 guifg=#282c34 ctermbg=176 guibg=#c678dd
61 highlight VM_Mono ctermfg=236 guifg=#282c34 ctermbg=75 guibg=#61afef
62
Skyler Greyb4d02842022-08-06 09:18:51 +010063 highlight Pmenu ctermfg=188 guifg=#dcdfe4 ctermbg=239 guibg=#474e5d
64 highlight PmenuSel ctermfg=236 guifg=#282c34 ctermbg=75 guibg=#61afef
65 highlight PmenuSbar ctermfg=237 guifg=#313640 ctermbg=237 guibg=#313640
66 highlight PmenuThumb ctermfg=188 guifg=#dcdfe4 ctermbg=188 guibg=#dcdfe4
67
Skyler Grey40ebe3c2022-08-06 09:57:57 +010068 highlight CocErrorSign ctermfg=168 guifg=#e06c75 ctermbg=NONE guibg=NONE
69 highlight CocInfoSign ctermfg=75 guifg=#61afef ctermbg=NONE guibg=NONE
70 highlight CocWarningSign ctermfg=180 guifg=#e5c07b ctermbg=NONE guibg=NONE
71
Skyler Grey8d2f1052022-07-09 21:02:17 +010072 nnoremap <silent> K :call <SID>show_documentation()<CR>
73
74 function! s:show_documentation()
75 if (index(['vim','help'], &filetype) >= 0)
76 execute 'h '.expand('<cword>')
77 else
78 call CocAction('doHover')
79 endif
80 endfunction
81
Skyler Grey686ca7f2022-06-24 14:30:05 +010082 lua << EOF
83 require('neorg').setup {
84 load = {
85 ["core.defaults"] = {}
86 }
87 }
Skyler Grey55109532022-07-04 18:31:29 +010088
Skyler Greyb3283572022-06-24 21:25:29 +010089 require('orgmode').setup_ts_grammar()
Skyler Grey810c00e2022-06-24 21:16:22 +010090
91 require('nvim-treesitter.configs').setup {
92 highlight = {
93 enable = true,
Skyler Greyb3283572022-06-24 21:25:29 +010094 additional_vim_regex_highlighting = {'org'},
Skyler Grey810c00e2022-06-24 21:16:22 +010095 },
Skyler Grey76d302d2022-08-02 23:15:29 +010096 rainbow = {
97 enable = true,
98 extended_mode = true,
99 max_file_lines = nil,
100 },
Skyler Grey4597d652022-08-03 00:23:19 +0100101 incremental_selection = {
102 enable = true,
103 keymaps = {
104 init_selection = "gnn",
105 node_incremental = "grn",
106 scope_incremental = "grc",
107 node_decremental = "grm",
108 },
109 },
Skyler Grey810c00e2022-06-24 21:16:22 +0100110 indent = {
111 enable = true,
112 },
113 }
Skyler Greyc0a52452022-07-09 21:06:53 +0100114
115 require('git-conflict').setup()
Skyler Grey686ca7f2022-06-24 14:30:05 +0100116 EOF
Skyler Grey4597d652022-08-03 00:23:19 +0100117
118 set foldmethod=expr
119 set foldexpr=nvim_treesitter#foldexpr()
Skyler Grey36eef4e2022-08-03 00:37:44 +0100120
121 set viewoptions-=options
122 autocmd BufWinLeave ?* mkview!
123 autocmd BufWinEnter ?* normal zR
124 autocmd BufWinEnter ?* silent! loadview
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100125 '';
Skyler Grey686ca7f2022-06-24 14:30:05 +0100126
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100127 plugins = [
Skyler Grey8d2f1052022-07-09 21:02:17 +0100128 pkgs.vimPlugins.git-conflict-nvim
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100129 pkgs.vimPlugins.vim-nix
Skyler Greye96d0112022-06-15 15:39:56 +0100130 pkgs.vimPlugins.copilot-vim
Skyler Greyf2b5e262022-06-15 15:59:50 +0100131 pkgs.vimPlugins.coc-tsserver
Skyler Grey55109532022-07-04 18:31:29 +0100132 pkgs.vimPlugins.coc-eslint
Skyler Grey58867232022-06-23 22:02:10 +0100133 pkgs.vimPlugins.zoomwintab-vim
134 pkgs.vimPlugins.onehalf
Skyler Grey619d8602022-06-24 14:20:51 +0100135 pkgs.vimPlugins.neorg
Skyler Greyb3283572022-06-24 21:25:29 +0100136 pkgs.vimPlugins.orgmode
Skyler Greyf49e4f32022-07-20 20:47:35 +0100137 pkgs.vimPlugins.vim-sleuth
Skyler Grey249d9d02022-07-12 13:19:17 +0100138 pkgs.vimPlugins.vim-visual-multi
Skyler Grey76d302d2022-08-02 23:15:29 +0100139 pkgs.vimPlugins.vim-better-whitespace
Skyler Grey8ae90a22022-08-04 10:34:25 +0100140 pkgs.vimPlugins.nvim-ts-rainbow
141 (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars))
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100142 ];
Skyler Greye6995322022-06-12 09:29:17 +0100143 };
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100144
145 home.sessionVariables.EDITOR = "${pkgs.neovim}/bin/nvim";
Skyler Grey73c55fc2022-06-12 09:18:59 +0100146}