-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.terminal-vimrc
executable file
·897 lines (759 loc) · 29.7 KB
/
.terminal-vimrc
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
" -----------------------------------------------------------------------------------
" GLOBAL SETTINGS
syntax on
set nocompatible
set cursorline
set noerrorbells
set tabstop=4
set softtabstop=4
set sw=4
set expandtab
set smartindent
set nu
set nowrap
set noswapfile
set nobackup
set undodir=~/.vim/undo
set undofile
set incsearch
set hlsearch
set fileformats=unix,dos
set nobinary
set encoding=UTF-8
set formatoptions=jql
set mouse=a
set guicursor+=a:blinkon1
set nomodeline
set nospell
set foldmethod=indent
set foldlevel=1
set foldlevelstart=99
" set foldclose=all
packadd termdebug
" let g:termdebugger="arm-none-eabi-gdb"
let g:termdebugger="gdb"
" detect os and set shell accordingly
let _os = system('if [[ $OSTYPE == "linux-gnu"* ]]; then echo "linux"; else echo "macos"; fi')
if _os == "linux"
set shell=/bin/zsh
set g:sh=/bin/zsh
elseif _os == "macos"
set shell=/usr/bin/zsh
set g:sh=/usr/bin/zsh
endif
" Use a blinking upright bar cursor in Insert mode, a blinking block in normal
if &term == 'xterm-256color' || &term == 'screen-256color'
let &t_SI = "\<Esc>[5 q"
let &t_EI = "\<Esc>[1 q"
endif
" Terminal Function
let g:term_buf = 0
let g:term_win = 0
function! TermToggle(height)
if win_gotoid(g:term_win)
" hide
bd!
else
botright new
exec "resize" . a:height
" botright vs new
" vertical resize 55
try
exec "buffer " . g:term_buf
catch
call termopen($SHELL)
" let g:term_buf = bufnr("")
set nonumber
" set norelativenumber
" set signcolumn=no
endtry
startinsert!
let g:term_win = win_getid()
endif
endfunction
" close buffer wihtout closing pane
" Delete buffer while keeping window layout (don't close buffer's windows).
" Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165
if v:version < 700 || exists('loaded_bclose') || &cp
finish
endif
let loaded_bclose = 1
if !exists('bclose_multiple')
let bclose_multiple = 1
endif
" Display an error message.
function! s:Warn(msg)
echohl ErrorMsg
echomsg a:msg
echohl NONE
endfunction
" Command ':Bclose' executes ':bd' to delete buffer in current window.
" The window will show the alternate buffer (Ctrl-^) if it exists,
" or the previous buffer (:bp), or a blank buffer if no previous.
" Command ':Bclose!' is the same, but executes ':bd!' (discard changes).
" An optional argument can specify which buffer to close (name or number).
function! s:Bclose(bang, buffer)
if empty(a:buffer)
let btarget = bufnr('%')
elseif a:buffer =~ '^\d\+$'
let btarget = bufnr(str2nr(a:buffer))
else
let btarget = bufnr(a:buffer)
endif
if btarget < 0
call s:Warn('No matching buffer for '.a:buffer)
return
endif
if empty(a:bang) && getbufvar(btarget, '&modified')
call s:Warn('No write since last change for buffer '.btarget.' (use :Bclose!)')
return
endif
" Numbers of windows that view target buffer which we will delete.
let wnums = filter(range(1, winnr('$')), 'winbufnr(v:val) == btarget')
if !g:bclose_multiple && len(wnums) > 1
call s:Warn('Buffer is in multiple windows (use ":let bclose_multiple=1")')
return
endif
let wcurrent = winnr()
for w in wnums
execute w.'wincmd w'
let prevbuf = bufnr('#')
if prevbuf > 0 && buflisted(prevbuf) && prevbuf != btarget
buffer #
else
BufferLineCycleNext
endif
if btarget == bufnr('%')
" Numbers of listed buffers which are not the target to be deleted.
let blisted = filter(range(1, bufnr('$')), 'buflisted(v:val) && v:val != btarget')
" Listed, not target, and not displayed.
let bhidden = filter(copy(blisted), 'bufwinnr(v:val) < 0')
" Take the first buffer, if any (could be more intelligent).
let bjump = (bhidden + blisted + [-1])[0]
if bjump > 0
execute 'buffer '.bjump
else
execute 'enew'.a:bang
endif
endif
endfor
execute 'bdelete'.a:bang.' '.btarget
execute wcurrent.'wincmd w'
endfunction
command! -bang -complete=buffer -nargs=? Bclose call <SID>Bclose(<q-bang>, <q-args>)
nnoremap <silent> <Leader>bd :Bclose<CR>
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" PLUGINS
set nocompatible
call plug#begin("~/.vim/plugged")
Plug 'RyanJMah/Ryan-VIM-Theme' " color scheme
Plug 'nvim-tree/nvim-tree.lua' " file explorer
Plug 'nvim-tree/nvim-web-devicons'
Plug 'akinsho/bufferline.nvim' " Buffer 'tabs'
Plug 'vim-airline/vim-airline' " statusline
Plug 'vim-airline/vim-airline-themes' " statusline themes
Plug 'airblade/vim-gitgutter' " git diff
Plug 'tpope/vim-fugitive' " git branch for airline
Plug 'zivyangll/git-blame.vim' " blame
Plug 'RaafatTurki/hex.nvim' " hex editing
" Plug 'NMAC427/guess-indent.nvim' " auto detect indentation
Plug 'lukas-reineke/indent-blankline.nvim' " indent guide
Plug 'tpope/vim-commentary' " comment out lines
Plug 'karb94/neoscroll.nvim' " smooth scrolling
Plug 'norcalli/nvim-colorizer.lua' " preview hex colors
Plug 'neoclide/coc.nvim', {'branch': 'release'} " autocomplete & linting
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " syntax highlighting
" Plug 'p00f/nvim-ts-rainbow'
Plug 'mrjones2014/nvim-ts-rainbow'
Plug 'windwp/nvim-autopairs'
Plug 'nvim-treesitter/playground'
Plug 'nvim-telescope/telescope.nvim' " fuzzy file searching
Plug 'nvim-lua/plenary.nvim'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npm install' }
Plug 'simeji/winresizer' " pane resizing
Plug 'andweeb/presence.nvim'
" Plug 'vimsence/vimsence'
Plug 'vim-scripts/AnsiEsc.vim' " ansi color codes for log files
Plug 'github/copilot.vim', {'branch': 'release'}
call plug#end()
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" KEYMAPINGS
" SCROLLING
lua << EOF
require("neoscroll").setup({
mappings = {'<C-u>', '<C-d>'}
})
local t = {}
t['<C-u>'] = {"scroll", {"-0.275", "false", "55"}}
t['<C-d>'] = {"scroll", {"0.275", "false", "55"}}
require("neoscroll.config").set_mappings(t)
EOF
" Ctrl+S to save
noremap <silent> <C-S> :w<CR>
vnoremap <silent> <C-S> <C-C>:w<CR>
inoremap <silent> <C-S> <C-O>:w<CR>
" Ctrl+Z to undo
nnoremap <C-Z> u
inoremap <C-Z> <Esc>ui
" Ctrl+Y to redo
nnoremap <C-Y> <C-R>
inoremap <C-Y> <Esc><C-R>i
" Alt + Arrows to skip words
nnoremap <A-Left> b
nnoremap <C-Left> b
nnoremap <C-h> b
vnoremap <C-h> b
nnoremap <A-Right> e
nnoremap <C-Right> e
nnoremap <C-l> e
vnoremap <C-l> e
" buffer navigation
nnoremap <silent> bn :BufferLineCycleNext<CR>
nnoremap <silent> bp :BufferLineCyclePrev<CR>
nnoremap <silent> bd :Bclose<CR>
" nnoremap <silent> bn :bn<CR>
" nnoremap <silent> bp :bp<CR>
" nnoremap <silent> bd :Bclose<CR>
" comment out line
nnoremap <silent> <C-/> :Commentary<CR>
vnoremap <silent> <C-/> :Commentary<CR>
inoremap <silent> <C-/> <C-O>:Commentary<CR>
nnoremap <silent> <C-_> :Commentary<CR>
vnoremap <silent> <C-_> :Commentary<CR>
inoremap <silent> <C-_> <C-O>:Commentary<CR>
" searching
nnoremap <C-p> :Telescope find_files hidden=true<CR>
command! Search :Telescope live_grep
" Open terminal
command! NewTerm :call termopen($SHELL)
" echo git blame
command! Blame :call gitblame#echo()
" fix the shitty rainbow plugin by toggling it
command! FixRainbow :TSToggle rainbow | :TSToggle rainbow
" Alt+t to toggle terminal
nnoremap <silent> <A-t> :call TermToggle(12)<CR>
inoremap <silent> <A-t> <Esc>:call TermToggle(12)<CR>
tnoremap <silent> <A-t> <C-\><C-n>:call TermToggle(12)<CR>
tnoremap <silent> <Esc> <C-\><C-n>
" tnoremap <C-W> <C-\><C-n><C-W>
" Unmap some stuff cus they're annoying
inoremap <C-A> <NOP>
nnoremap <F2> <NOP>
inoremap <F2> <NOP>
vnoremap <F2> <NOP>
nnoremap <F1> <NOP>
inoremap <F1> <NOP>
vnoremap <F1> <NOP>
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" COLOR SCHEME
set termguicolors
" let g:sonokai_style = 'dark'
let g:sonokai_style = 'darker'
let g:airline_theme = 'sonokai'
let g:sonokai_disable_italic_comment = 0
let g:sonokai_enable_italic = 1
colorscheme sonokai
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" TERMDEBUG SETTINGS
let g:termdebug_wide=1
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" WINDOW RESIZING
let g:winresizer_start_key = "<C-R>"
let g:winresizer_vert_resize = 4
let g:winresizer_horiz_resize = 1
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" File explorer
nmap <silent> <C-B> :silent NvimTreeToggle<CR>
let g:loaded_netrw = 1
let g:loaded_netrwPlugin = 1
lua << EOF
-- bruh this is so fucking stupid
local function on_attach(bufnr)
local api = require('nvim-tree.api')
local function opts(desc)
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
-- Default mappings. Feel free to modify or remove as you wish.
--
-- BEGIN_DEFAULT_ON_ATTACH
vim.keymap.set('n', '<C-]>', api.tree.change_root_to_node, opts('CD'))
vim.keymap.set('n', '<C-e>', api.node.open.replace_tree_buffer, opts('Open: In Place'))
vim.keymap.set('n', '<C-k>', api.node.show_info_popup, opts('Info'))
vim.keymap.set('n', '<C-r>', api.fs.rename_sub, opts('Rename: Omit Filename'))
vim.keymap.set('n', '<C-t>', api.node.open.tab, opts('Open: New Tab'))
vim.keymap.set('n', '<C-v>', api.node.open.vertical, opts('Open: Vertical Split'))
vim.keymap.set('n', '<C-x>', api.node.open.horizontal, opts('Open: Horizontal Split'))
vim.keymap.set('n', '<BS>', api.node.navigate.parent_close, opts('Close Directory'))
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
vim.keymap.set('n', '<Tab>', api.node.open.preview, opts('Open Preview'))
vim.keymap.set('n', '>', api.node.navigate.sibling.next, opts('Next Sibling'))
vim.keymap.set('n', '<', api.node.navigate.sibling.prev, opts('Previous Sibling'))
vim.keymap.set('n', '.', api.node.run.cmd, opts('Run Command'))
vim.keymap.set('n', '-', api.tree.change_root_to_parent, opts('Up'))
vim.keymap.set('n', 'a', api.fs.create, opts('Create'))
vim.keymap.set('n', 'bmv', api.marks.bulk.move, opts('Move Bookmarked'))
vim.keymap.set('n', 'B', api.tree.toggle_no_buffer_filter, opts('Toggle No Buffer'))
vim.keymap.set('n', 'c', api.fs.copy.node, opts('Copy'))
vim.keymap.set('n', 'C', api.tree.toggle_git_clean_filter, opts('Toggle Git Clean'))
vim.keymap.set('n', '[c', api.node.navigate.git.prev, opts('Prev Git'))
vim.keymap.set('n', ']c', api.node.navigate.git.next, opts('Next Git'))
vim.keymap.set('n', 'd', api.fs.remove, opts('Delete'))
vim.keymap.set('n', 'D', api.fs.trash, opts('Trash'))
vim.keymap.set('n', 'E', api.tree.expand_all, opts('Expand All'))
vim.keymap.set('n', 'e', api.fs.rename_basename, opts('Rename: Basename'))
vim.keymap.set('n', ']e', api.node.navigate.diagnostics.next, opts('Next Diagnostic'))
vim.keymap.set('n', '[e', api.node.navigate.diagnostics.prev, opts('Prev Diagnostic'))
vim.keymap.set('n', 'F', api.live_filter.clear, opts('Clean Filter'))
vim.keymap.set('n', 'f', api.live_filter.start, opts('Filter'))
vim.keymap.set('n', 'g?', api.tree.toggle_help, opts('Help'))
vim.keymap.set('n', 'gy', api.fs.copy.absolute_path, opts('Copy Absolute Path'))
vim.keymap.set('n', 'H', api.tree.toggle_hidden_filter, opts('Toggle Dotfiles'))
vim.keymap.set('n', 'I', api.tree.toggle_gitignore_filter, opts('Toggle Git Ignore'))
vim.keymap.set('n', 'J', api.node.navigate.sibling.last, opts('Last Sibling'))
vim.keymap.set('n', 'K', api.node.navigate.sibling.first, opts('First Sibling'))
vim.keymap.set('n', 'm', api.marks.toggle, opts('Toggle Bookmark'))
vim.keymap.set('n', 'o', api.node.open.edit, opts('Open'))
vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts('Open: No Window Picker'))
vim.keymap.set('n', 'p', api.fs.paste, opts('Paste'))
vim.keymap.set('n', 'P', api.node.navigate.parent, opts('Parent Directory'))
vim.keymap.set('n', 'q', api.tree.close, opts('Close'))
vim.keymap.set('n', 'r', api.fs.rename, opts('Rename'))
vim.keymap.set('n', 'R', api.tree.reload, opts('Refresh'))
vim.keymap.set('n', 's', api.node.run.system, opts('Run System'))
vim.keymap.set('n', 'S', api.tree.search_node, opts('Search'))
vim.keymap.set('n', 'U', api.tree.toggle_custom_filter, opts('Toggle Hidden'))
vim.keymap.set('n', 'W', api.tree.collapse_all, opts('Collapse'))
vim.keymap.set('n', 'x', api.fs.cut, opts('Cut'))
vim.keymap.set('n', 'y', api.fs.copy.filename, opts('Copy Name'))
vim.keymap.set('n', 'Y', api.fs.copy.relative_path, opts('Copy Relative Path'))
vim.keymap.set('n', '<2-LeftMouse>', api.node.open.edit, opts('Open'))
vim.keymap.set('n', '<2-RightMouse>', api.tree.change_root_to_node, opts('CD'))
-- END_DEFAULT_ON_ATTACH
-- Mappings removed via:
-- remove_keymaps
-- OR
-- view.mappings.list..action = ""
--
-- The dummy set before del is done for safety, in case a default mapping does not exist.
--
-- You might tidy things by removing these along with their default mapping.
vim.keymap.set('n', '<C-R>', '', { buffer = bufnr })
vim.keymap.del('n', '<C-R>', { buffer = bufnr })
end
require("nvim-tree").setup({
sort_by = "extension",
actions = {
open_file = {
quit_on_open = true
}
},
on_attach = on_attach,
git = {
ignore = false,
},
filters = {
custom = {".DS_Store"}
},
view = {
preserve_window_proportions = true
},
diagnostics = {
enable = false
}
})
require'nvim-web-devicons'.setup {}
local git_icon = ""
local git_color = "#f1502f"
local md_icon = ""
local md_color = "#F09F17"
require("nvim-web-devicons").set_icon {
gitattributes = {
icon = git_icon,
color = git_color,
name = "GitAttributes"
},
gitignore = {
icon = git_icon,
color = git_color,
name = "GitIgnore"
},
gitmodules = {
icon = git_icon,
color = git_color,
name = "GitModules"
},
markdown = {
icon = md_icon,
color = md_color,
name = "Markdown"
},
md = {
icon = md_icon,
color = md_color,
name = "Md"
},
txt = {
icon = "",
color = "#519aba",
name = "Txt"
}
}
EOF
autocmd Filetype NvimTree setlocal sw=2
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" gitgutter
let g:gitgutter_sign_added = '│'
let g:gitgutter_sign_modified = '│'
let g:gitgutter_sign_removed = ''
let g:gitgutter_sign_removed_first_line = '-'
let g:gitgutter_sign_removed_above_and_below = '-'
let g:gitgutter_sign_modified_removed = '~'
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" Buffer tabs
lua << EOF
local configuration = vim.fn['sonokai#get_configuration']()
local p = vim.fn['sonokai#get_palette'](configuration.style, configuration.colors_override)
-- lua arrays start a 1 for some reaason
fg = p.fg[1]
bg0 = p.bg0[1]
bg3 = p.bg3[1]
bg_red = p.bg_red[1]
darker_bg = p.darker_bg[1]
bg_green = p.bg_green[1]
local bufferline = require("bufferline")
bufferline.setup{
options = {
separator_style = "thin",
-- enfore_regular_tabs = false,
truncate_names = false,
-- tab_size = 15
},
highlights = {
fill = {
fg = fg,
bg = darker_bg
},
buffer_selected = {
italic = false,
bold = false,
bg = bg0,
fg = fg
}
-- buffer_selected = {
-- fg = bg_red,
-- bg = bg0
-- }
}
}
EOF
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" STATUSLINE
" let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#alt_sep = 0
let g:airline#extensions#tabline#right_sep = ''
let g:airline#extensions#tabline#right_alt_sep = ''
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#hunks#enabled = 0
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_symbols.crypt = '🔒'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.spell = 'Ꞩ'
let g:airline_symbols.notexists = 'Ɇ'
let g:airline_symbols.whitespace = 'Ξ'" let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
" let g:airline_left_sep = ''
" let g:airline_left_alt_sep = ''
" let g:airline_right_sep = ''
" let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
" let g:airline_symbols.colnr = ' :'
" let g:airline_symbols.linenr = ' :'
let g:airline_symbols.colnr = 'CN:'
let g:airline_symbols.linenr = ' LN:'
let g:airline_symbols.maxlinenr = ' '
let g:airline_symbols.dirty=''
let g:airline#extensions#tabline#ignore_bufadd_pat = 'defx|gundo|nerd_tree|startify|tagbar|undotree|vimfiler'
let g:airline_filetype_overrides = {
\ 'NvimTree': [ "NvimTree", '' ]
\ }
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" Github Copilot
" imap <silent><script><expr> <C-j> copilot#Accept("\<CR>")
" let g:copilot_no_tab_map = v:true
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" Treesitter
lua << EOF
require("nvim-autopairs").setup {}
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = {
"vim",
"lua",
"c",
"cpp",
"make",
"cmake",
"devicetree",
"python",
"matlab",
"dockerfile",
"json",
"jsonc",
"verilog",
"gitcommit",
"gitignore"
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
highlight = {
-- `false` will disable the whole extension
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
disable = {},
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = true,
},
rainbow = {
enable = true,
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
colors = {
"#feb868",
"#cd64ce",
"#85c7f2"
} -- table of hex strings
}
}
EOF
hi rainbowcol1 guifg=#feb868
hi rainbowcol2 guifg=#cd64ce
hi rainbowcol3 guifg=#85c7f2
hi rainbowcol4 guifg=#feb868
hi rainbowcol5 guifg=#cd64ce
hi rainbowcol6 guifg=#85c7f2
hi rainbowcol7 guifg=#feb868
hi rainbowcol8 guifg=#cd64ce
hi rainbowcol9 guifg=#85c7f2
""-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" indent blankline
lua <<EOF
require("ibl").setup()
require("ibl").config = {
buftype_exclude = {"terminal", "NvimTree"},
show_first_indent_level = true,
show_current_context = true,
show_current_context_start = false,
-- use_treesitter = true,
char = '│',
context_char = '▎',
}
EOF
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" Commentary
autocmd Filetype c setlocal commentstring=//\ %s
autocmd Filetype cpp setlocal commentstring=//\ %s
autocmd Filetype verilog setlocal commentstring=//\ %s
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" More color stuff
lua << EOF
local configuration = vim.fn['sonokai#get_configuration']()
local p = vim.fn['sonokai#get_palette'](configuration.style, configuration.colors_override)
local apply_hl = vim.fn["sonokai#highlight"]
apply_hl("TelescopeBorder", p.darker_bg, p.darker_bg)
apply_hl("TelescopePromptBorder", p.bg1, p.bg1)
apply_hl("TelescopePromptCounter", p.grey, p.bg1)
apply_hl("TelescopePromptNormal", p.fg, p.bg1)
apply_hl("TelescopePromptPrefix", p.bg_red, p.bg1)
apply_hl("TelescopeNormal", p.none, p.darker_bg)
apply_hl("TelescopePreviewTitle", p.bg0, p.bg_green)
apply_hl("TelescopePromptTitle", p.bg0, p.bg_red)
apply_hl("TelescopeResultsTitle", p.darker_bg, p.darker_bg)
apply_hl("TelescopeSelection", p.fg, p.bg1)
apply_hl("TelescopeResultsDiffAdd", p.bg_green, p.none)
apply_hl("TelescopeResultsDiffChange", p.yellow, p.none)
apply_hl("TelescopeResultsDiffDelete", p.bg_red, p.none)
local options = {
defaults = {
prompt_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
},
},
extensions_list = { "themes", "terms" },
}
require("telescope").setup(options)
EOF
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" guess indent
"lua << EOF
"require("guess-indent").setup {
" filetype_exclude = {
" "nerdtree",
" },
"}
"EOF
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" hex color preview
lua << EOF
require("colorizer").setup()
EOF
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" hex editor
lua << EOF
require 'hex'.setup()
EOF
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" lmao
" let g:vimsence_small_text = 'NeoVim'
" let g:vimsence_small_image = 'neovim'
let g:presence_auto_update = 1
" let g:presence_log_level = 'debug'
let g:presence_blacklist = []
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" markdown preview
" set default theme (dark or light)
" By default the theme is define according to the preferences of the system
let g:mkdp_theme = 'dark'
"-----------------------------------------------------------------------------------
"-----------------------------------------------------------------------------------
" autocomplete settings
" TextEdit might fail if hidden is not set.
set hidden
" Give more space for displaying messages.
" set cmdheight=2
set cmdheight=1
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
" if has("nvim-0.5.0") || has("patch-8.1.1564")
" " Recently vim can merge signcolumn and number column into one
" set signcolumn=number
" else
" set signcolumn=yes
" endif
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
" use <CR> to trigger completion
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Insert <tab> when previous text is space, refresh completion if not.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1):
\ <SID>check_back_space() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" GoTo code navigation.
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)
nmap <silent> gb <C-o>
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
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
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocActionAsync('format')
" Add `:Fold` command to fold current buffer.
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" Add `:OR` command for organize imports of the current buffer.
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
" Add (Neo)Vim's native statusline support.
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline.
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
let g:coc_global_extensions = [
\ "coc-json",
\ "coc-clangd",
\ "coc-python",
\ "coc-sh",
\ "coc-cmake"
\]
"-----------------------------------------------------------------------------------
autocmd BufWinEnter,BufNewFile,BufRead,VimEnter,FileType,OptionSet * set formatoptions=jql
autocmd BufWinEnter,BufNewFile,BufRead,VimEnter,FileType,OptionSet * setlocal formatoptions=jql
" autocmd BufReadPost,OptionSet * silent :GuessIndent
autocmd BufRead,BufNewFile project/*.c setlocal formatoptions-=cro
autocmd FileType markdown set spell
autocmd VimLeave,VimLeavePre * :set guicursor=n:ver100-iCursor
autocmd FileChangedRO * echohl WarningMsg | echo "File changed RO." | echohl None
autocmd FileChangedShell * echohl WarningMsg | echo "File changed shell." | echohl None
autocmd BufWinEnter,WinEnter term://* startinsert
autocmd TermOpen * setlocal nonumber norelativenumber
autocmd TermOpen * if bufwinnr('') > 0 | setlocal nobuflisted | endif
autocmd TermClose * setlocal number | :Bclose!
" autocmd BufLeave term://* stopinsert
autocmd BufWritePost * :FixRainbow