blob: c961cd2a4e4d66a215a9ba6314e28d7bf8080854 [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 Greya949ffd2022-06-23 23:32:48 +010025 colorscheme onehalfdark
26
27 if exists('+termguicolors')
28 let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
29 let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
30 set termguicolors
31 endif
Skyler Grey48028522022-06-23 23:37:22 +010032
Skyler Grey76d302d2022-08-02 23:15:29 +010033 let g:better_whitespace_enabled=1
34 let g:strip_whitespace_on_save=1
35 let g:strip_only_modified_lines=1
36 let g:strip_whitelines_at_eof=1
37 let g:show_spaces_that_precede_tabs=1
38 nnoremap ]w :NextTrailingWhitespace<CR>
39 nnoremap [w :PrevTrailingWhitespace<CR>
Skyler Grey686ca7f2022-06-24 14:30:05 +010040
Skyler Grey48028522022-06-23 23:37:22 +010041 set statusline=%t "tail of the filename
42 set statusline+=[%{strlen(&fenc)?&fenc:'none'}, "file encoding
43 set statusline+=%{&ff}] "file format
44 set statusline+=%h "help file flag
45 set statusline+=%m "modified flag
46 set statusline+=%r "read only flag
47 set statusline+=%y "filetype
48 set statusline+=%= "left/right separator
49 set statusline+=%c, "cursor column
50 set statusline+=%l/%L "cursor line/total lines
51 set statusline+=\ %P "percent through file
Skyler Grey686ca7f2022-06-24 14:30:05 +010052
Skyler Grey76d302d2022-08-02 23:15:29 +010053 let g:VM_theme_set_by_colorscheme = 1
54 highlight VM_Extend ctermfg=NONE guifg=NONE ctermbg=239 guibg=#474e5d
55 highlight VM_Cursor ctermfg=188 guifg=#dcdfe4 ctermbg=168 guibg=#e06c75
56 highlight VM_Insert ctermfg=236 guifg=#282c34 ctermbg=176 guibg=#c678dd
57 highlight VM_Mono ctermfg=236 guifg=#282c34 ctermbg=75 guibg=#61afef
58
Skyler Grey8d2f1052022-07-09 21:02:17 +010059 nnoremap <silent> K :call <SID>show_documentation()<CR>
60
61 function! s:show_documentation()
62 if (index(['vim','help'], &filetype) >= 0)
63 execute 'h '.expand('<cword>')
64 else
65 call CocAction('doHover')
66 endif
67 endfunction
68
Skyler Grey686ca7f2022-06-24 14:30:05 +010069 lua << EOF
70 require('neorg').setup {
71 load = {
72 ["core.defaults"] = {}
73 }
74 }
Skyler Grey55109532022-07-04 18:31:29 +010075
Skyler Greyb3283572022-06-24 21:25:29 +010076 require('orgmode').setup_ts_grammar()
Skyler Grey810c00e2022-06-24 21:16:22 +010077
78 require('nvim-treesitter.configs').setup {
79 highlight = {
80 enable = true,
Skyler Greyb3283572022-06-24 21:25:29 +010081 additional_vim_regex_highlighting = {'org'},
Skyler Grey810c00e2022-06-24 21:16:22 +010082 },
Skyler Grey76d302d2022-08-02 23:15:29 +010083 rainbow = {
84 enable = true,
85 extended_mode = true,
86 max_file_lines = nil,
87 },
Skyler Grey4597d652022-08-03 00:23:19 +010088 incremental_selection = {
89 enable = true,
90 keymaps = {
91 init_selection = "gnn",
92 node_incremental = "grn",
93 scope_incremental = "grc",
94 node_decremental = "grm",
95 },
96 },
Skyler Grey810c00e2022-06-24 21:16:22 +010097 indent = {
98 enable = true,
99 },
100 }
Skyler Greyc0a52452022-07-09 21:06:53 +0100101
102 require('git-conflict').setup()
Skyler Grey686ca7f2022-06-24 14:30:05 +0100103 EOF
Skyler Grey4597d652022-08-03 00:23:19 +0100104
105 set foldmethod=expr
106 set foldexpr=nvim_treesitter#foldexpr()
Skyler Grey36eef4e2022-08-03 00:37:44 +0100107
108 set viewoptions-=options
109 autocmd BufWinLeave ?* mkview!
110 autocmd BufWinEnter ?* normal zR
111 autocmd BufWinEnter ?* silent! loadview
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100112 '';
Skyler Grey686ca7f2022-06-24 14:30:05 +0100113
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100114 plugins = [
Skyler Grey8d2f1052022-07-09 21:02:17 +0100115 pkgs.vimPlugins.git-conflict-nvim
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100116 pkgs.vimPlugins.vim-nix
Skyler Greye96d0112022-06-15 15:39:56 +0100117 pkgs.vimPlugins.copilot-vim
Skyler Greyf2b5e262022-06-15 15:59:50 +0100118 pkgs.vimPlugins.coc-tsserver
Skyler Grey55109532022-07-04 18:31:29 +0100119 pkgs.vimPlugins.coc-eslint
Skyler Grey58867232022-06-23 22:02:10 +0100120 pkgs.vimPlugins.zoomwintab-vim
121 pkgs.vimPlugins.onehalf
Skyler Grey619d8602022-06-24 14:20:51 +0100122 pkgs.vimPlugins.neorg
Skyler Greyb3283572022-06-24 21:25:29 +0100123 pkgs.vimPlugins.orgmode
Skyler Greyf49e4f32022-07-20 20:47:35 +0100124 pkgs.vimPlugins.vim-sleuth
Skyler Grey249d9d02022-07-12 13:19:17 +0100125 pkgs.vimPlugins.vim-visual-multi
Skyler Grey76d302d2022-08-02 23:15:29 +0100126 pkgs.vimPlugins.vim-better-whitespace
Skyler Grey8ae90a22022-08-04 10:34:25 +0100127 pkgs.vimPlugins.nvim-ts-rainbow
128 (pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars))
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100129 ];
Skyler Greye6995322022-06-12 09:29:17 +0100130 };
Skyler Greyc96cd8a2022-06-15 12:28:27 +0100131
132 home.sessionVariables.EDITOR = "${pkgs.neovim}/bin/nvim";
Skyler Grey73c55fc2022-06-12 09:18:59 +0100133}