-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.vimrc
1993 lines (1740 loc) · 59.9 KB
/
.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
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Usage:
" 1. Create necessary folders and files.
" $VIMDATA x:\vim\vimdata on windows, ~/.vim/vimdata on linux
" |-- temp dir to put swap files when :set swapfile
" |-- backup dir to put backup files when :set backup
" |-- diary dir to store calendar.vim's diaries
" |-- GetLatest dir to store getscript.vim's downloads
" | `-- GetLatestVimScripts.dat
" |-- _vim_fav_files file to store favmenu.vim's items
" `-- _vim_mru_files file to store mru.vim's items
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General: {{{1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " use vim as vim, put at the very start
map Q gq
" do not use Ex-mode, use Q for formatting
set history=400 " lines of Ex commands, search history ...
set browsedir=buffer " use the directory of the related buffer
" set clipboard+=unnamed " use register '*' for all y, d, c, p ops
set isk+=$,%,# " none of these should be word dividers
set autoread " auto read when a file is changed outside
set confirm " raise a confirm dialog for changed buffer
set fenc=utf-8 " character encoding for file of the buffer
set fencs=ucs-bom,utf-8,gb18030,gbk,gb2312,cp936
set timeoutlen=200 " Time to wait after ESC (default causes an annoying delay)
filetype plugin indent on " enable filetype plugin
if $TERM != "linux" && $TERM != "screen" && $TERM != "rxvt-unicode"
set mouse=a " except screen & SecureCRT's linux terminal
endif
let mapleader = " " " set mapleader, then <leader> will be ,
let g:mapleader = " "
let maplocalleader = "," " set mapleader, then <leader> will be ,
" fast saving
"nmap <leader>w :w!<cr>
nmap <F1> :w!<cr>
imap <F1> <C-O>:w!<cr>
nmap <silent> <leader>fs :w<cr>
map <silent> <leader>s :w!<cr>
"nmap <leader>f :find<cr>
if has("win32") " platform dependent
let $VIMDATA = $HOME.'\vimdata'
let $VIMFILES = $HOME.'\vimfiles'
else
let $VIMDATA = $HOME.'/.vim/vimdata'
let $VIMFILES = $HOME.'/.vim'
" let $SPELLFILE = $VIMDATA.'/spellfile.txt'
endif
" fast sourcing and editing of the .vimrc
"map <leader>s :source $MYVIMRC<cr>
map <leader>e :e! $MYVIMRC<cr>
map <silent> <leader>fed :e $MYVIMRC<cr>
au! BufWritePost [\._]vimrc source $MYVIMRC
au! BufWritePost init.vim source $MYVIMRC
" set spellfile+=$SPELLFILE
set pastetoggle=<F6> " when pasting something in, don't indent
set rtp+=$VIMDATA " add this to rtp to satisfy getscript.vim
set path=.,/usr/include/*, " where gf, ^Wf, :find will search
set tags=./tags,tags,.tmtags " used by CTRL-] together with ctags
set makeef=error.err " the errorfile for :make and :grep
set ffs=unix,dos,mac " behaves good under both linux/windows
nmap <leader>fd :se ff=dos<cr>
nmap <leader>fu :se ff=unix<cr>
" }}}1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text Options: {{{1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set expandtab
set shiftwidth=2
set tabstop=2
set numberwidth=4
" set smarttab " use tabs at start of a line, spaces elsewhere
set fo=tcrqnmM " see help formatoptions (complex)
set linebreak " wrap long lines at a character in 'breakat'
set textwidth=500 " maximum width of text that is being inserted
" set ts=2 sts=2 sw=2
au FileType mail setl textwidth=72 fo=awq comments+=nb:>
au FileType mail match ErrorMsg '\s\+$'
" set ai " autoindent
set si " smartindent
" set copyindent
set wrap " wrap lines
"noremap <leader>; :make<CR>
" Map ; to "add ; to the end of the line, when missing"
noremap <leader>; :s/\([^;]\)$/\1;/<cr>:let @/=""<cr><esc>
" }}}1
" let g:python_host_skip_check = 1
" let g:python3_host_skip_check = 1
" let g:python_host_prog = '~/.asdf/shims/python'
" let g:python3_host_prog = '~/.asdf/shims/python3'
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
let g:EditorConfig_exclude_patterns = ['fugitive://.\*', 'scp://.\*']
" \ 'python': [
" \ 'remove_trailing_lines',
" \ 'trim_whitespace',
" \ 'autopep8',
" \ 'black',
" \ 'isort',
" \ 'add_blank_lines_for_python_control_statements',
" \ ],
let g:ale_fixers = {
\ 'python': [
\ 'remove_trailing_lines',
\ 'trim_whitespace',
\ 'autopep8',
\ 'black',
\ 'isort',
\ 'add_blank_lines_for_python_control_statements',
\ ],
\ 'go': [
\ 'remove_trailing_lines',
\ 'trim_whitespace',
\ 'gofmt',
\ 'goimports',
\ ],
\ 'json': [
\ 'prettier',
\ ],
\ 'cpp': [
\ 'clang-format',
\ ],
\ 'c': [
\ 'clang-format',
\ ],
\ 'terraform': [
\ 'terraform',
\ ],
\ 'hcl': [
\ 'terraform',
\ ],
\ 'typescript': [
\ 'tslint',
\ 'prettier',
\ ],
\ 'yaml': [
\ 'prettier',
\ ],
\}
" let g:ale_python_pylint_use_global = 1
" let g:ale_python_pyls_use_global = 1
" let g:ale_python_reorder_python_imports_use_global = 1
" let g:ale_python_autopep8_use_global = 1
let g:ycm_semantic_triggers = { 'python' : [] }
let g:ale_linters = {
\ 'cpp': [
\ ],
\ 'c': [
\ ],
\ 'python': [
\ ],
\ }
" let g:ale_python_auto_pipenv=1
let g:ale_yaml_yamllint_options = "-d relaxed"
let g:ale_yaml_yamllint_options = "-c ~/.config/yamllint.yml"
" let g:ale_python_auto_pipenv = 1
" let pipenv_venv_path = system('pipenv --venv')
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 0
let test#strategy = "vimterminal"
" let test#strategy = "asyncrun"
let g:nv_search_paths = ['~/org']
let g:typescript_indent_disable = 1
nmap <silent> t<C-n> :TestNearest<CR>
nmap <silent> t<C-f> :TestFile<CR>
nmap <silent> t<C-s> :TestSuite<CR>
nmap <silent> t<C-l> :TestLast<CR>
nmap <silent> t<C-g> :TestVisit<CR> fs
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugins: {{{1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.vim/plugged')
" Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
Plug 'dhruvasagar/vim-table-mode'
Plug 'peterhoeg/vim-qml'
Plug 'scrooloose/nerdtree'
Plug 'andymass/vim-matchup'
Plug 'jmcantrell/vim-virtualenv'
Plug 'voldikss/vim-floaterm'
Plug 'tpope/vim-obsession'
Plug 'christoomey/vim-tmux-navigator'
Plug 'roxma/vim-tmux-clipboard'
Plug 'tmux-plugins/vim-tmux-focus-events'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-speeddating'
Plug 'tpope/vim-surround'
Plug 'idanarye/vim-merginal'
Plug 'skywind3000/asyncrun.vim'
Plug 'tpope/vim-dispatch'
Plug 'vim-scripts/LargeFile'
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
" Plug 'ludovicchabant/vim-gutentags'
" let g:gutentags_enabled = 0
" Navigation
Plug 'tpope/vim-vinegar'
Plug 'majutsushi/tagbar'
Plug 'junegunn/vim-easy-align'
" Version control
Plug 'akinsho/git-conflict.nvim'
" Languages
" Plug 'leafgarland/typescript-vim'
" Plug 'pangloss/vim-javascript'
" Plug 'cespare/vim-toml'
" Plug 'vim-scripts/JavaDecompiler.vim'
" Plug 'rhysd/vim-clang-format'
" Plug 'udalov/kotlin-vim'
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-rails'
Plug 'hashivim/vim-terraform'
" Plug 'elzr/vim-json'
" Plug 'towolf/vim-helm'
" Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
" Plug 'rust-lang/rust.vim'
"
" Themes
Plug 'folke/tokyonight.nvim'
Plug 'reedes/vim-colors-pencil'
Plug 'chriskempson/base16-vim'
Plug 'morhetz/gruvbox'
Plug 'joshdick/onedark.vim'
" Plug 'Exafunction/codeium.vim'
let g:codeium_no_map_tab = 0
" imap <script><silent><nowait><expr> <C-g> codeium#Accept()
let g:codeium_filetypes = {
\ '*': v:false,
\ "bash": v:false,
\ "typescript": v:true,
\ "rust": v:true,
\ }
let g:copilot_filetypes = {
\ '*': v:false,
\ 'rust': v:true,
\ }
let g:codeium_enabled = v:false
" imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
if has('nvim')
" Plug 'github/copilot.vim'
Plug 'lambdalisue/suda.vim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
" Plug 'ggandor/leap.nvim'
Plug 'numToStr/Comment.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' }
Plug 'Shatur/neovim-tasks'
" Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
Plug 'smartpde/telescope-recent-files'
Plug 'kkharji/sqlite.lua'
" Plug 'nvim-telescope/telescope-frecency.nvim'
Plug 'ahmedkhalf/project.nvim'
" Plug 'Shatur/neovim-session-manager'
Plug 'tversteeg/registers.nvim', { 'branch': 'main' }
Plug 'akinsho/toggleterm.nvim'
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'ryanoasis/vim-devicons' " vimscript
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/popup.nvim'
" Plug 'kyazdani42/nvim-tree.lua'
Plug 'nvim-orgmode/orgmode'
Plug 'akinsho/org-bullets.nvim'
Plug 'mhartington/formatter.nvim'
Plug 'mfussenegger/nvim-dap'
Plug 'rcarriga/nvim-dap-ui'
Plug 'theHamsta/nvim-dap-virtual-text'
"Plug 'quangnguyen30192/cmp-nvim-ultisnips'
" function! UpdateRemotePlugins(...)
" " Needed to refresh runtime files
" let &rtp=&rtp
" UpdateRemotePlugins
" endfunction
" Plug 'gelguy/wilder.nvim', { 'do': function('UpdateRemotePlugins') }
Plug 'JoosepAlviste/nvim-ts-context-commentstring'
" Autocompletion
Plug 'onsails/lspkind.nvim'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'saadparwaiz1/cmp_luasnip'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lua'
Plug 'zbirenbaum/copilot.lua'
Plug 'zbirenbaum/copilot-cmp'
Plug 'folke/trouble.nvim'
" Snippets
Plug 'L3MON4D3/LuaSnip'
Plug 'rafamadriz/friendly-snippets'
" LSP Support
Plug 'VonHeikemen/lsp-zero.nvim'
Plug 'tamago324/nlsp-settings.nvim'
Plug 'windwp/nvim-autopairs',
Plug 'neovim/nvim-lspconfig'
" Plug 'williamboman/mason.nvim'
" Plug 'williamboman/mason-lspconfig.nvim'
" Plug 'junnplus/lsp-setup.nvim'
" Plug 'jose-elias-alvarez/null-ls.nvim'
" Plug 'jay-babu/mason-null-ls.nvim'
Plug 'folke/neodev.nvim'
Plug 'antoinemadec/FixCursorHold.nvim'
Plug 'klen/nvim-test'
Plug 'TimUntersberger/neogit'
Plug 'lewis6991/gitsigns.nvim'
Plug 'pbogut/fzf-mru.vim'
" Plug 'konapun/vacuumline.nvim'
" Plug 'glepnir/galaxyline.nvim'
" Plug 'nvim-neotest/neotest'
" Plug 'nvim-neotest/neotest-python'
" Plug 'nvim-neotest/neotest-plenary'
" Plug 'nvim-neotest/neotest-vim-test'
" set
autocmd TermEnter term://*toggleterm#*
\ tnoremap <silent><c-t> <Cmd>exe v:count1 . "ToggleTerm"<CR>
" By applying the mappings this way you can pass a count to your
" mapping to open a specific window.
" For example: 2<C-t> will open terminal 2
nnoremap <silent><c-t> <Cmd>exe v:count1 . "ToggleTerm"<CR>
inoremap <silent><c-t> <Esc><Cmd>exe v:count1 . "ToggleTerm"<CR>
else
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-commentary'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
Plug 'jceb/vim-orgmode'
" Plug 'gelguy/wilder.nvim'
" To use Python remote plugin features in Vim, can be skipped
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
"Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'vim-test/vim-test'
Plug 'Alok/notational-fzf-vim'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'pbogut/fzf-mru.vim'
Plug 'airblade/vim-gitgutter'
let g:gitgutter_enabled = 0
endif
Plug 'dense-analysis/ale'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Plug 'prabirshrestha/async.vim'
" Plug 'prabirshrestha/vim-lsp'
" let g:deoplete#enable_at_startup = 1
" Plug 'Shougo/echodoc.vim'
" For conceal markers.
" Plug 'itchyny/lightline.vim'
" Initialize plugin system
" Plug 'editorconfig/editorconfig-vim'
" Plug 'plytophogy/vim-virtualenv'
call plug#end()
if has('nvim')
let test#strategy = "neovim"
else
let test#strategy = "vimterminal"
endif
" call wilder#set_option('pipeline', [
" \ wilder#branch(
" \ wilder#cmdline_pipeline({
" \ 'language': 'python',
" \ 'fuzzy': 1,
" \ }),
" \ wilder#python_search_pipeline({
" \ 'pattern': wilder#python_fuzzy_pattern(),
" \ 'sorter': wilder#python_difflib_sorter(),
" \ 'engine': 're',
" \ }),
" \ ),
" \ ])
if has('nvim')
" set completeopt=menu,menuone,noselect
let g:airline#extensions#nvimlsp#enabled = 1
let g:airline#extensions#nvimlsp#error_symbol = 'E:'
let g:airline#extensions#nvimlsp#warning_symbol = 'W:'
let g:airline#extensions#nvimlsp#show_line_numbers = 1
let g:airline#extensions#nvimlsp#open_lnum_symbol = '(L'
let g:airline#extensions#nvimlsp#close_lnum_symbol = ')'
" let g:airline_section_y = '{…}%3{codeium#GetStatusString()}'
lua <<EOF
-- require('vacuumline').setup()
-- require('mason').setup()
require('gitsigns').setup()
require('neogit').setup {}
require('sqlite')
require('telescope').setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
}
}
}
local npairs = require "nvim-autopairs"
npairs.setup {
check_ts = true,
}
npairs.add_rules(require "nvim-autopairs.rules.endwise-lua")
require('telescope').load_extension('fzf')
-- require("telescope").load_extension("frecency")
require('telescope').load_extension('projects')
require("telescope").load_extension("recent_files")
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require('orgmode').setup_ts_grammar()
require'nvim-treesitter.configs'.setup {
on_config_done = nil,
-- A list of parser names, or "all"
ensure_installed = { "comment", "markdown_inline", "regex" },
-- List of parsers to ignore installing (for "all")
ignore_install = {},
-- A directory to install the parsers into.
-- By default parsers are installed to either the package dir, or the "site" dir.
-- If a custom path is used (not nil) it must be added to the runtimepath.
parser_install_dir = nil,
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
auto_install = true,
matchup = {
enable = false, -- mandatory, false will disable the whole extension
-- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
},
highlight = {
enable = true, -- false will disable the whole extension
additional_vim_regex_highlighting = false,
disable = function(lang, buf)
if vim.tbl_contains({ "latex" }, lang) then
return true
end
local status_ok, big_file_detected = pcall(vim.api.nvim_buf_get_var, buf, "bigfile_disable_treesitter")
return status_ok and big_file_detected
end,
},
indent = { enable = true, disable = { "yaml", "python", "ruby" } },
autotag = { enable = false },
textobjects = {
swap = {
enable = false,
-- swap_next = textobj_swap_keymaps,
},
-- move = textobj_move_keymaps,
select = {
enable = false,
-- keymaps = textobj_sel_keymaps,
},
},
textsubjects = {
enable = false,
keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
},
playground = {
enable = false,
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false, -- Whether the query persists across vim sessions
keybindings = {
toggle_query_editor = "o",
toggle_hl_groups = "i",
toggle_injected_languages = "t",
toggle_anonymous_nodes = "a",
toggle_language_display = "I",
focus_language = "f",
unfocus_language = "F",
update = "R",
goto_node = "<cr>",
show_help = "?",
},
},
rainbow = {
enable = false,
extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
},
}
-- require'nvim-treesitter.configs'.setup {
-- on_config_done = nil,
-- ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages
-- ignore_install = {},
-- matchup = {
-- enable = false, -- mandatory, false will disable the whole extension
-- -- disable = { "c", "ruby" }, -- optional, list of language that will be disabled
-- },
-- highlight = {
-- enable = true, -- false will disable the whole extension
-- additional_vim_regex_highlighting = {'org', 'markdown'}, -- Required for spellcheck, some LaTex highlights and code block highlights that do not have ts grammar
-- disable = { "latex" },
-- },
-- indent = {
-- enable = true,
-- disable = { "yaml", "python" }
-- },
-- autotag = { enable = false },
-- textobjects = {
-- swap = {
-- enable = false,
-- -- swap_next = textobj_swap_keymaps,
-- },
-- -- move = textobj_move_keymaps,
-- select = {
-- enable = false,
-- -- keymaps = textobj_sel_keymaps,
-- },
-- },
-- textsubjects = {
-- enable = false,
-- keymaps = { ["."] = "textsubjects-smart", [";"] = "textsubjects-big" },
-- },
-- playground = {
-- enable = false,
-- disable = {},
-- updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
-- persist_queries = false, -- Whether the query persists across vim sessions
-- keybindings = {
-- toggle_query_editor = "o",
-- toggle_hl_groups = "i",
-- toggle_injected_languages = "t",
-- toggle_anonymous_nodes = "a",
-- toggle_language_display = "I",
-- focus_language = "f",
-- unfocus_language = "F",
-- update = "R",
-- goto_node = "<cr>",
-- show_help = "?",
-- },
-- },
-- rainbow = {
-- enable = false,
-- extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean
-- max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
-- },
-- }
-- context_commentstring = {
-- enable = true,
-- enable_autocmd = false,
-- config = {
-- -- Languages that have a single comment style
-- typescript = "// %s",
-- css = "/* %s */",
-- scss = "/* %s */",
-- html = "<!-- %s -->",
-- svelte = "<!-- %s -->",
-- vue = "<!-- %s -->",
-- json = "",
-- },
-- },
require('ts_context_commentstring').setup ()
-- enable = true,
-- enable_autocmd = false,
-- config = {
-- -- Languages that have a single comment style
-- typescript = "// %s",
-- css = "/* %s */",
-- scss = "/* %s */",
-- html = "<!-- %s -->",
-- svelte = "<!-- %s -->",
-- vue = "<!-- %s -->",
-- json = "",
-- },
-- require('nvim-test').setup {
-- term = "toggleterm", -- a terminal to run ("terminal"|"toggleterm")
-- termOpts = {
-- direction = "float", -- terminal's direction ("horizontal"|"vertical"|"float")
-- width = float, -- terminal's width (for vertical|float)
-- height = float, -- terminal's height (for horizontal|float)
-- go_back = false, -- return focus to original window after executing
-- stopinsert = "auto", -- exit from insert mode (true|false|"auto")
-- keep_one = true, -- keep only one terminal for testing
-- },
-- }
require('orgmode').setup({
org_agenda_files = {'~/Dropbox/org/*', '~/my-orgs/**/*'},
org_default_notes_file = '~/Dropbox/org/refile.org',
})
require('Comment').setup()
local lspkind = require("lspkind")
require('copilot').setup({
suggestion = {enabled = false},
panel = {enabled = false},
filetypes = {
javascript = true, -- allow specific filetype
typescript = true, -- allow specific filetype
-- rust = true, -- allow specific filetype
-- vim = true, -- allow specific filetype
["*"] = false, -- disable for all other filetypes and ignore default `filetypes`
},
})
local cmp = require'cmp'
cmp.setup({
formatting = {
fields = {'abbr', 'kind', 'menu'},
format = lspkind.cmp_format({
mode = "symbol",
max_width = 50,
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
symbol_map = { Copilot = "" }
})
},
-- view = 'native', -- or 'custom' or 'wildmenu'
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
-- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
['<CR>'] = cmp.mapping.confirm({
-- documentation says this is important.
-- I don't know why.
behavior = cmp.ConfirmBehavior.Replace,
select = false,
})
}),
sorting = {
priority_weight = 2,
comparators = {
require("copilot_cmp.comparators").prioritize,
-- Below is the default comparitor list and order for nvim-cmp
cmp.config.compare.offset,
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
sources = cmp.config.sources({
-- Copilot Source
{ name = "copilot", group_index = 2 },
-- Other Sources
{ name = "nvim_lsp", group_index = 2 },
{ name = "path", group_index = 2 },
{ name = "luasnip", group_index = 2 },
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
-- cmp.setup.cmdline({ '/', '?' }, {
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = {
-- { name = 'buffer' }
-- }
-- })
--
-- -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
-- cmp.setup.cmdline(':', {
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = cmp.config.sources({
-- { name = 'path' }
-- }, {
-- { name = 'cmdline' }
-- })
-- })
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require("neodev").setup({
library = { plugins = { "nvim-dap-ui" }, types = true },
})
require("dapui").setup()
require("nvim-dap-virtual-text").setup()
local lsp = require('lsp-zero').preset({
name = 'minimal',
set_lsp_keymaps = true,
manage_nvim_cmp = true,
suggest_lsp_servers = false,
})
local lua_opts = {
settings = {
Lua = {
telemetry = { enable = false },
runtime = {
version = "LuaJIT",
special = {
reload = "require",
},
},
diagnostics = {
globals = { "vim", "lvim", "packer_plugins", "reload" },
},
workspace = default_workspace,
},
},
}
local yaml_opts = {
settings = {
yaml = {
hover = true,
completion = true,
validate = true,
schemaStore = {
enable = true,
url = "https://www.schemastore.org/api/json/catalog.json",
},
schemas = {
kubernetes = {
"daemon.{yml,yaml}",
"manager.{yml,yaml}",
"restapi.{yml,yaml}",
"role.{yml,yaml}",
"role_binding.{yml,yaml}",
"*onfigma*.{yml,yaml}",
"*ngres*.{yml,yaml}",
"*ecre*.{yml,yaml}",
"*eployment*.{yml,yaml}",
"*ervic*.{yml,yaml}",
"kubectl-edit*.yaml",
},
},
},
},
}
lsp.on_attach(function(client, bufnr)
lsp.default_keymaps({buffer = bufnr})
end)
local lspconfig = require('lspconfig')
lspconfig.pyright.setup {
before_init = function(params, config)
local Path = require "plenary.path"
local venv = Path:new((config.root_dir:gsub("/", Path.path.sep)), ".venv")
if venv:joinpath("bin"):is_dir() then
config.settings.python.pythonPath = tostring(venv:joinpath("bin", "python"))
else
config.settings.python.pythonPath = tostring(venv:joinpath("Scripts", "python.exe"))
end
end
}
lsp.setup_servers({'rust_analyzer', 'gopls', 'terraformls', 'ruff_lsp', 'ruby_ls', 'vimls', 'lua_ls'})
require('copilot_cmp').setup()
local ltexls_opts = {
settings = {
use_spellfile = true,
}
}
vim.diagnostic.config({
virtual_text = true
})
local nlspsettings = require("nlspsettings")
nlspsettings.setup({
config_home = vim.fn.stdpath('config') .. '/nlsp-settings',
local_settings_dir = ".nlsp-settings",
local_settings_root_markers_fallback = { '.git' },
append_default_schemas = true,
loader = 'json'
})
require("project_nvim").setup {
-- detection_methods = {"lsp"},
ignore_lsp = {"texlab"},
}
require("toggleterm").setup {
open_mapping = [[c\-\-]],
}
local Terminal = require('toggleterm.terminal').Terminal
local lazygit = Terminal:new({
cmd = "lazygit",
dir = "git_dir",
direction = "float",
float_opts = {
border = "double",
},
-- function to run on opening the terminal
on_open = function(term)
vim.cmd("startinsert!")
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
end,
-- function to run on closing the terminal
on_close = function(term)
vim.cmd("Closing terminal")
end,
})
local bash = Terminal:new({
cmd = "bash",
hidden = true,
dir = "git_dir",
direction = "float",
float_opts = {
border = "double",
},
})
function _bash_toggle()
bash:toggle()
end
vim.api.nvim_set_keymap("n", "<leader>c", "<cmd>lua _bash_toggle()<CR>", {noremap = true, silent = true})
local tig = Terminal:new({
cmd = "tig",
dir = "git_dir",
direction = "float",
float_opts = {
border = "double",
},
-- function to run on opening the terminal
on_open = function(term)
vim.cmd("startinsert!")
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
end,
-- function to run on closing the terminal
on_close = function(term)
vim.cmd("Closing terminal")
end,
})
function _lazygit_toggle()
lazygit:toggle()
end
function _tig_toggle()
tig:toggle()
end
vim.api.nvim_set_keymap("n", "<leader>g", "<cmd>lua _lazygit_toggle()<CR>", {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", "<leader>t", "<cmd>lua _tig_toggle()<CR>", {noremap = true, silent = true})
vim.api.nvim_set_keymap("n", "c-=", "<cmd>lua _tig_toggle()<CR>", {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '\\',
":<C-u>Tree -columns=mark:indent:git:icon:filename:size:time"..
" -split=vertical -direction=topleft -winwidth=40 -listed `expand('%:p:h')`<CR>",
{noremap=true, silent=true})
EOF
endif
command! NNN FloatermNew nnn
" }}}1
let g:pencil_higher_contrast_ui = 1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colors And Fonts: {{{1
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
syntax enable " enable syntax hl
if has("win32")
try | set gfn=Consolas:h11:cANSI | catch | endtry " Vista only
elseif has("gui_macvim")
set gfn=Monaco:h13,Consolas:h13,Inconsolata:h14,PanicSans:h12
else
" set gfn=xos4\ Terminess\ Powerline\ 11
" set gfn=Hack\ 11
set gfn=Iosevka\ SS08\ Medium\ Extended\ 11
endif
" let g:Powerline_symbols = 'fancy'
" let g:airline_powerline_fonts=1
let g:airline_powerline_fonts = 1
let g:airline_symbols_ascii = 1
" Setting the airline symbols
" if !exists('g:airline_symbols')
" let g:airline_left_sep = '⮀'
" let g:airline_right_sep = '⮂'
" let g:airline_right_alt_sep ="❮"
" let g:airline_left_alt_sep="❯"
" let g:airline_symbols = {}
" let g:airline_symbols.branch = '⭠'
" let g:airline_symbols.readonly = '⭤'
" let g:airline_symbols.linenr = '⭡'
" endif
fu! LightBackground()
set background=light
color pencil
endfu
" matchparentesis is pretty slow on big files :(
let loaded_matchparen = 1
if has("gui_running")
" prepare path
"set shell=$VIMDATA/path.sh
" the `b' puts a scrollbar at the bottom, which has no effect if wrap is set
" e sets the gui tabline
" r sets the right scrollbar
set guioptions-=Tm
set guioptions=age
set tabpagemax=30
set mousehide
set columns=90
if has("gui_gtk2")
set lines=30
set showcmd
elseif has("gui_macvim") || has("gui_mac")
set columns=190
set lines=59
else
set lines=50