-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.vim
1715 lines (1460 loc) · 51.5 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
990
991
992
993
994
995
996
997
998
999
1000
let g:coc_node_path = '~/.nvm/versions/node/v18.14.2/bin/node'
let g:python3_host_prog = '/usr/bin/python3'
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
if has('win32')&&!has('win64')
let curl_exists=expand('C:\Windows\Sysnative\curl.exe')
else
let curl_exists=expand('curl')
endif
let mapleader = " "
if !filereadable(vimplug_exists)
if !executable(curl_exists)
echoerr "Tienes que instalar curl o primero instalar Vim Plug tú mismo"
execute "q!"
endif
echo "Instalando 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
endif
" RAINBOW_PARENTHESES
augroup rainbow_lisp
autocmd!
autocmd FileType lisp,clojure,scheme RainbowParentheses
augroup END
" LAZYGIT
autocmd BufEnter * :lua require('lazygit.utils').project_root_dir()
set autoindent " autoindent always ON.
set expandtab " expand tabs
set shiftwidth=4 " spaces for autoindenting
set softtabstop=4 " remove a full pseudo-TAB when i press <BS>
set encoding=UTF-8
" Required:
call plug#begin(expand('~/.config/nvim/plugged'))
Plug 'folke/twilight.nvim'
" Complemento que atenúa las partes inactivas del código que está editando con
" TreeSitter : https://github.com/folke/twilight.nvim
Plug 'preservim/nerdtree'
" https://github.com/preservim/nerdtree
" Explorador de archivos, para navegar visualmente por jerarquia de
" directorios, abrir archivos o editarlos
Plug 'Xuyuanp/nerdtree-git-plugin'
" https://github.com/Xuyuanp/nerdtree-git-plugin
" Complemento de NERDTree que muestra indicadores de estado de Git
" Icon pack && Fonts
Plug 'ryanoasis/vim-devicons'
" Plug 'mhinz/vim-signify'
" LAZYGIT (leer completo)
Plug 'kdheepak/lazygit.nvim'
" Complemento para integrar un administrador de git
Plug 'mhinz/vim-startify'
" https://github.com/mhinz/vim-startify
Plug 'tpope/vim-fugitive'
" https://github.com/tpope/vim-fugitive
" Complemento de Vim para Git ( :help fugitive para ver todos los comandos
" para git)
Plug 'tamton-aquib/staline.nvim'
" BAR LINE
" https://github.com/tamton-aquib/staline.nvim
Plug 'airblade/vim-gitgutter'
" https://github.com/airblade/vim-gitgutter
" Complemento de Vim que muestra una diferenca de git en la columna mediante
" un sigo (+ -) acerca de que lineas se han agregado, modificado o eliminado
Plug 'Raimondi/delimitMate'
" https://github.com/Raimondi/delimitMate
" Complemento que proporciona el cierre automatico de comilla, paréntesis,
" corchetes, etc
Plug 'lukas-reineke/indent-blankline.nvim'
" https://github.com/lukas-reineke/indent-blankline.nvim
" Complemento para agregar lineas de sangría a todas las línea (incluidas las
" vacias)
" HTML Bundle
Plug 'hail2u/vim-css3-syntax'
Plug 'gko/vim-coloresque'
Plug 'tpope/vim-haml'
Plug 'mattn/emmet-vim'
" Javascript Bundle
Plug 'jelera/vim-javascript-syntax'
" Python
Plug 'davidhalter/jedi-vim'
" Asycomplete
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'Shougo/ddc.vim'
Plug 'shun/ddc-vim-lsp'
" THEME 1
Plug 'shaunsingh/moonlight.nvim'
" https://github.com/shaunsingh/moonlight.nvim
" THEME 2
Plug 'wuelnerdotexe/vim-enfocado'
" https://github.com/wuelnerdotexe/vim-enfocado
" THEME 3
Plug 'embark-theme/vim', { 'as': 'embark', 'branch': 'main' }
" https://github.com/embark-theme/vim
" FZF
" https://github.com/junegunn/fzf.vim
if isdirectory('/usr/local/opt/fzf')
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'
else
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' }
Plug 'junegunn/fzf.vim'
endif
" Snippets
Plug 'SirVer/ultisnips'
" https://github.com/SirVer/ultisnips
" UltiSnips muestras fragmentos que pueden ir despúes de lo que se vaya
" codificando, python
Plug 'honza/vim-snippets'
" https://github.com/honza/vim-snippets
" Fragmentos de snipMate y UltiSnips, contiene fragmentos de archivos para
" varios lenguajes de programación
Plug 'leafgarland/typescript-vim'
" Colores o soporte para Typescript
Plug 'prabirshrestha/vim-lsp'
"Complemento Async Language Server Protocol para vim8 y neovim, documentacion
"aqui: https://github.com/prabirshrestha/vim-lsp
Plug 'mattn/vim-lsp-settings'
" Configuraciones automaticas para Language Server para vim-lsp
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/nvim-lsp-installer'
Plug 'vim-scripts/grep.vim'
" Intrega herramientas grep, fgrep, egrep, y agrep con Vim
Plug 'vim-scripts/CSApprox'
" Hacer que el esquema de color sea justo, o algo asi
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
" TELESCOPE
" https://github.com/nvim-telescope/telescope.nvim
" Es un buscador difuso altamente extensible sobre listas
Plug 'voldikss/vim-floaterm'
" Movimiento de ventanas WINDSHIFT
" https://github.com/sindrets/winshift.nvim
Plug 'sindrets/winshift.nvim'
Plug 'petertriho/nvim-scrollbar'
" Complemento para scrollbar
Plug 'jbyuki/instant.nvim'
" Complemento de Edicion colaborativa que funciona en un servidor, al esta en
" un servidor todos los clientes pueden acceder : https://github.com/jbyuki/instant.nvim
Plug 'numToStr/Comment.nvim'
" Commentarios : https://github.com/numToStr/Comment.nvim
Plug 'akinsho/bufferline.nvim', { 'tag': 'v2.*' }
" Bufferline : https://github.com/akinsho/bufferline.nvim#installation
Plug 'metakirby5/codi.vim'
" CODI
" Output live del código
" https://github.com/metakirby5/codi.vim
Plug 'folke/zen-mode.nvim'
" MODO ZEN
" https://github.com/folke/zen-mode.nvim
Plug 'Pocco81/auto-save.nvim'
" https://github.com/Pocco81/auto-save.nvim
" AUTO-SAVE
Plug 'junegunn/rainbow_parentheses.vim'
" Rainbow_parentheses Parentesis color
" https://github.com/junegunn/rainbow_parentheses.vim
Plug 'APZelos/blamer.nvim'
" Inspirado en Gitlens para Nvim BLAMER
" https://github.com/APZelos/blamer.nvim
Plug 'norcalli/nvim-colorizer.lua'
" Colorizador rápido de neovim
" https://github.com/norcalli/nvim-colorizer.lua
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
" Markdown Preview
" https://github.com/iamcco/markdown-preview.nvim
Plug 'turbio/bracey.vim', {'do': 'npm install --prefix server'}
" https://github.com/turbio/bracey.vim
" Live-server html, css, javascript
Plug 'filipdutescu/renamer.nvim', { 'branch': 'master' }
" Renombrar
" https://github.com/filipdutescu/renamer.nvim
Plug 'kristijanhusak/vim-carbon-now-sh'
" Carbon (capturar pedazos de código en imagen)
" https://github.com/kristijanhusak/vim-carbon-now-sh
Plug 'mfussenegger/nvim-dap'
" DAP
Plug 'rcarriga/nvim-dap-ui'
" DAP UI
Plug 'nvim-tree/nvim-web-devicons'
Plug 'folke/trouble.nvim'
" https://github.com/folke/trouble.nvim
Plug 'ryanoasis/vim-devicons'
call plug#end()
lua << EOF
use {
"folke/trouble.nvim",
requires = "nvim-tree/nvim-web-devicons",
config = function()
require("trouble").setup {
position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
group = true, -- group results by file
padding = true, -- add an extra new line on top of the list
action_keys = { -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example:
-- close = {},
close = "q", -- close the list
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
open_split = { "<c-x>" }, -- open buffer in new split
open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
open_tab = { "<c-t>" }, -- open buffer in new tab
jump_close = {"o"}, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
toggle_preview = "P", -- toggle auto_preview
hover = "K", -- opens a small popup with the full multiline message
preview = "p", -- preview the diagnostic location
close_folds = {"zM", "zm"}, -- close all folds
open_folds = {"zR", "zr"}, -- open all folds
toggle_fold = {"zA", "za"}, -- toggle fold of current file
previous = "k", -- previous item
next = "j" -- next item
},
indent_lines = true, -- add an indent guide below the fold icons
auto_open = false, -- automatically open the list when you have diagnostics
auto_close = false, -- automatically close the list when you have no diagnostics
auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
auto_fold = false, -- automatically fold a file trouble list at creation
auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
signs = {
-- icons / text used for a diagnostic
error = "⛔",
warning = "⚠️",
hint = "hint",
information = "💡",
other = ""
},
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
}
EOF
nnoremap <leader>xx <cmd>TroubleToggle<cr>
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
map <silent>0 :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!gcc % -o %<"
exec "!time ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "!time ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!time java -cp %:p:h %:t:r"
elseif &filetype == 'sh'
exec "!time bash %"
elseif &filetype == 'javascript'
exec "!node %"
elseif &filetype == 'python'
exec "!python3 %"
elseif &filetype == 'html'
exec "!firefox % &"
elseif &filetype == 'go'
exec "!go build %<"
exec "!time go run %"
elseif &filetype == 'mkd'
exec "!~/.vim/markdown.pl % > %.html &"
exec "!firefox %.html &"
endif
endfunc
" +++++
" DAP DEBUGGER
lua << EOF
require("dapui").setup({
icons = { expanded = "▾", collapsed = "▸" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
-- Expand lines larger than the window
-- Requires >= 0.7
expand_lines = vim.fn.has("nvim-0.7"),
-- Layouts define sections of the screen to place windows.
-- The position can be "left", "right", "top" or "bottom".
-- The size specifies the height/width depending on position. It can be an Int
-- or a Float. Integer specifies height/width directly (i.e. 20 lines/columns) while
-- Float value specifies percentage (i.e. 0.3 - 30% of available lines/columns)
-- Elements are the elements shown in the layout (in order).
-- Layouts are opened in order so that earlier layouts take priority in window sizing.
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = "scopes", size = 0.25 },
"breakpoints",
"stacks",
"watches",
},
size = 40, -- 40 columns
position = "left",
},
{
elements = {
"repl",
"console",
},
size = 0.25, -- 25% of total lines
position = "bottom",
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
max_value_lines = 100, -- Can be integer or nil.
}
})
local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
vim.fn.sign_define('DapBreakpoint', {text='🔴', texthl='', linehl='', numhl=''})
vim.fn.sign_define('DapBreakpointCondition', {text='⭕', texthl='', linehl='', numhl=''})
vim.fn.sign_define('DapBreakpointRejected', {text='Ⓡ', texthl='', linehl='', numhl=''})
vim.fn.sign_define('DapLogPoint', {text='Ⓛ', texthl='', linehl='', numhl=''})
EOF
lua << EOF
-- +++++ DAP PYTHON
local dap = require('dap')
dap.adapters.python = {
type = 'executable';
command = 'path/to/virtualenvs/debugpy/bin/python';
args = { '-m', 'debugpy.adapter' };
}
local dap = require('dap')
dap.configurations.python = {
{
-- The first three options are required by nvim-dap
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
request = 'launch';
name = "Launch file";
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
program = "${file}"; -- This configuration will launch the current file if used.
pythonPath = function()
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
return cwd .. '/venv/bin/python'
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
return cwd .. '/.venv/bin/python'
else
return '/usr/bin/python'
end
end;
},
}
local venv = os.getenv("VIRTUAL_ENV")
command = vim.fn.getcwd() .. string.format("%s/bin/python",venv)
-- +++++ DAP JS
EOF
nnoremap <silent> <F5> <Cmd>lua require'dap'.continue()<CR>
nnoremap <silent> <F10> <Cmd>lua require'dap'.step_over()<CR>
nnoremap <silent> <F11> <Cmd>lua require'dap'.step_into()<CR>
nnoremap <silent> <F12> <Cmd>lua require'dap'.step_out()<CR>
nnoremap <silent> <Leader>BB <Cmd>lua require'dap'.toggle_breakpoint()<CR>
nnoremap <silent> <Leader>BC <Cmd>lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
nnoremap <silent> <Leader>lp <Cmd>lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
nnoremap <silent> <Leader>dr <Cmd>lua require'dap'.repl.open()<CR>
nnoremap <silent> <Leader>dl <Cmd>lua require'dap'.run_last()<CR>
" +++++
" CARBON
" Seleccionar texto en modo visual e ingresar el comando :CarbonNowSh, o
" teclear el mapeo
vnoremap <F5> :CarbonNowSh<CR>
" let g:carbon_now_sh_base_url = 'http://localhost:3000'
" let g:carbon_now_sh_browser = 'google-chrome'
" let g:carbon_now_sh_options =
"\ { 'ln': 'true',
" \ 'fm': 'Source Code Pro' }
" +++++
" RENAMER
inoremap <silent> <F2> <cmd>lua require('renamer').rename()<cr>
nnoremap <silent> <leader>nn <cmd>lua require('renamer').rename()<cr>
vnoremap <silent> <leader>nn <cmd>lua require('renamer').rename()<cr>
hi default link RenamerBorder Pmenu
lua << EOF
local mappings_utils = require('renamer.mappings.utils')
require('renamer').setup {
-- The popup title, shown if `border` is true
title = 'Rename',
-- The padding around the popup content
padding = {
top = 0,
left = 0,
bottom = 0,
right = 0,
},
-- The minimum width of the popup
min_width = 15,
-- The maximum width of the popup
max_width = 45,
-- Whether or not to shown a border around the popup
border = true,
-- The characters which make up the border
border_chars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' },
-- Whether or not to highlight the current word references through LSP
show_refs = true,
-- Whether or not to add resulting changes to the quickfix list
with_qf_list = true,
-- Whether or not to enter the new name through the UI or Neovim's `input`
-- prompt
with_popup = true,
-- The keymaps available while in the `renamer` buffer. The example below
-- overrides the default values, but you can add others as well.
mappings = {
['<c-i>'] = mappings_utils.set_cursor_to_start,
['<c-a>'] = mappings_utils.set_cursor_to_end,
['<c-e>'] = mappings_utils.set_cursor_to_word_end,
['<c-b>'] = mappings_utils.set_cursor_to_word_start,
['<c-c>'] = mappings_utils.clear_line,
['<c-u>'] = mappings_utils.undo,
['<c-r>'] = mappings_utils.redo,
},
-- Custom handler to be run after successfully renaming the word. Receives
-- the LSP 'textDocument/rename' raw response as its parameter.
handler = nil,
}
EOF
" +++++
" LIVE-SERVER HTML, CSS, JAVASCRIPT
" iniciar live-server
noremap <leader>ll :Bracey<CR>
" detener live-server
noremap <leader>lq :BraceyStop<CR>
" recargar página
noremap <leader>lr :BraceyReload<CR>
" +++++
" MARKDOWN PREVIEW
" set to 1, nvim will open the preview window after entering the markdown buffer
" default: 0
let g:mkdp_auto_start = 0
" set to 1, the nvim will auto close current preview window when change
" from markdown buffer to another buffer
" default: 1
let g:mkdp_auto_close = 1
" set to 1, the vim will refresh markdown when save the buffer or
" leave from insert mode, default 0 is auto refresh markdown as you edit or
" move the cursor
" default: 0
let g:mkdp_refresh_slow = 0
" set to 1, the MarkdownPreview command can be use for all files,
" by default it can be use in markdown file
" default: 0
let g:mkdp_command_for_global = 0
" set to 1, preview server available to others in your network
" by default, the server listens on localhost (127.0.0.1)
" default: 0
let g:mkdp_open_to_the_world = 0
" use custom IP to open preview page
" useful when you work in remote vim and preview on local browser
" more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9
" default empty
let g:mkdp_open_ip = ''
" specify browser to open preview page
" for path with space
" valid: `/path/with\ space/xxx`
" invalid: `/path/with\\ space/xxx`
" default: ''
let g:mkdp_browser = ''
" set to 1, echo preview page url in command line when open preview page
" default is 0
let g:mkdp_echo_preview_url = 0
" a custom vim function name to open preview page
" this function will receive url as param
" default is empty
let g:mkdp_browserfunc = ''
" options for markdown render
" mkit: markdown-it options for render
" katex: katex options for math
" uml: markdown-it-plantuml options
" maid: mermaid options
" disable_sync_scroll: if disable sync scroll, default 0
" sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle'
" middle: mean the cursor position alway show at the middle of the preview page
" top: mean the vim top viewport alway show at the top of the preview page
" relative: mean the cursor position alway show at the relative positon of the preview page
" hide_yaml_meta: if hide yaml metadata, default is 1
" sequence_diagrams: js-sequence-diagrams options
" content_editable: if enable content editable for preview page, default: v:false
" disable_filename: if disable filename header for preview page, default: 0
let g:mkdp_preview_options = {
\ 'mkit': {},
\ 'katex': {},
\ 'uml': {},
\ 'maid': {},
\ 'disable_sync_scroll': 0,
\ 'sync_scroll_type': 'middle',
\ 'hide_yaml_meta': 1,
\ 'sequence_diagrams': {},
\ 'flowchart_diagrams': {},
\ 'content_editable': v:false,
\ 'disable_filename': 0,
\ 'toc': {}
\ }
" use a custom markdown style must be absolute path
" like '/Users/username/markdown.css' or expand('~/markdown.css')
let g:mkdp_markdown_css = ''
" use a custom highlight style must absolute path
" like '/Users/username/highlight.css' or expand('~/highlight.css')
let g:mkdp_highlight_css = ''
" use a custom port to start server or empty for random
let g:mkdp_port = ''
" preview page title
" ${name} will be replace with the file name
let g:mkdp_page_title = '「${name}」'
" recognized filetypes
" these filetypes will have MarkdownPreview... commands
let g:mkdp_filetypes = ['markdown']
" set default theme (dark or light)
" By default the theme is define according to the preferences of the system
let g:mkdp_theme = 'light'
" example
nmap <leader>mda <Plug>MarkdownPreview
nmap <leader>mdq <Plug>MarkdownPreviewStop
nmap <leader>mdd <Plug>MarkdownPreviewToggle
" +++++
" COLORIZER NEOVIM
lua << EOF
DEFAULT_OPTIONS = {
RGB = true; -- #RGB hex codes
RRGGBB = true; -- #RRGGBB hex codes
names = true; -- "Name" codes like Blue
RRGGBBAA = false; -- #RRGGBBAA hex codes
rgb_fn = false; -- CSS rgb() and rgba() functions
hsl_fn = false; -- CSS hsl() and hsla() functions
css = true; -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = false; -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available modes: foreground, background
mode = 'background'; -- Set the display mode.
}
EOF
" +++++
" BLAMER
let g:blamer_enabled = 1
let g:blamer_delay = 500 " Demora en mostrar el mensaje, dejarlo muy bajo puede ocasionar problemas de rendimiento, por defecto = 1000
let g:blamer_show_in_visual_modes = 1 " blamer en modo visual, por defecto en 1
let g:blamer_show_in_insert_modes = 1 " blamer en modo insertar, por defecto en 1
let g:blamer_prefix = ' > ' " Prefijo que se agregará a la plantilla
" BLAMER template
let g:blamer_template = '<committer>, <committer-time> • <summary> • <committer-mail>' " Opciones disponibles <author>, <author-mail>, <author-time>, <committer>, <committer-mail>, <committer-time>, <summary>, <commit-short>, <commit-long>
" Formato hora
let g:blamer_date_format = '%d/%m/%y %H:%M'
let g:blamer_relative_time = 0 " Muestra la fecha de confirmación en formato relativo, por defecto 0
"color del mensaje
highlight Blamer guifg= lightgrey
" +++++
" RAINBOW_PARENTHESES
let g:rainbow#max_level = 16
let g:rainbow#pairs = [['(', ')'], ['[', ']']]
" List of colors that you do not want. ANSI code or #RRGGBB
let g:rainbow#blacklist = [233, 234]
" +++++
" INDENT-BLANCKLINE
lua << EOF
vim.opt.list = true
vim.opt.listchars:append "space:⋅"
vim.opt.listchars:append "eol:↴"
require("indent_blankline").setup {
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,
}
EOF
" +++++
" AUTOSAVE
lua << EOF
require("auto-save").setup({
enable = true,
execution_message = {
message = function()
return ("Autosave: save at " .. vim.fn.strftime("%H:%M:%S"))
end,
dim = 0.18,
cleaning_interval = 1250,
},
trigger_events = {"InsertLeave", "TextChanged"},
condition = function (buf)
local fn = vim.fn
local utils = require("auto-save.utils.data")
if
fn.getbufvar (buf, "&modifiable") == 1 and
utils.not_in(fn.getbufvar(buf, "&filetype"),{}) then
return true
end
return false
end,
write_all_buffers = false,
debounce_delay = 135,
callbacks = {
enabling = nil,
disabling = nil,
before_asserting_save = nil,
before_saving = nil,
after_saving = nil
}
})
EOF
" +++++
" MODO ZEN
lua << EOF
require("zen-mode").setup {
window = {
backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
-- height and width can be:
-- * an absolute number of cells when > 1
-- * a percentage of the width / height of the editor when <= 1
-- * a function that returns the width or the height
width = 120, -- width of the Zen window
height = 1, -- height of the Zen window
-- by default, no options are changed for the Zen window
-- uncomment any of the options below, or add other vim.wo options you want to apply
options = {
-- signcolumn = "no", -- disable signcolumn
-- number = false, -- disable number column
-- relativenumber = false, -- disable relative numbers
-- cursorline = false, -- disable cursorline
-- cursorcolumn = false, -- disable cursor column
-- foldcolumn = "0", -- disable fold column
-- list = false, -- disable whitespace characters
},
},
plugins = {
-- disable some global vim options (vim.o...)
-- comment the lines to not apply the options
options = {
enabled = true,
ruler = false, -- disables the ruler text in the cmd line area
showcmd = false, -- disables the command in the last line of the screen
},
twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
gitsigns = { enabled = false }, -- disables git signs
tmux = { enabled = false }, -- disables the tmux statusline
-- this will change the font size on kitty when in zen mode
-- to make this work, you need to set the following kitty options:
-- - allow_remote_control socket-only
-- - listen_on unix:/tmp/kitty
kitty = {
enabled = false,
font = "+4", -- font size increment
},
},
-- callback where you can add custom code when the Zen window opens
on_open = function(win)
end,
-- callback where you can add custom code when the Zen window closes
on_close = function()
end,
}
EOF
" +++++
" LSP configuration
lua << EOF
require('nvim-lsp-installer').setup({
automatic_installation = true,
ui = {
icons = {
check_outdated_servers_on_open = true,
server_installed = "✓",
server_pending = "➜",
server_uninstalled = "✗",
border = "|",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
},
},
log_level = vim.log.levels.INFO,
max_concurrent_installers = 4,
github = {
download_url_template = "https://github.com/%s/releases/download/%s/%s",
},
})
EOF
lua << EOF
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
vim.lsp.set_log_level("debug")
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
end
local lsp_flags = {
-- This is the default in Nvim 0.7+
debounce_text_changes = 150,
}
require('lspconfig')['pyright'].setup{
on_attach = on_attach,
flags = lsp_flags,
}
require('lspconfig')['tsserver'].setup{
on_attach = on_attach,
flags = lsp_flags,
}
require('lspconfig')['rust_analyzer'].setup{
on_attach = on_attach,
flags = lsp_flags,
-- Server-specific settings...
settings = {
["rust-analyzer"] = {}
}
}
EOF
" +++++
" TELESCOPE
lua << EOF
require('telescope').setup {
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = " ⌦ ", --
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = {},
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "absolute" },
winblend = 0,
border = {},
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
color_devicons = true,
use_less = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = false, -- 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"
},
media_files = {
filetypes = { "png", "webp", "jpg", "jpeg" },
find_cmd = "rg", -- find command (defaults to `fd`)
},
},
}
EOF
" +++++
" CODI CONFIGURACION
" INTERPRETES CODI (CONFIGURACIONES)
" Documentacion acerca de eso :h codi-configurartion o en https://github.com/metakirby5/codi.vim/blob/master/doc/codi.txt
" PYTHON
let g:codi#interpreters = {
\ 'python': {
\ 'bin': 'python',
\ 'prompt' : '^\(>>>\|\.\.\.\) ',
\ },
\ }
" HASKELL
let g:codi#interpreters = {
\ 'haskell' : {
\ 'prompt' : '^> ',
\ },
\ }
" JAVASCRIPT
let g:codi#interpreters = {
\ 'javascript' : {
\ 'rightalign' : 0,
\ },
\ }
" ALIASES
" Un diccionario de alias de tipo de archivo de intérprete definidos por el usuario. Esto le permite utilizar un intérprete para más de un Tipo de archivo. Por ejemplo, puede crear un alias javascript.jsx para javascript para que se pueda usar el intérprete de JavaScript (nodo) para el tipo de archivo javascript.jsx :
let g:codi#aliases = {
\ 'javascript.jsx' : 'javascript',
\ }
" +++++
" Ejecutar el archivo actual de python
noremap <leader><p :!python3 %<CR>
noremap <leader><j :!node %<CR>