-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
989 lines (919 loc) · 36 KB
/
init.vim
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
let mapleader=" "
set scrolloff=7
set number
set encoding=utf-8
set fileencoding=utf-8
set termguicolors
call plug#begin('~/.vim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/lsp_extensions.nvim'
Plug 'rafi/awesome-vim-colorschemes'
Plug 'skywind3000/asyncrun.vim'
Plug 'kyazdani42/nvim-web-devicons'
Plug 'rust-lang/rust.vim'
Plug 'mg979/vim-visual-multi'
Plug 'lervag/vimtex'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'honza/vim-snippets'
Plug 'mrjones2014/lighthaus.nvim'
Plug 'famiu/feline.nvim'
Plug 'kyazdani42/nvim-tree.lua'
Plug 'nvim-lua/plenary.nvim'
Plug 'hrsh7th/nvim-cmp'
" Plug 'hrsh7th/vim-vsnip'
Plug 'octaltree/cmp-look'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'lukas-reineke/cmp-rg'
" Plug 'hrsh7th/cmp-vsnip'
Plug 'SirVer/ultisnips'
Plug 'quangnguyen30192/cmp-nvim-ultisnips'
Plug 'rafamadriz/friendly-snippets'
Plug 'weirongxu/plantuml-previewer.vim'
Plug 'tyru/open-browser.vim'
Plug 'onsails/lspkind-nvim'
Plug 'akinsho/flutter-tools.nvim'
Plug 'junegunn/fzf.vim'
Plug 'wellle/targets.vim'
Plug 'camspiers/animate.vim'
Plug 'akinsho/nvim-bufferline.lua'
Plug 'nvim-lua/popup.nvim'
Plug 'petertriho/cmp-git'
Plug 'folke/todo-comments.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
Plug 'SmiteshP/nvim-gps'
Plug 'ggvgc/vim-fuzzysearch'
Plug 'folke/trouble.nvim'
Plug 'lazytanuki/nvim-mapper'
Plug 'mbbill/undotree'
Plug 'lewis6991/gitsigns.nvim'
Plug 'phaazon/hop.nvim'
Plug 'ShadowItaly/octo.nvim', { 'branch': 'fix_key_mappings_error' }
Plug 'terrortylor/nvim-comment'
Plug 'arecarn/vim-frisk'
Plug 'kdheepak/lazygit.nvim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-eunuch'
Plug 'lukas-reineke/indent-blankline.nvim'
Plug 'numtostr/FTerm.nvim'
Plug 't9md/vim-choosewin'
Plug 'ggandor/lightspeed.nvim'
Plug 'haringsrob/nvim_context_vt'
Plug 'liuchengxu/vista.vim'
Plug 'p00f/nvim-ts-rainbow'
Plug 'kabouzeid/nvim-lspinstall'
Plug 'vimwiki/vimwiki'
Plug 'soywod/himalaya', {'rtp': 'vim'}
Plug 'soywod/unfog.vim'
Plug 'tpope/vim-fugitive'
Plug 'vim-test/vim-test'
Plug 'rcarriga/vim-ultest', { 'do': ':UpdateRemotePlugins' }
call plug#end()
let g:vista#renderer#enable_icon = 0
let g:vimwiki_map_prefix = '<leader>v'
let g:vista_sidebar_width = 45
let g:asyncrun_open = 15
colo lighthaus_dark
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
let g:choosewin_overlay_enable = 0
let g:sneak#label = 1
let g:fuzzysearch_prompt = 'fuzzy /'
let g:fuzzysearch_hlsearch = 1
let g:fuzzysearch_ignorecase = 1
let g:fuzzysearch_max_history = 30
let g:fuzzysearch_match_spaces = 0
" let g:indentLine_char = '|'
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" show chunk diff at current position
set shell=/usr/bin/zsh
" Set completeopt to have a better completion experience
set completeopt=menuone,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
let g:himalaya_mailbox_picker = 'fzf'
let test#strategy = "asyncrun_background"
" binding.
" " `s{char}{label}`
" " Turn on case-insensitive feature
set smartcase
set ignorecase
"autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode()
lua <<EOF
require'nvim-web-devicons'.setup {}
require'FTerm'.setup{}
require("flutter-tools").setup{}
require'nvim-treesitter.configs'.setup {
rainbow = {
enable = true,
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = 1000, -- Do not enable for files with more than 1000 lines, int
}
}
require'lightspeed'.setup {
jump_to_first_match = true,
jump_on_partial_input_safety_timeout = 400,
-- This can get _really_ slow if the window has a lot of content,
-- turn it on only if your machine can always cope with it.
highlight_unique_chars = false,
grey_out_search_area = true,
match_only_the_start_of_same_char_seqs = true,
limit_ft_matches = 5,
full_inclusive_prefix_key = '<c-x>',
-- By default, the values of these will be decided at runtime,
-- based on `jump_to_first_match`.
labels = nil,
cycle_group_fwd_key = nil,
cycle_group_bwd_key = nil,
}
-- nvim_lsp object
require("indent_blankline").setup {
char = "|",
buftype_exclude = {"terminal"}
}
require('nvim_comment').setup()
local nvim_lsp = require'lspconfig'
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
-- Enable rust_analyzer
nvim_lsp.rust_analyzer.setup({
capabilities=capabilities,
})
-- Enable diagnostics
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = true,
signs = true,
update_in_insert = false,
}
)
require'lspinstall'.setup() -- important
local servers = require'lspinstall'.installed_servers()
for _, server in pairs(servers) do
require'lspconfig'[server].setup{}
end
require'nvim-tree'.setup {
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = {},
auto_close = false,
open_on_tab = false,
hijack_cursor = false,
update_cwd = false,
update_to_buf_dir = {
enable = true,
auto_open = true,
},
diagnostics = {
enable = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
filters = {
dotfiles = false,
custom = {}
},
view = {
width = 30,
height = 30,
hide_root_folder = false,
side = 'left',
auto_resize = false,
mappings = {
custom_only = false,
list = {}
}
}
}
EOF
" Completion
let $FZF_DEFAULT_COMMAND = 'rg --files '
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set noshiftround
set shortmess+=c
" Enable master mode
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
set cursorline
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" have a fixed column for the diagnostics to appear in
" this removes the jitter when warnings/errors flow in
set signcolumn=yes
set updatetime=300
" Show diagnostic popup on cursor hover
" Goto previous/next diagnostic warning/error
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
nnoremap <silent> g] <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
" Enable type inlay hints
lua << EOF
require("todo-comments").setup {
signs = true, -- show icons in the signs column
sign_priority = 8, -- sign priority
-- keywords recognized as todo comments
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
-- highlighting of the line containing the todo comment
-- * before: highlights before the keyword (typically comment characters)
-- * keyword: highlights of the keyword
-- * after: highlights after the keyword (todo text)
highlight = {
before = "", -- "fg" or "bg" or empty
keyword = "wide", -- "fg", "bg", "wide" or empty. (wide is the same as bg, but will also highlight surrounding characters)
after = "fg", -- "fg" or "bg" or empty
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern used for highlightng (vim regex)
comments_only = true, -- uses treesitter to match keywords in comments only
max_line_len = 400, -- ignore lines longer than this
exclude = {}, -- list of file types to exclude highlighting
},
-- list of named colors where we try to extract the guifg from the
-- list of hilight groups or use the hex color if hl not found as a fallback
colors = {
error = { "LspDiagnosticsDefaultError", "ErrorMsg", "#DC2626" },
warning = { "LspDiagnosticsDefaultWarning", "WarningMsg", "#FBBF24" },
info = { "LspDiagnosticsDefaultInformation", "#2563EB" },
hint = { "LspDiagnosticsDefaultHint", "#10B981" },
default = { "Identifier", "#7C3AED" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
-- regex that will be used to match keywords.
-- don't replace the (KEYWORDS) placeholder
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
}
}
EOF
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
ignore_install = {}, -- List of parsers to ignore installing
highlight = {
enable = true, -- false will disable the whole extension
disable = {}, -- list of language that will be disabled
-- 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 = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
}
EOF
" http://blog.trk.in.rs/2015/12/01/vim-tips/
" http://modal.us/blog/2013/07/27/back-to-vim-with-nerdtree-nope-netrw/
" Toggle Vexplore with Ctrl-E
function! ToggleVExplorer()
if exists("t:expl_buf_num")
let expl_win_num = bufwinnr(t:expl_buf_num)
if expl_win_num != -1
let cur_win_nr = winnr()
exec expl_win_num . 'wincmd w'
close
exec cur_win_nr . 'wincmd w'
unlet t:expl_buf_num
else
unlet t:expl_buf_num
endif
else
exec '1wincmd w'
Vexplore
let t:expl_buf_num = bufnr("%")
endif
endfunction
" Hit enter in the file browser to open the selected
" file with :vsplit to the right of the browser.
let g:netrw_browse_split = 4
let g:netrw_altv = 1
" Default to tree mode
let g:netrw_liststyle=3
" Change directory to the current buffer when opening files.
" set autochdir
" maybe is easier within netrw just press c help :netrw-c
" that's better than 'cd ../path' which change in all tabs
lua << EOF
require("trouble").setup {
icons=true,
indent_lines = false, -- add an indent guide below the fold icons
use_lsp_diagnostic_signs = true -- enabling this will use the signs defined in your lsp client
}
EOF
let bufferline = get(g:, 'bufferline', {})
let bufferline.icons = v:true
let bufferline.clickable = v:false
lua << EOF
require("nvim-mapper").setup({})
local actions = require('telescope.actions')
-- Global remapping
------------------------------
require('telescope').setup({
defaults = {
mappings = {
i = {
["<esc>"] = actions.close
}
}
}
})
require'telescope'.load_extension('mapper')
Mapper = require("nvim-mapper")
Mapper.map('i', 'jj', "<Esc>", {silent = true, noremap = true}, "Exit insert mode", "exit_insert", "Exit insert mode with another key mapping to speed up the process.")
Mapper.map('t','jj',"<C-\\><C-n>",{silent = true, noremap = true}, "Exit terminal insert mode", "exit_term_insert", "Exit the terminal insert mode with the same mapping as in the normal mode.")
Mapper.map('n','<leader>p',":GFiles<cr>",{silent = true, noremap = true}, "Find files","fuzzy_find_files","Fuzzy searching for files in the current working directory.")
Mapper.map('n','<leader>b',":Buffers<cr>",{silent = true, noremap = true}, "Open fuzzy buffer finder","fuzzy_find_buffer","Open fzf buffers")
Mapper.map('n','<leader>B',":FloatermNew broot<cr>",{silent = true, noremap = true}, "Open broot","fuzzy_find_broot","Open broot")
Mapper.map('n','<leader>w',":HopWord<cr>",{silent = true, noremap = true}, "Open hop word","hop word","Open broot")
Mapper.map('n','<leader>l',":Lines<cr>",{silent = true, noremap = true}, "Search open lines","fuzzy_find_lines","Fuzzy searching for through the lines in the buffer.")
Mapper.map('n','<leader>g',":LazyGit<cr>",{silent = false, noremap = true}, "Open the git console","git_console","Open the git console for commiting and changing things.")
Mapper.map('n','<leader>f',":Rg<cr>",{silent = true, noremap = true}, "Search strings in files", "live_grep","Matching the string in every file in the working directory.")
Mapper.map('n','<leader>h',":Telescope mapper<cr>",{silent = true, noremap = true}, "Show keymappings", "show_help","Show this keymapping help to support the user of this config file.")
Mapper.map('n','<leader>ss',":GFiles?<cr>",{silent = true, noremap = true}, "Search git diff","show_status","Show fuzzy search of the git status and shows a preview of the diff file.")
Mapper.map('n','<leader>sc',":Commits<cr>",{silent = true, noremap = true}, "Search git commits","show_commits","Fuzzy search git commits with telescope plugin.")
Mapper.map('n','<leader>sb',":Telescope git_branches<cr>",{silent = true, noremap = true}, "Search git branches", "show_branches","Fuzzy search git branches with the telescope plugin.")
Mapper.map('n','<leader>st',":Vista finder<cr>",{silent = true, noremap = true}, "Search git branches", "show_vista_finder","Fuzzy search git branches with the telescope plugin.")
Mapper.map('n','<leader>t',":TodoTrouble<cr>",{silent = true, noremap = true}, "Show project todos/notes","show_todos","Shows a nice overview of the todos and notes in the current working directory.")
Mapper.map('n','<leader>m',":BufferPick<cr>",{silent = true, noremap = true}, "Buffer picker","pick_buffer","Pick a buffer by doing selecting the buffer in the tab bar.")
Mapper.map('n','<leader>u',"<cmd>lua require\"gitsigns\".reset_hunk()<CR>",{silent = true, noremap = true}, "Undo git hunk","undo_git_hunk","Undo git hunk from file.")
Mapper.map('n','<leader>U',":Unfog<CR>",{silent = false, noremap = true}, "Open unfog","open_unfog","Opens the task management programm unfog")
Mapper.map('n','<leader>a',"<cmd>lua require\"gitsigns\".stage_hunk()<CR>",{silent = true, noremap = true}, "Stage git hunk","stage_git_hunk","Stage the current git hunk for the next commit.")
Mapper.map('v','<leader>a',"<cmd>lua require\"gitsigns\".stage_hunk({vim.fn.line(\".\"), vim.fn.line('v')})<CR>",{silent = true, noremap = true}, "Stage visual git hunk","stage_vis_git_hunk","Stage selected hunk from visual mode for the next commit.")
Mapper.map('n','<leader>x',"<cmd>lua require\"gitsigns\".blame_line(true)<CR>",{silent = true, noremap = true}, "Toggle Git line highlight","git_line_highlight","Toggle the git line highlighting.")
Mapper.map('n','<leader>n',"<cmd>lua require\"gitsigns.actions\".next_hunk()<CR>",{silent = true, noremap = true}, "Next git hunk","git_next_hunk","Jump to the next git hunk in the file.")
Mapper.map('n','<leader>N',"<cmd>lua require\"gitsigns.actions\".prev_hunk()<CR>",{silent = true, noremap = true}, "Previous git hunk","git_prev_hunk","Jump to the previous git hunk in the file.")
Mapper.map('n','<leader>d',"<cmd>lua vim.lsp.diagnostic.goto_next({enable_popup=false})<CR>",{silent = true, noremap = true}, "Next diagnostic","diag_next","Jump to the next diagnostic message.")
Mapper.map('n','<leader>D',"<cmd>lua vim.lsp.diagnostic.goto_prev({enable_popup=false})<CR>",{silent = true, noremap = true}, "Previous diagnostic","diag_prev","Jump to the previous diagnostic message.")
Mapper.map('n','<F12>',"<cmd>lua require('FTerm').toggle()<CR>",{silent = false, noremap = true}, "Toogle floatterm","toggle_floatterm","Toggle float term.")
Mapper.map('t','<F12>',"<cmd>lua require('FTerm').toggle()<CR>",{silent = false, noremap = true}, "Toogle floatterm","toggle_floatterm_term","Toggle float term.")
Mapper.map('n','<leader>1',":Trouble<CR>",{silent = true, noremap = true}, "Show diagnostics","diag_nice_show","Show the file diagnostics in a file preview.")
Mapper.map('n','<leader>v',":Vista<CR>",{silent = true, noremap = true}, "Show tagbar","diag_nice_vista","Show the file diagnostics in a file preview.")
Mapper.map('n','$',":HopWord<cr>",{silent = false, noremap = false}, "Browser search for selection","browser_search_3","Search the web for the text selected with visual mode.")
Mapper.map('n','<leader>c',":HopChar1<cr>",{silent = false, noremap = false}, "Browser search for selection","browser_search_4","Search the web for the text selected with visual mode.")
Mapper.map('n','<leader>r',":AsyncRun ",{silent = false, noremap = false}, "Async run command","async_run","Asynchronously execute the command and pipe the output to copen.")
Mapper.map('n','<leader>q',":cn<cr>",{silent = false, noremap = false}, "Next entry in quickfix","quickfix_next","Select the next quickfix entry.")
Mapper.map('n','<leader>Q',":cp<cr>",{silent = false, noremap = false}, "Previous entry in quickfix","quickfix_prev","Select the previous quickfix entry.")
Mapper.map('n','<leader>z',":FloatermNew --autoclose=2<CR>",{silent = false, noremap = false}, "Opens floating terminal","float_term","Opens the floating terminal window.")
Mapper.map('n','<leader>j',"<Plug>(choosewin)",{silent = false, noremap = false}, "Selects a window","window_picker","Selects a window with a character.")
Mapper.map('n','<leader>k',":FuzzySearch<cr>",{silent = false, noremap = false}, "Selects a window","fuzzy_search","Selects a window with a character.")
Mapper.map('n','<leader>i',":Octo issue list<cr>",{silent = false, noremap = false}, "Selects a window","issues","Selects a window with a character.")
Mapper.map('n','<leader><leader>',":HopLine<cr>",{silent = false, noremap = false}, "Jumps to a specific line","line_hop","Jumps to a specific line on the screen.")
Mapper.map('n','<leader>e',":NvimTreeToggle<cr>",{silent = false, noremap = false}, "Opens the file viewer","file_explorer","Opens the file explorer to view the folder structure.")
require'hop'.setup()
EOF
highlight HopNextKey1 ctermfg=red guifg=red
highlight HopNextKey2 ctermfg=cyan guifg=magenta
highlight HopNextKey ctermfg=magenta guifg=magenta
let g:floaterm_opener='edit'
hi BufferCurrent ctermfg=blue
hi BufferCurrentMod ctermfg=red
hi BufferVisibleTarget ctermfg=yellow
hi BufferCurrentTarget ctermfg=yellow
hi BufferInactiveTarget ctermfg=yellow
set relativenumber
"Taken from https://stackoverflow.com/questions/5700389/using-vims-persistent-undo/22676189
" Put plugins and dictionaries in this dir (also on Windows)
let vimDir = '$HOME/.vim'
if stridx(&runtimepath, expand(vimDir)) == -1
" vimDir is not on runtimepath, add it
let &runtimepath.=','.vimDir
endif
" Keep undo history across sessions by storing it in a file
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undodir')
" Create dirs
call system('mkdir ' . vimDir)
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undofile
endif
lua << EOF
require('gitsigns').setup {
signs = {
add = {hl = 'GitSignsAdd' , text = '│', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'},
change = {hl = 'GitSignsChange', text = '│', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
delete = {hl = 'GitSignsDelete', text = '_', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
topdelete = {hl = 'GitSignsDelete', text = '‾', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'},
changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'},
},
numhl = false,
linehl = false,
keymaps = {
-- Default keymap options
noremap = true,
-- Text objects
['o ih'] = ':<C-U>lua require"gitsigns.actions".select_hunk()<CR>',
['x ih'] = ':<C-U>lua require"gitsigns.actions".select_hunk()<CR>'
},
watch_index = {
interval = 1000,
follow_files = true
},
current_line_blame_opts = {
delay = 1000,
virt_text_pos = 'eol'
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
word_diff = false,
diff_opts = {
internal = true
}
}
EOF
set showcmd
" vimrc
let g:UltiSnipsExpandTrigger="<c-a>"
let g:UltiSnipsJumpForwardTrigger="<c-n>"
let g:UltiSnipsJumpBackwardTrigger="<c-p>"
lua << EOF
local lspkind = require('lspkind')
local cmp = require("cmp")
local t = function(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)
end
local check_back_space = function()
local col = vim.fn.col(".") - 1
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil
end
cmp.setup({
snippet = {
expand = function(args)
vim.fn["UltiSnips#Anon"](args.body)
end,
},
sources = {
{ name = "ultisnips" },
{ name = 'buffer' },
{ name = 'path' },
{ name = 'nvim_lsp' },
{ name = 'look' },
{ name = 'rg' },
{ name = 'cmp_git'}
-- more sources
},
formatting = {
format = lspkind.cmp_format({with_text = true, maxwidth = 50})
},
-- Configure for <TAB> people
-- - <TAB> and <S-TAB>: cycle forward and backward through autocompletion items
-- - <TAB> and <S-TAB>: cycle forward and backward through snippets tabstops and placeholders
-- - <TAB> to expand snippet when no completion item selected (you don't need to select the snippet from completion item to expand)
-- - <C-space> to expand the selected snippet from completion menu
mapping = {
['<CR>'] = cmp.mapping.confirm(),
["<C-Space>"] = cmp.mapping(function(fallback)
if vim.fn.pumvisible() == 1 then
if vim.fn["UltiSnips#CanExpandSnippet"]() == 1 then
return vim.fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
end
vim.fn.feedkeys(t("<C-n>"), "n")
elseif check_back_space() then
vim.fn.feedkeys(t("<cr>"), "n")
else
fallback()
end
end, {
"i",
"s",
}),
["<Tab>"] = cmp.mapping(function(fallback)
if vim.fn.complete_info()["selected"] == -1 and vim.fn["UltiSnips#CanExpandSnippet"]() == 1 then
vim.fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
elseif vim.fn["UltiSnips#CanJumpForwards"]() == 1 then
vim.fn.feedkeys(t("<ESC>:call UltiSnips#JumpForwards()<CR>"))
elseif vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(t("<C-n>"), "n")
elseif check_back_space() then
vim.fn.feedkeys(t("<tab>"), "n")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if vim.fn["UltiSnips#CanJumpBackwards"]() == 1 then
return vim.fn.feedkeys(t("<C-R>=UltiSnips#JumpBackwards()<CR>"))
elseif vim.fn.pumvisible() == 1 then
vim.fn.feedkeys(t("<C-p>"), "n")
else
fallback()
end
end, {
"i",
"s",
}),
},
})
vim.g.UltiSnipsRemoveSelectModeMappings = 0
require("cmp_git").setup({
-- defaults
filetypes = { "gitcommit" },
github = {
issues = {
filter = "all", -- assigned, created, mentioned, subscribed, all, repos
limit = 100,
state = "open", -- open, closed, all
},
mentions = {
limit = 100,
},
},
})
EOF
lua << EOF
require('bufferline').setup({
options = {
numbers = function(opts) return string.format("[%s]",opts.id) end,
close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
right_mouse_command = "bdelete! %d", -- can be a string | function, see "Mouse actions"
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
indicator_icon = '| ',
buffer_close_icon = '',
modified_icon = 'x',
close_icon = 'k',
left_trunc_marker = '',
right_trunc_marker = '',
max_name_length = 18,
max_prefix_length = 15, -- prefix used when a buffer is de-duplicated
tab_size = 18,
diagnostics = "nvim_lsp",
diagnostics_indicator = function(count, level, diagnostics_dict, context)
return "("..count..")"
end,
show_buffer_icons = true, -- disable filetype icons for buffers
show_buffer_close_icons = true,
show_close_icon = true,
show_tab_indicators = false,
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
separator_style = {'|','|'},
enforce_regular_tabs = false,
always_show_bufferline = true,
sort_by = 'directory'
}
})
EOF
set termguicolors " this variable must be enabled for colors to be applied properly
lua << EOF
require"octo".setup({
default_remote = {"upstream", "origin"}; -- order to try remotes
reaction_viewer_hint_icon = ""; -- marker for user reactions
user_icon = ""; -- user icon
timeline_marker = ""; -- timeline marker
timeline_indent = "2"; -- timeline indentation
right_bubble_delimiter = ")"; -- Bubble delimiter
left_bubble_delimiter = "("; -- Bubble delimiter
github_hostname = ""; -- GitHub Enterprise host
snippet_context_lines = 4; -- number or lines around commented lines
file_panel = {
size = 10, -- changed files panel rows
use_icons = true -- use web-devicons in file panel
},
mappings = {
issue = {
close_issue = "<space>ic", -- close issue
reopen_issue = "<space>io", -- reopen issue
list_issues = "<space>il", -- list open issues on same repo
reload = "<C-r>", -- reload issue
open_in_browser = "<C-b>", -- open issue in browser
copy_url = "<C-y>", -- copy url to system clipboard
add_assignee = "<space>aa", -- add assignee
remove_assignee = "<space>ad", -- remove assignee
create_label = "<space>lc", -- create label
add_label = "<space>la", -- add label
remove_label = "<space>ld", -- remove label
goto_issue = "<space>gi", -- navigate to a local repo issue
add_comment = "<space>ca", -- add comment
delete_comment = "<space>cd", -- delete comment
next_comment = "]c", -- go to next comment
prev_comment = "[c", -- go to previous comment
react_hooray = "<space>rp", -- add/remove 🎉 reaction
react_heart = "<space>rh", -- add/remove ❤️ reaction
react_eyes = "<space>re", -- add/remove 👀 reaction
react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
react_rocket = "<space>rr", -- add/remove 🚀 reaction
react_laugh = "<space>rl", -- add/remove 😄 reaction
react_confused = "<space>rc", -- add/remove 😕 reaction
},
pull_request = {
checkout_pr = "<space>po", -- checkout PR
merge_pr = "<space>pm", -- merge PR
list_commits = "<space>pc", -- list PR commits
list_changed_files = "<space>pf", -- list PR changed files
show_pr_diff = "<space>pd", -- show PR diff
add_reviewer = "<space>va", -- add reviewer
remove_reviewer = "<space>vd", -- remove reviewer request
close_issue = "<space>ic", -- close PR
reopen_issue = "<space>io", -- reopen PR
list_issues = "<space>il", -- list open issues on same repo
reload = "<C-r>", -- reload PR
open_in_browser = "<C-b>", -- open PR in browser
copy_url = "<C-y>", -- copy url to system clipboard
add_assignee = "<space>aa", -- add assignee
remove_assignee = "<space>ad", -- remove assignee
create_label = "<space>lc", -- create label
add_label = "<space>la", -- add label
remove_label = "<space>ld", -- remove label
goto_issue = "<space>gi", -- navigate to a local repo issue
add_comment = "<space>ca", -- add comment
delete_comment = "<space>cd", -- delete comment
next_comment = "]c", -- go to next comment
prev_comment = "[c", -- go to previous comment
react_hooray = "<space>rp", -- add/remove 🎉 reaction
react_heart = "<space>rh", -- add/remove ❤️ reaction
react_eyes = "<space>re", -- add/remove 👀 reaction
react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
react_rocket = "<space>rr", -- add/remove 🚀 reaction
react_laugh = "<space>rl", -- add/remove 😄 reaction
react_confused = "<space>rc", -- add/remove 😕 reaction
},
review_thread = {
goto_issue = "<space>gi", -- navigate to a local repo issue
add_comment = "<space>ca", -- add comment
add_suggestion = "<space>sa", -- add suggestion
delete_comment = "<space>cd", -- delete comment
next_comment = "]c", -- go to next comment
prev_comment = "[c", -- go to previous comment
select_next_entry = "]q", -- move to previous changed file
select_prev_entry = "[q", -- move to next changed file
close_review_tab = "<C-c>", -- close review tab
react_hooray = "<space>rp", -- add/remove 🎉 reaction
react_heart = "<space>rh", -- add/remove ❤️ reaction
react_eyes = "<space>re", -- add/remove 👀 reaction
react_thumbs_up = "<space>r+", -- add/remove 👍 reaction
react_thumbs_down = "<space>r-", -- add/remove 👎 reaction
react_rocket = "<space>rr", -- add/remove 🚀 reaction
react_laugh = "<space>rl", -- add/remove 😄 reaction
react_confused = "<space>rc", -- add/remove 😕 reaction
},
submit_win = {
approve_review = "<C-a>", -- approve review
comment_review = "<C-m>", -- comment review
request_changes = "<C-r>", -- request changes review
close_review_tab = "<C-c>", -- close review tab
},
review_diff = {
add_review_comment = "<space>ca", -- add a new review comment
add_review_suggestion = "<space>sa", -- add a new review suggestion
focus_files = "<leader>e", -- move focus to changed file panel
toggle_files = "<leader>b", -- hide/show changed files panel
next_thread = "]t", -- move to next thread
prev_thread = "[t", -- move to previous thread
select_next_entry = "]q", -- move to previous changed file
select_prev_entry = "[q", -- move to next changed file
close_review_tab = "<C-c>", -- close review tab
toggle_viewed = "<leader><space>", -- toggle viewer viewed state
},
file_panel = {
next_entry = "j", -- move to next changed file
prev_entry = "k", -- move to previous changed file
select_entry = "<cr>", -- show selected changed file diffs
refresh_files = "R", -- refresh changed files panel
focus_files = "<leader>e", -- move focus to changed file panel
toggle_files = "<leader>b", -- hide/show changed files panel
select_next_entry = "]q", -- move to previous changed file
select_prev_entry = "[q", -- move to next changed file
close_review_tab = "<C-c>", -- close review tab
toggle_viewed = "<leader><space>", -- toggle viewer viewed state
}
}
})
EOF
au BufEnter octo://* nmap q :bd<cr>
imap <expr> kk vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
smap <expr> kk vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
imap <expr> KK vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
smap <expr> KK vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
imap <c-x><c-l> <plug>(fzf-complete-line)
map <tab> <c-w>w
let g:preview_uml_url='http://localhost:8888'
lua << EOF
require("nvim-gps").setup()
local vi_mode_utils = require('feline.providers.vi_mode')
local M = {
active = {},
inactive = {}
}
M.active[1] = {
{
provider = '▊ ',
hl = {
fg = 'darkmagenta'
}
},
{
provider = 'vi_mode',
hl = function()
return {
name = vi_mode_utils.get_mode_highlight_name(),
fg = vi_mode_utils.get_mode_color(),
style = 'bold'
}
end,
right_sep = ' ',
icon=''
},
{
provider = 'file_info',
hl = {
fg = 'white',
bg = 'darkmagenta',
style = 'bold'
},
left_sep = {
' ', 'slant_left_2',
{str = ' ', hl = {bg = 'darkmagenta', fg = 'NONE'}}
},
right_sep = {'slant_right_2', ' '}
},
{
provider = 'file_size',
right_sep = {
' ',
{
str = 'slant_left_2_thin',
hl = {
fg = 'fg',
bg = 'bg'
}
},
}
},
{
provider = 'position',
left_sep = ' ',
right_sep = {
' ',
{
str = 'slant_right_2_thin',
hl = {
fg = 'fg',
bg = 'bg'
}
}
}
},
{
provider = 'diagnostic_errors',
hl = { fg = 'red' }
},
{
provider = 'diagnostic_warnings',
hl = { fg = 'yellow' }
},
{
provider = 'diagnostic_hints',
hl = { fg = 'cyan' }
},
{
provider = 'diagnostic_info',
hl = { fg = 'skyblue' }
},
{
provider = function(component)
result = require("nvim-treesitter").statusline()
if result == nil then
return ""
else
return result
end
end,
left_sep = ' ',
hl = {style='italic', bg='black'}
}
}
M.active[2] = {
{
provider = 'git_branch',
hl = {
fg = 'orange',
bg = 'black',
style = 'bold'
},
right_sep = {
str = ' ',
hl = {
fg = 'NONE',
bg = 'black'
}
}
},
{
provider = 'git_diff_added',
hl = {
fg = 'green',
bg = 'black'
}
},
{
provider = 'git_diff_changed',
hl = {
fg = 'orange',
bg = 'black'
}
},
{
provider = 'git_diff_removed',
hl = {
fg = 'red',
bg = 'black'
},
right_sep = {
str = ' ',
hl = {
fg = 'NONE',
bg = 'black'
}
}
},
{
provider = 'line_percentage',
hl = {
style = 'bold'
},
left_sep = ' ',
right_sep = ' '
},
{
provider = 'scroll_bar',
hl = {
fg = 'skyblue',
style = 'bold'
}
}
}
M.inactive[1] = {
{
provider = 'file_type',
hl = {
fg = 'white',
bg = 'oceanblue',
style = 'bold'
},
left_sep = {
str = ' ',
hl = {
fg = 'NONE',
bg = 'oceanblue'
}
},
right_sep = {
{
str = ' ',
hl = {
fg = 'NONE',
bg = 'oceanblue'
}
},
'slant_right'
}
},
-- Empty component to fix the highlight till the end of the statusline
{
}
}
require 'feline'.setup{components=M}
EOF