~chiefnoah/dotfiles unlisted

dotfiles/dotfiles/config/nvim/init.vim -rw-r--r-- 8.6 KiB
918c5339Noah Pederson Fixes dropped config in alacritty 5 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
" Install vim-plug first for this to work
" https://github.com/junegunn/vim-plug
call plug#begin('~/.local/share/nvim/plugged')

" Plugins go here

" NERDTree
"Plug 'scrooloose/nerdtree'
"Plug 'Xuyuanp/nerdtree-git-plugin'

" GitGutter, shows inline difs
Plug 'airblade/vim-gitgutter'

" Git wrapper plugin
Plug 'tpope/vim-fugitive'

" Coc language server
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Alternative lsp plugin
"Plug 'neovim/nvim-lsp'


" Auto bracket completion
Plug 'jiangmiao/auto-pairs'

" Auto comment tool
Plug 'scrooloose/nerdcommenter'

" Auto format tool
Plug 'sbdchd/neoformat'

" Distraction free writing: GoYo + Limelight
Plug 'junegunn/limelight.vim'
Plug 'junegunn/goyo.vim'

" Golang plugins
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }

" Airline/powerline bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'

" ctrl+p
Plug 'ctrlpvim/ctrlp.vim'

" FlyGrep
" Plug 'wsdjeg/FlyGrep.vim'
Plug 'junegunn/fzf.vim'
Plug '~/.fzf', { 'do': { -> fzf#install() } }


" Python Specific plugins
Plug 'plytophogy/vim-virtualenv'
Plug 'janko/vim-test'

" Color themes
" Plug 'NLKNguyen/papercolor-theme'
Plug 'arcticicestudio/nord-vim'
" from http://nerdypepper.tech/
Plug 'nerdypepper/agila.vim'
Plug 'nerdypepper/chestnut.vim'
Plug 'nerdypepper/vim-colors-plain', { 'branch': 'duotone' }

" VIMPolyglot: https://github.com/sheerun/vim-polyglot
Plug 'sheerun/vim-polyglot'

" Markdown handling
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'

" Neuron stuff
Plug 'chiefnoah/neuron-v2.vim'

" Cute python!
Plug 'ehamberg/vim-cute-python', {'branch': 'moresymbols'}
call plug#end()

set expandtab
set tabstop=4
set shiftwidth=4
set termguicolors
set cursorcolumn
set cursorline

" per filetype tabstops
autocmd FileType python setlocal tabstop=4
autocmd FileType markdown setlocal tabstop=2
autocmd FileType markdown setlocal nofoldenable

let mapleader=";"

:map Q <Nop>
let g:netrw_fastbrowse = 0

" Leader binding
inoremap ;; <Esc>
vnoremap ;; <Esc>

tnoremap <Esc> <C-\><C-n>

" Tab navigation
nnoremap <leader>tn :tabnew<CR>
nnoremap <leader>tc :tabclose<CR>
nnoremap <leader><tab> :tabn<CR>
nnoremap <leader>tt :tabn<CR>
nnoremap <leader>h <C-w>h
nnoremap <leader>l <C-w>l
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k

" Buffer navigation
nnoremap <leader>bn :bnext<CR>
nnoremap <leader>bp :bprev<CR>
" close buffer and put previous into current window
nmap <leader>bq :bp <BAR> bd #<CR>
" list buffers
nmap <leader>bl :ls<CR>
" vertical split
nnoremap <leader>vs :vsplit<CR>
" horizontal split
nnoremap <leader>ss :split<CR>
" horizontal split
nnoremap <leader>hs :split<CR>

" toggle line numbers
nnoremap <silent> <leader>n :set number! number?<CR>
" Shortcut to edit THIS configuration file: (e)dit (c)onfiguration
nnoremap <silent> <leader>ec :tabnew $MYVIMRC<CR>
" Shortcut to source (reload) THIS configuration file after editing it: (s)ource (c)onfiguraiton
nnoremap <silent> <leader>sc :source $MYVIMRC<CR>

" jsonc comment syntax highlighting
autocmd FileType json syntax match Comment +\/\/.\+$+

" I don't like word wrapping
set nowrap
" mouse support
set mouse=a

set conceallevel=3

"" Set theme for airline
let g:airline_powerline_fonts = 1

" Airline on top
let g:airline#extensions#tabline#enabled = 1

"nnoremap <leader>s/ :FZF<cr>
let g:fzf_layout = { 'down': '30%' }

" enable header folding
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_folding_level = 6

let g:vim_markdown_conceal = 0
let g:vim_markdown_toml_frontmatter = 1
let g:vim_markdown_strikethrough = 1
let g:vim_markdown_autowrite = 0
let g:vim_markdown_toc_autofit = 1
let g:vim_markdown_follow_anchor = 1
let g:vim_markdown_new_list_item_indent = 2

" vim-test configuration
let test#strategy = "neovim"

" ctrl-p default command
let g:ctrlp_cmd = 'CtrlPBuffer'

" 120 char limit, with support for older vim releases
if exists('+colorcolumn')
  set colorcolumn=120
else
  au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>120v.\+', -1)
endif

if filereadable(expand("~/.local/tmp/ctags"))
    :set tags=~/.local/tmp/ctags
endif
" coc python stuff https://github.com/neoclide/coc-python
if executable('node')
    " coc suggested config

    " coc-prettier command
    command! -nargs=0 Prettier :CocCommand prettier.formatFile

    " coc integration with airline
    let g:airline#extensions#coc#enabled = 1
    set hidden
    set nobackup
    set nowritebackup
    set cmdheight=2
    set updatetime=300
    set shortmess+=c
    set signcolumn=yes

    inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
    inoremap <expr><S-TAB> pumvisible() ? "<C-p>" : "\<C-h>"

    function! s:check_back_space() abort
      let col = col('.') - 1
      return !col || getline('.')[col - 1]  =~# '\s'
    endfunction

    inoremap <silent><expr> <c-space> coc#refresh()

    " Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
    " Coc only does snippet and additional edit on confirm.
    inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"

    " Use `[c` and `]c` to navigate diagnostics
    nmap <silent> [d <Plug>(coc-diagnostic-prev)
    nmap <silent> ]d <Plug>(coc-diagnostic-next)

    " Remap keys for gotos
    nmap <silent> gd <Plug>(coc-definition)
    nmap <silent> gy <Plug>(coc-type-definition)
    nmap <silent> gi <Plug>(coc-implementation)
    nmap <silent> gr <Plug>(coc-references)

    " Use K to show documentation in preview window
    nnoremap <silent> K :call <SID>show_documentation()<CR>

    function! s:show_documentation()
      if (index(['vim','help'], &filetype) >= 0)
        execute 'h '.expand('<cword>')
      else
        call CocAction('doHover')
      endif
    endfunction

    " Highlight symbol under cursor on CursorHold
    autocmd CursorHold * silent call CocActionAsync('highlight')
    " Remap for rename current word
    nmap <leader>rn <Plug>(coc-rename)

    " Remap for format selected region
    xmap <leader>f  <Plug>(coc-format-selected)
    nmap <leader>f  <Plug>(coc-format-selected)

    augroup mygroup
      autocmd!
      " Setup formatexpr specified filetype(s).
      autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
      " Update signature help on jump placeholder
      autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
    augroup end

    " Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
    xmap <leader>a  <Plug>(coc-codeaction-selected)
    nmap <leader>a  <Plug>(coc-codeaction-selected)

    " Remap for do codeAction of current line
    nmap <leader>ac  <Plug>(coc-codeaction)
    " Fix autofix problem of current line
    nmap <leader>qf  <Plug>(coc-fix-current)

    " Use <tab> for select selections ranges, needs server support, like: coc-tsserver, coc-python
    nmap <silent> <TAB> <Plug>(coc-range-select)
    xmap <silent> <TAB> <Plug>(coc-range-select)
    xmap <silent> <S-TAB> <Plug>(coc-range-select-backword)

    " Use `:Format` to format current buffer
    command! -nargs=0 Format :call CocAction('format')

    " Use `:Fold` to fold current buffer
    command! -nargs=? Fold :call     CocAction('fold', <f-args>)

    " use `:OR` for organize import of current buffer
    command! -nargs=0 OR   :call     CocAction('runCommand', 'editor.action.organizeImport')

    " Add status line support, for integration with other plugin, checkout `:h coc-status`
    set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

    " Using CocList
    " Show all diagnostics
    nnoremap <silent> <space>a  :<C-u>CocList diagnostics<cr>
    " Manage extensions
    nnoremap <silent> <space>e  :<C-u>CocList extensions<cr>
    " Show commands
    nnoremap <silent> <space>c  :<C-u>CocList commands<cr>
    " Find symbol of current document
    nnoremap <silent> <space>o  :<C-u>CocList outline<cr>
    " Search workspace symbols
    nnoremap <silent> <space>s  :<C-u>CocList -I symbols<cr>
    " Do default action for next item.
    nnoremap <silent> <space>j  :<C-u>CocNext<CR>
    " Do default action for previous item.
    nnoremap <silent> <space>k  :<C-u>CocPrev<CR>
    " Resume latest coc list
    nnoremap <silent> <space>p  :<C-u>CocListResume<CR>

    " END coc configuration
endif

highlight Comment cterm=italic
colorscheme nord 
set background=dark

"let g:airline_theme='base16_ashes'
"let g:airline_theme='random'
"let g:airline_theme='night_owl'
"let g:airline_theme='fairyfloss'
"let g:airline_theme='owo'
" let g:airline_theme='base16_ashes'
let g:airline_theme='nord'
" Spell checking
" set spell spelllang=en_us
set spelllang=en_us

" Markdown 
autocmd FileType markdown setlocal textwidth=80 colorcolumn=+1