-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit_0.5.vim
758 lines (658 loc) · 25.6 KB
/
init_0.5.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
"_______________________________________________________________________________
"________________________________________________/\\\___________________________
"____________________________/\\\________________\/\\\__________________________
"____/\\\____________________\/\\\________________\/\\\_________________________
"__/\\\\\\\\\\\__/\\/\\\\\\\__\/\\\\\\\\___________\/\\\___/\\\\\\\\\\\_________
"__\////\\\////__\/\\\/////\\\_\/\\\////\\\____/\\\\\\\\\__\///////\\\/_________
"______\/\\\______\/\\\___\///__\/\\\\\\\\/____/\\\////\\\_______/\\\/__________
"_______\/\\\_/\\__\/\\\_________\/\\\///\\\___\/\\\__\/\\\_____/\\\/___________
"________\//\\\\\___\/\\\_________\/\\\_\///\\\_\//\\\\\\\/\\__/\\\\\\\\\\\_____
"__________\/////____\///__________\///____\///___\///////\//__\///////////_____
"_______________________________________________________________________________
"
" ╦ ╔╗╔ ╦ ╔╦╗ ╦ ╦ ╦ ╔╦╗
" ║ ║║║ ║ ║ ┌┐ ╚╗╔╝ ║ ║║║
" ╩ ╝╚╝ ╩ ╩ └┘ ╚╝ ╩ ╩ ╩══════════════════════════════════════════════
" ┬ ┬┬┌┬┐ ┌─┐┬ ┬ ┬┌─┐ ┌─┐┌─┐┌┬┐┬ ┬┌─┐
" └┐┌┘││││───├─┘│ │ ││ ┬ └─┐├┤ │ │ │├─┘
" └┘ ┴┴ ┴ ┴ ┴─┘└─┘└─┘ └─┘└─┘ ┴ └─┘┴
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
let curl_exists=expand('curl')
if !filereadable(vimplug_exists)
if !executable(curl_exists)
echoerr "You have to install curl or first install vim-plug yourself!"
execute "q!"
endif
echo "Installing Vim-Plug..."
echo ""
silent exec "!"curl_exists" -fLo " . shellescape(vimplug_exists) . "
\ --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
let g:not_finish_vimplug = "yes"
" autocmd VimEnter * PlugInstall
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
"-- end vim-plug setup ---------------------------------------------------------
set nocompatible
" ╔═╗ ╦ ╦ ╦ ╔═╗ ╦ ╔╗╔ ╔═╗
" ╠═╝ ║ ║ ║ ║ ╦ ║ ║║║ ╚═╗
" ╩ ╩═╝ ╚═╝ ╚═╝ ╩ ╝╚╝ ╚═╝
" Set the runtime path to include Vundle and initialise
call plug#begin('~/.config/nvim/plugged')
" LSP / Completion
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp', {'branch': 'main'}
Plug 'hrsh7th/cmp-buffer', {'branch': 'main'}
Plug 'hrsh7th/cmp-path', {'branch': 'main'}
Plug 'hrsh7th/cmp-cmdline', {'branch': 'main'}
Plug 'hrsh7th/nvim-cmp', {'branch': 'main'}
" For vsnip users.
" Plug 'hrsh7th/cmp-vsnip'
" Plug 'hrsh7th/vim-vsnip'
" For luasnip users.
" Plug 'L3MON4D3/LuaSnip'
" Plug 'saadparwaiz1/cmp_luasnip'
" For snippy users.
" Plug 'dcampos/nvim-snippy'
" Plug 'dcampos/cmp-snippy'
" For ultisnips users.
" Code snippets
Plug 'SirVer/ultisnips'
Plug 'quangnguyen30192/cmp-nvim-ultisnips'
Plug 'honza/vim-snippets'
" Fuzzy finder
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
" Syntax
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-treesitter/playground'
" File explorer
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'kyazdani42/nvim-tree.lua'
:lua << EOF
require'nvim-tree'.setup()
EOF
" Status line
" Plug 'glepnir/galaxyline.nvim', {'branch': 'main'}
Plug 'nvim-lualine/lualine.nvim'
" Debugging
Plug 'nvim-telescope/telescope-dap.nvim'
Plug 'mfussenegger/nvim-dap'
" https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/
" Github integration
Plug 'pwntester/octo.nvim'
Plug 'tpope/vim-fugitive'
"Commenter
Plug 'tpope/vim-commentary'
"wisely add 'end' in ruby (maybe bash)
Plug 'tpope/vim-endwise'
"
"Surround - surround or change the surround an item with "''() etc.
Plug 'tpope/vim-surround'
" Easily search for, substitute, and abbreviate multiple variants of a word
Plug 'tpope/vim-abolish'
"UNIX shell commands
Plug 'tpope/vim-eunuch'
"Emmet for HTML editing, <c-y> to trigger completion
Plug 'mattn/emmet-vim'
"Colour preview in code
Plug 'ap/vim-css-color'
"Always highlights the enclosing XML/HTML tags
Plug 'valloric/matchtagalways'
"Doubles quotes and parenthesis on the fly
Plug 'raimondi/delimitmate'
"Asynchronously fly grep (SpaceVim)
Plug 'wsdjeg/FlyGrep.vim'
"Multiple cursors
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
"Underlines a word element
Plug 'itchyny/vim-cursorword'
" Much simpler rainbow parentheses
Plug 'junegunn/rainbow_parentheses.vim'
" Easy, <leader><leader>f<letter> you want to move to
Plug 'easymotion/vim-easymotion'
"Markdown editor (git READMEs)
Plug 'shime/vim-livedown'
"i3wm .config syntax
Plug 'PotatoesMaster/i3-vim-syntax'
"Vim-markbar (activate with ' or `)
" Plug 'Yilin-Yang/vim-markbar'
"Alternative sudo.vim for Vim and Neovim
Plug 'lambdalisue/suda.vim'
" Vim syntax highlighting for the OpenSCAD 3D modeling language
" Plug 'sirtaj/vim-openscad'
"Unmanged plugins
" to show terminal colors, use :XtermColorTable
Plug '~/.vim/xterm-color-table.vim'
" Highlight matchit.
Plug '~/.vim/99-hl-matchlines.vim'
" Uncomplicated alternative to vim-signature (shows mark in gutter)
" Here in place of vim-markbar
Plug '~/.vim/marksigns.vim'
"Themes (CLI)
Plug 'neutaaaaan/iosvkem'
Plug 'Mofiqul/vscode.nvim', {'branch': 'main'}
call plug#end()
" Automatically install missing plugins on startup
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
" ╔╦╗ ╦ ╔═╗ ╔═╗ ╔═╗ ╦ ╦ ╔═╗ ╔╗╔ ╔═╗ ╔═╗
" ║║║ ║ ╚═╗ ║ ║╣ ║ ║ ╠═╣ ║║║ ║╣ ╠═╣
" ╩ ╩ ╩ ╚═╝ ╚═╝ ╚═╝ ╩═╝ ╩═╝ ╩ ╩ ╝╚╝ ╚═╝ ╩ ╩
" Highlight the current line and column only in the current window
autocmd WinLeave * set nocursorline nocursorcolumn
autocmd WinEnter * set cursorline cursorcolumn
autocmd vimEnter * set cursorline cursorcolumn
" Disable all error bells
set belloff=all
" Line number and relative line number
set number
set relativenumber
set ruler
" Show the command as it's being typed
set showcmd
" Shares the system clipboard
set clipboard=unnamed,unnamedplus
" Set n line(s) to be always shown below or above the cursor
set scrolloff=999
" Set to split always right
set splitright
"Set some 'sensible' defaults
set tabstop=2
set shiftwidth=2
set expandtab
set smarttab
set autoindent
set backspace=indent,eol,start
set complete-=i
"set list! -- see mappings
set listchars=tab:▸\ ,eol:¬,trail:·,space:·
" Since Neovim 0.4.x wildmenu uses pum
" Default wildoptions are set to 'pum,tagfile'
" To get the old wildmenu remove 'pum'
set wildoptions=tagfile
"Avoid showing the mode on the last line
set noshowmode
" Searching
set ignorecase smartcase
"set incsearch "handled by <leader>i -- see mappings
" Use the silversearcher-ag to perform searches (like ack, but faster)
set grepprg=ag\ -i
" Enable syntax
syntax enable
" Enable filetype-specific plugins and indenting
filetype plugin indent on
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
" Also affects Git Gutter update.
set updatetime=50
" 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.
set signcolumn=yes
" Give more space for displaying messages.
set cmdheight=2
" set completeopt=menu,menuone,noselect "cmp
set completeopt=menuone,noinsert,noselect
set smartindent
" Highlight yanked text
augroup highlight_yank
autocmd!
autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank()
augroup END
" Suda.vim prefix
let g:suda#prefix = 'su//'
" DelimitMate config
au FileType html,vim let b:delimitMate_matchpairs = "(:),[:],{:},<:>"
" nnoremap <Space>v :e ~/.config/nvim/init.exp2.vim<CR>
" ╦ ╔═╗ ╔═╗
" ║ ╚═╗ ╠═╝
" ╩═╝ ╚═╝ ╩
:lua << EOF
local nvim_lsp = require('lspconfig')
local on_attach = function(client, bufnr)
require'completion'.on_attach(client, bufnr)
protocol.CompletionItemKind = {
'', -- Text
'', -- Method
'', -- Function
'', -- Constructor
'', -- Field
'', -- Variable
'', -- Class
'ﰮ', -- Interface
'', -- Module
'', -- Property
'', -- Unit
'', -- Value
'', -- Enum
'', -- Keyword
'', -- Snippet
'', -- Color
'', -- File
'', -- Reference
'', -- Folder
'', -- EnumMember
'', -- Constant
'', -- Struct
'', -- Event
'ﬦ', -- Operator
'', -- TypeParameter
}
-- local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
-- buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings
local opts = { noremap=true, silent=true, buffer=bufnr }
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
end
-- Set autocommands conditional on server_capabilities
if client.resolved_capabilities.document_highlight then
vim.api.nvim_exec([[
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
augroup lsp_document_highlight
autocmd!
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]], false)
end
end
-- local servers = {'tsserver'}
-- for _, lsp in ipairs(servers) do
-- nvim_lsp[lsp].setup {
-- on_attach = on_attach,
-- filetypes = { 'javascript', 'javascriptreact', 'json', 'typescript',
-- \ 'typescriptreact', 'css', 'less', 'scss', 'markdown', 'pandoc' },
-- root_dir = function() return vim.loop.cwd() end -- run lsp for javascript in any directory
-- }
-- end
require('lspconfig')['tsserver'].setup{
on_attach = on_attach,
-- flags = lsp_flags,
}
nvim_lsp.diagnosticls.setup {
on_attach = on_attach,
filetypes = { 'javascript', 'javascriptreact', 'json', 'typescript',
\ 'typescriptreact', 'css', 'less', 'scss', 'markdown', 'pandoc' },
init_options = {
linters = {
eslint = {
command = 'eslint_d',
rootPatterns = { '.git' },
debounce = 100,
args = { '--stdin', '--stdin-filename', '%filepath', '--format', 'json' },
sourceName = 'eslint_d',
parseJson = {
errorsRoot = '[0].messages',
line = 'line',
column = 'column',
endLine = 'endLine',
endColumn = 'endColumn',
message = '[eslint(standard)] ${message} [${ruleId}]',
security = 'severity'
},
securities = {
[2] = 'error',
[1] = 'warning'
}
},
standard = {
command = 'standard',
rootPatterns = { '.git' },
debounce = 100,
args = { '--stdin', '%filepath' },
sourceName = 'standard',
parseJson = {
errorsRoot = '[0].messages',
line = 'line',
column = 'column',
endLine = 'endLine',
endColumn = 'endColumn',
message = '[standard] ${message} [${ruleId}]',
security = 'severity'
},
securities = {
[2] = 'error',
[1] = 'warning'
}
},
},
filetypes = {
javascript = 'eslint',
javascriptreact = 'eslint',
typescript = 'eslint',
typescriptreact = 'eslint',
},
formatters = {
eslint_d = {
command = 'eslint_d',
args = { '--stdin', '--stdin-filename', '%filename', '--fix-to-stdout' },
rootPatterns = { '.git' }
},
standard = {
command = 'standard',
args = { '--stdin', '%filename' },
rootPatterns = { '.git' }
},
prettier = {
command = 'prettier',
args = { '--stdin-filepath', '%filename' }
}
},
formatFiletypes = {
css = 'prettier',
javascript = 'eslint_d',
javascriptreact = 'eslint_d',
json = 'prettier',
scss = 'prettier',
less = 'prettier',
typescript = 'eslint_d',
typescriptreact = 'eslint_d',
json = 'prettier',
markdown = 'prettier',
}
}
}
EOF
" Completion
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
lua <<EOF
-- Set up nvim-cmp.
local cmp = require'cmp'
cmp.setup({
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.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- { name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
{ name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ 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').update_capabilities(vim.lsp.protocol.make_client_capabilities())
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
require('lspconfig')['tsserver'].setup {
capabilities = capabilities
}
EOF
" -- LSP ----------------------------------------------------------------------
" Code snippets
let g:completion_enable_snippet = 'UltiSnips'
" Fuzzy finder
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
nnoremap <leader>fl <cmd>Telescope git_files<cr>
" Syntax
lua <<EOF
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true
},
playground = {
enable = true,
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false -- Whether the query persists across vim sessions
}
}
EOF
" File explorer
nnoremap <leader>tt :NvimTreeToggle<CR>
nnoremap <leader>tr :NvimTreeRefresh<CR>
nnoremap <leader>tn :NvimTreeFindFile<CR>
" NvimTreeOpen and NvimTreeClose are also available if you need them
" Status line
" luafile ~/.config/nvim/eviline.lua
" luafile ~/.config/nvim/galaxyline.lua
" luafile ~/.config/nvim/evil_lualine.lua
lua << END
require('lualine').setup {
options = {
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
}
}
require('lualine').get_config()
END
" Debugging
lua <<EOF
require('telescope').load_extension('dap')
EOF
nnoremap <silent> <F5> :lua require'dap'.continue()<CR>
nnoremap <silent> <leader>dd :lua require('dap').continue()<CR>
nnoremap <silent> <F10> :lua require'dap'.step_over()<CR>
nnoremap <silent> <F11> :lua require'dap'.step_into()<CR>
nnoremap <silent> <F12> :lua require'dap'.step_out()<CR>
nnoremap <silent> <leader>b :lua require'dap'.toggle_breakpoint()<CR>
nnoremap <silent> <leader>B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
nnoremap <silent> <leader>lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
nnoremap <silent> <leader>dr :lua require'dap'.repl.open()<CR>
nnoremap <silent> <leader>dl :lua require'dap'.repl.run_last()<CR>`
" ╔╦╗ ╔═╗ ╔═╗ ╔═╗ ╦ ╔╗╔ ╔═╗ ╔═╗
" ║║║ ╠═╣ ╠═╝ ╠═╝ ║ ║║║ ║ ╦ ╚═╗
" ╩ ╩ ╩ ╩ ╩ ╩ ╩ ╝╚╝ ╚═╝ ╚═╝
" make sure there are no spaces at the end!
inoremap jk <esc>
inoremap kj <esc>
vnoremap v <esc>
nnoremap H ^
nnoremap L $
nnoremap <C-s> :write<CR>
inoremap <C-s> <esc>:write<CR>i
" noremap <F4> :ALEFix<CR>
noremap <S-A-f> :Format<CR>
" Open the current file in default browser
nnoremap <F5> :execute '!sensible-browser % &'<CR>
" Edit vimrc with f5 and source it with f6
nnoremap <silent> <leader><f5> :e $MYVIMRC<CR>
nnoremap <leader><f6> :so $MYVIMRC<CR>
" Search the word under the cursor in file folder.
noremap <F7> :execute "grep! " . expand("<cword>") . "\| copen"<CR>
noremap <F8> :execute "vimgrep /" . expand("<cword>") . "/j **" <Bar> cw<CR>
" Shortcut to rapidly toggle `set list` = see non printable characters.
nnoremap <leader>l :set list!<CR>
" Turn on/off incremental search (search as you type)
nnoremap <leader>i :set incsearch!<CR>
" Toggle highlighting of search results.
nnoremap <Leader><CR> :set hlsearch!<CR>
" Matchtagalways motion
nnoremap <leader>t :MtaJumpToOtherTag<cr>
" Shortcuts to cicle through the buffers
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
" Shortcuts to cicle through the quickfix results
nnoremap <A-x> :cnext<CR>
nnoremap <A-z> :cprevious<CR>
" Livedow markdown previewer toggle on/off
nnoremap <F6> :LivedownToggle<CR>
" Toggles_highlight of matchit results, for all matching pairs
" that are NOT Parens: (),[],{}; ie.: 'def|class|while|do' with 'end'.
" Toggle off to get tpope/endwise plugin do its job.
nnoremap <leader>p :call Toggle_Extra_Paren_HL()<CR>
" Needed for vim-markbar
" map <Leader>m <Plug>ToggleMarkbar
" Marksigns
let g:marksigns_plugs = 1
map <Leader>m <Plug>(MarksAll)
" surround by quotes - frequently use cases of vim-surround
map <leader>" ysiw"
map <leader>' ysiw'
" Make Y Act like D and C
nnoremap Y y$
" indent without kill the selection in vmode
vmap < <gv
vmap > >gv
" remap the annoying u in visual mode
vmap u y
" shortcut to substitute current word under cursor
nnoremap <leader>s :%s/<c-r><c-w>//gc<left><left><left>
" Open a terminal on the bottom
noremap <F12> :botright 13sp term://$SHELL<CR>i
" mappings to exit terminal-mode:
tnoremap <Esc> <C-\><C-n>
tnoremap jk <C-\><C-n>
tnoremap kj <C-\><C-n>
nnoremap <silent> <F3> :NvimTreeToggle<CR>
nnoremap <leader>r :NvimTreeRefresh<CR>
nnoremap <leader>n :NvimTreeFindFile<CR>
" NvimTreeOpen, NvimTreeClose, NvimTreeFocus and NvimTreeResize are also available if you need them
" ██████╗ ██████╗ ██╗ ██████╗ ██████╗ ███████╗
" ██╔════╝██╔═══██╗██║ ██╔═══██╗██╔══██╗██╔════╝
" ██║ ██║ ██║██║ ██║ ██║██████╔╝███████╗
" ██║ ██║ ██║██║ ██║ ██║██╔══██╗╚════██║
" ╚██████╗╚██████╔╝███████╗╚██████╔╝██║ ██║███████║
" ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
set background=dark
" VS Code dark theme
let g:vscode_style = "dark"
" Set the theme.
colorscheme vscode
"colorscheme Iosvkem
" Italic for comments.
highlight Comment cterm=italic gui=italic
" Highlight for the matching parenthesis.
highlight MatchParen guibg=NONE guifg=#00ff00 gui=bold
" Highlight for the trailing space
" highlight ExtraWhitespace ctermbg=red guibg=#ff0000
" autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\\t/
" TODO: highlight off for thr popupmenu
"if (!pumvisible())
"...
"endif
" Highlight past the 80th column
set colorcolumn=81
highlight ColorColumn ctermbg=52 guibg=#302222
" Hide ~ at the end of the buffer
highlight EndOfBuffer ctermfg=NONE guifg=BG
" Iovskem theme fixes (#1bid1e theme bg color, 234 cterm bg)
if g:colors_name=='Iosvkem'
" Fix ALE signs highlight
hi ALEErrorSign cterm=bold ctermfg=203 gui=bold guifg=#ff2040
hi ALEWarningSign cterm=bold ctermfg=220 gui=bold guifg=#fcbb20
" Fix git-gutter highlight
hi GitGutterChange ctermfg=220 guifg=#fcbb20
endif
" a list of groups can be found at `:help nvim_tree_highlight`
highlight NvimTreeFolderIcon guifg=#B079AC
" ╔╗ ╔═╗ ╔═╗ ╦╔═ ╦ ╦ ╔═╗
" ╠╩╗ ╠═╣ ║ ╠╩╗ ║ ║ ╠═╝
" ╚═╝ ╩ ╩ ╚═╝ ╩ ╩ ╚═╝ ╩
" The // at the end of the path means that the directory information
" will be saved in the filename.
" For example, the backup file for /home/wtf/Projects/README.md
" will be /path/%home%wtf%Projects%README.md
"
if isdirectory($HOME . '/.config/nvim/backup') == 0
:silent !mkdir -p ~/.config/nvim/backup >/dev/null 2>&1
endif
set backupdir=~/.config/nvim/backup//
set backupdir+=/tmp//
set backup
" Save your swp files to a less annoying place than the current directory.
" It saves it to ~/.config/nvim/swap, or /tmp
if isdirectory($HOME . '/.config/nvim/swap') == 0
:silent !mkdir -p ~/.config/nvim/swap >/dev/null 2>&1
endif
set directory=~/.config/nvim/swap//
set directory+=/tmp//
if exists("+undofile")
" undofile - This allows you to use undos after exiting and restarting
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
" :help undo-persistence
if isdirectory($HOME . '/.config/nvim/undo') == 0
:silent !mkdir -p ~/.config/nvim/undo > /dev/null 2>&1
endif
set undodir=~/.config/nvim/undo//
set directory+=/tmp//
set undofile
endif