From 7f74e0d873a4fee2ea042487574a98c4f40eeca6 Mon Sep 17 00:00:00 2001 From: fabianmolinab Date: Sun, 23 Apr 2023 16:45:22 -0500 Subject: [PATCH] feat(*): Cambiaron los archivos de vim a lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Se hicieron cambios en los archivos de configuración, temas y atajos de teclado de lua a vim Ref: #34 --- general/colors.lua | 13 +++ general/colors.vim | 52 --------- general/keys.lua | 101 +++++++++++++++++ general/keys.vim | 103 ------------------ general/settings.lua | 39 +++++++ general/settings.vim | 61 ----------- general/status-line.vim | 61 ----------- init.vim | 16 ++- plug-settings/blamer.vim | 6 - plug-settings/cmp.lua | 98 +++++++++++++++++ plug-settings/easy-motion.lua | 1 + plug-settings/easy-motion.vim | 2 - plug-settings/{lsp.vim => lsp.lua} | 89 ++++++++------- plug-settings/nvim-cmp.vim | 101 ----------------- .../{web-devicons.vim => web-devicons.lua} | 6 +- plug.vim | 3 - 16 files changed, 305 insertions(+), 447 deletions(-) create mode 100644 general/colors.lua delete mode 100644 general/colors.vim create mode 100644 general/keys.lua delete mode 100644 general/keys.vim create mode 100644 general/settings.lua delete mode 100644 general/settings.vim delete mode 100644 general/status-line.vim delete mode 100644 plug-settings/blamer.vim create mode 100644 plug-settings/cmp.lua create mode 100644 plug-settings/easy-motion.lua delete mode 100644 plug-settings/easy-motion.vim rename plug-settings/{lsp.vim => lsp.lua} (70%) delete mode 100644 plug-settings/nvim-cmp.vim rename plug-settings/{web-devicons.vim => web-devicons.lua} (80%) diff --git a/general/colors.lua b/general/colors.lua new file mode 100644 index 0000000..56865d5 --- /dev/null +++ b/general/colors.lua @@ -0,0 +1,13 @@ +-- Habilitar syntax highlighting +vim.cmd('syntax on') + +-- Configurar termguicolors y background +vim.opt.termguicolors = true +vim.opt.background = 'dark' + +-- Configurar cursorline y cursorlineopt +vim.opt.cursorline = true +vim.opt.cursorlineopt = 'number' + +-- Configurar menú de autocompletado +vim.cmd('highlight Pmenu guifg=#dee1e4 guibg=none') diff --git a/general/colors.vim b/general/colors.vim deleted file mode 100644 index 086b4ca..0000000 --- a/general/colors.vim +++ /dev/null @@ -1,52 +0,0 @@ -"the most basic configurations -syntax on - -set termguicolors -set background=dark - - "hi SignColumn guibg=none - "hi CursorLineNR guibg=none - "highlight Normal guibg=none - "highlight LineNr guifg=#677693 - "highlight netrwDir guifg=#677693 - "highlight qfFileName guifg=#aed75f -"hi CursorLineNR guifg=#F99575 -set cursorline -set cursorlineopt=number - -"Menu autocompletado -highlight Pmenu guifg=#dee1e4 guibg=none -"highlight PmenuSel guibg=#FAB795 guifg=black - -"Coc Error Color -"hi! CocErrorSign guifg=#9D2B25 - -" TSX sintax -" dark red -"hi tsxTagName guifg=#FAB795 -"hi tsxComponentName guifg=#2DC3DA cterm=italic -"hi tsxCloseComponentName guifg=#84EEA2 cterm=italic - -" orange -"hi tsxCloseString guifg=#F99575 -"hi tsxCloseTag guifg=#84EEA2 -"hi tsxCloseTagName guifg=#84EEA2 -"hi tsxAttributeBraces guifg=#C14A4A -"hi tsxEqual guifg=#84EEA2 - -" yellow -"hi tsxAttrib guifg=#2DC3DA cterm=italic - -" light-grey -"hi tsxTypeBraces guifg=#2DC3DA cterm=italic -" dark-grey -"hi tsxTypes guifg=#2DC3DA cterm=italic - -"hi ReactState guifg=#C14A4A cterm=italic -"hi ReactProps guifg=#FAB795 -""hi ApolloGraphQL guifg=#CB886B -"hi Events ctermfg=204 guifg=#2DC3DA -"hi ReduxKeywords ctermfg=204 guifg=#C678DD -"hi ReduxHooksKeywords ctermfg=204 guifg=#C176A7 -"hi WebBrowser ctermfg=204 guifg=#2DC3DA -"hi ReactLifeCycleMethods ctermfg=204 guifg=#D19A66 diff --git a/general/keys.lua b/general/keys.lua new file mode 100644 index 0000000..dc6b047 --- /dev/null +++ b/general/keys.lua @@ -0,0 +1,101 @@ +-- Deshabilita la navegación con las flechas +vim.api.nvim_set_keymap('n', '', '', { noremap = true }) +vim.api.nvim_set_keymap('n', '', '', { noremap = true }) +vim.api.nvim_set_keymap('n', '', '', { noremap = true }) +vim.api.nvim_set_keymap('n', '', '', { noremap = true }) + +-- Las flechas reasignan el ancho y alto de la ventana +vim.api.nvim_set_keymap('n', '', ':vertical resize +5', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':vertical resize -5', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':resize +5', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':resize -5', { noremap = true, silent = true }) + +-- Configuración archivos +vim.api.nvim_set_keymap('n', 'w', ':w', { noremap = true }) +vim.api.nvim_set_keymap('n', 'q', ':q', { noremap = true }) +vim.api.nvim_set_keymap('n', 'Q', ':q!', { noremap = true }) + +-- Salir del modo Insert +vim.api.nvim_set_keymap('i', 'jj', '', { noremap = true }) + +-- Salir del modo terminal +vim.api.nvim_set_keymap('t', '', '', { noremap = true }) + +-- NERDTree +vim.api.nvim_set_keymap('n', '', '(NERDTermToggle)', { noremap = true }) +vim.api.nvim_set_keymap('t', '', '(NERDTermToggle)', { noremap = true }) + +-- Easy Motion +vim.api.nvim_set_keymap('n', 'f', '(easymotion-s2)', {}) + +-- Navegación con Tmux +vim.api.nvim_set_keymap('n', '', ':TmuxNavigateLeft', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':TmuxNavigateDown', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':TmuxNavigateUp', { noremap = true, silent = true }) +vim.api.nvim_set_keymap('n', '', ':TmuxNavigateRight', { noremap = true, silent = true }) + +-- Navegación entre buffers +vim.api.nvim_set_keymap('n', '', ':bnext', {noremap = true}) +vim.api.nvim_set_keymap('n', '', ':bprevious', {noremap = true}) + +-- Cerrar buffer y cerrar buffer sin guardar +vim.api.nvim_set_keymap('n', 'qq', ':bdelete', {noremap = true}) +vim.api.nvim_set_keymap('n', 'qb', ':bdelete!', {noremap = true}) +vim.api.nvim_set_keymap('n', 't', ':tabe', {noremap = true}) + +-- Vertical split +vim.api.nvim_set_keymap('n', 'vs', ':vsp', {noremap = true}) +-- Horizontal split +vim.api.nvim_set_keymap('n', 'sp', ':sp', {noremap = true}) + +-- Limpiar los resultados de búsqueda +vim.api.nvim_set_keymap('n', '//', ':noh', {silent = true}) + +-- Telescope +-- Buscar archivos +vim.api.nvim_set_keymap('n', 'f', 'lua require(\'telescope.builtin\').find_files()', {noremap = true}) +-- Buscar dentro del proyecto cualquier palabra +vim.api.nvim_set_keymap('n', 'a', 'lua require(\'telescope.builtin\').live_grep()', {noremap = true}) +vim.api.nvim_set_keymap('n', 'mf', 'lua require(\'telescope.builtin\').marks()', {noremap = true}) +-- Lista de commits +vim.api.nvim_set_keymap('n', 'ls', 'lua require(\'telescope.builtin\').git_commits()', {noremap = true}) +-- Buscar archivos de git +vim.api.nvim_set_keymap('n', 'ag', 'lua require(\'telescope.builtin\').git_files()', {noremap = true}) +-- Lista los archivos o ventanas cerradas +vim.api.nvim_set_keymap('n', 'of', 'lua require(\'telescope.builtin\').oldfiles()', {noremap = true}) +-- Lista buffers o pestañas abiertos +vim.api.nvim_set_keymap('n', 'b', 'lua require(\'telescope.builtin\').buffers()', {noremap = true}) + +-- Todo Busqueda telescope +vim.api.nvim_set_keymap('n', 'td', ':TodoTelescope', {}) + +-- Modo Visual indent +vim.api.nvim_set_keymap('v', '<', '', '>gv', {silent = true}) + +-- Git Diff View +vim.api.nvim_set_keymap('n', 'df', ':DiffviewOpen', {noremap = true}) +vim.api.nvim_set_keymap('n', 'dx', ':DiffviewClose', {noremap = true}) + +-- Git Stage hunk: Para agregar a stage lineas de cambios individuales o al contrario +vim.api.nvim_set_keymap('n', 'hs', ':Gitsigns stage_hunk', { noremap = true }) +vim.api.nvim_set_keymap('n', 'hu', ':Gitsigns undo_stage_hunk', { noremap = true }) + +-- Git Stage lines +vim.api.nvim_set_keymap('v', 'hs', ':Gitsigns stage_hunk', { noremap = true }) +vim.api.nvim_set_keymap('n', 'hu', ':Gitsigns undo_stage_hunk', { noremap = true }) + +-- GitSigns Preview: "Muestra una previsualización de los cambios entre lineas +vim.api.nvim_set_keymap('n', 'hj', ':Gitsigns preview_hunk', { noremap = true }) + +-- Debuger +vim.api.nvim_set_keymap('n', 'db', ':DapToggleBreakpoint', { noremap = true }) -- Punto de espera +vim.api.nvim_set_keymap('n', 'dc', ':DapContinue', { noremap = true }) -- Lanzar debugger +vim.api.nvim_set_keymap('n', 'ds', ':DapTerminate', { noremap = true }) -- Detener debuger + +-- Lanzar y cierra interfaz debugger +vim.api.nvim_set_keymap('n', 'du', ':lua require("dapui").toggle()', { noremap = true }) + +-- Neotree +vim.api.nvim_set_keymap('n', 'p', ':NeoTreeFocusToggle', { noremap = true }) +vim.api.nvim_set_keymap('n', 'g', ':NeoTreeFocusToggle git_status', { noremap = true }) diff --git a/general/keys.vim b/general/keys.vim deleted file mode 100644 index 3e77df3..0000000 --- a/general/keys.vim +++ /dev/null @@ -1,103 +0,0 @@ -"Use F5 to refresh your editor with the config file that you specify here -nmap :source ~/.config/nvim/init.vim -vmap :source ~/.config/nvim/init.vim - -"Desabilita la navegación con las flechas -noremap -noremap -noremap -noremap - -"Las fechas reasignan el ancho y alto de la ventana -nnoremap :vertical resize +5 -nnoremap :vertical resize -5 -nnoremap :resize +5 -nnoremap :resize -5 - -"Configuración archivos -nnoremap w :w -nnoremap q :q -nnoremap Q :q! - -"Salir del modo Insert -imap jj - -tmap - -nmap (NERDTermToggle) -tmap (NERDTermToggle) - -" Easy Motion -noremap f (easymotion-s2) - -" Navegación con Tmux -nnoremap :TmuxNavigateLeft -nnoremap :TmuxNavigateDown -nnoremap :TmuxNavigateUp -nnoremap :TmuxNavigateRight - -nnoremap :bnext -nnoremap :bprevious - -"Cerra buffer y cerrar buffer sin guardar -nnoremap qq :bdelete -nnoremap qb :bdelete! -nnoremap t :tabe - -"vertical split -"horizontal split -nnoremap vs :vsp -nnoremap sp :sp - -" Limpiar los resultados de busqueda -nnoremap // :noh - -"----Telescope -"Buscar archivos - nnoremap f lua require('telescope.builtin').find_files() - "Buscar dentro del projecto cualquier palabra - nnoremap a lua require('telescope.builtin').live_grep() - - nnoremap mf lua require('telescope.builtin').marks() - "Lista de commits - nnoremap ls lua require('telescope.builtin').git_commits() - "Buscar archivos de git - nnoremap ag lua require('telescope.builtin').git_files() - "Lista los archivos o ventanas cerradas - nnoremap of lua require('telescope.builtin').oldfiles() - "Lista buffers o pestañas abiertos - nnoremap b lua require('telescope.builtin').buffers() -"---------- -"Todo Busqueda telescope -nmap td :TodoTelescope - -"Modo Visual indent -vmap < > >gv - -"Git Diff View -nnoremap df :DiffviewOpen -nnoremap dx :DiffviewClose - -"Git Stage hunk: Para agregar a stage lineas de cambios individuales o al contrario -nnoremap hs :Gitsigns stage_hunk -nnoremap hu :Gitsigns undo_stage_hunk - -"Git Stage lines -vnoremap hs :Gitsigns stage_hunk -nnoremap hu :Gitsigns undo_stage_hunk - -"GitSigns Preview: "Muestra una previsualización de los cambios entre lineas -nnoremap hj :Gitsigns preview_hunk - -"Debuger -nmap db :DapToggleBreakpoint "Punto de espera -nmap dc :DapContinue "Lanzar debugger -nmap ds :DapTerminate "Detener debuger - -"Lanzar y cierra interfaz debugger -nmap du :lua require("dapui").toggle() - -"Neotree -nnoremap p :NeoTreeFocusToggle -nnoremap g :NeoTreeFocusToggle git_status diff --git a/general/settings.lua b/general/settings.lua new file mode 100644 index 0000000..288d531 --- /dev/null +++ b/general/settings.lua @@ -0,0 +1,39 @@ +-- Establece el map leader +vim.g.mapleader = " " + +-- Configuraciones generales +vim.o.encoding = "utf-8" +vim.o.mouse = "" +vim.o.clipboard = "unnamedplus" +vim.o.errorbells = false +vim.o.list = false +vim.o.cmdheight = 1 +vim.o.sw = 2 +vim.o.expandtab = true +vim.o.smartindent = true +vim.o.breakindent = true +vim.o.number = true +vim.o.rnu = true +vim.o.numberwidth = 2 +vim.o.swapfile = false +vim.o.backup = false +vim.o.undodir = "~/.config/nvim/.undodir/" +vim.o.undofile = true +vim.o.incsearch = true +vim.o.ignorecase = true +vim.o.cursorline = true +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.showmode = false + +-- Configuración para archivos JSX grandes +vim.api.nvim_command('autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart') +vim.api.nvim_command('autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear') + +-- Configuración para formatear con Eslint +vim.api.nvim_command('autocmd BufRead,BufNewFile *.astro set filetype=astro') +vim.api.nvim_command('autocmd BufWritePre *.js,*.jsx,*.ts,*.tsx,*.astro EslintFixAll') + +-- Configuración de altura de ventanas flotantes +vim.o.pumheight = 6 +vim.o.cmdwinheight = 6 diff --git a/general/settings.vim b/general/settings.vim deleted file mode 100644 index 7d7420c..0000000 --- a/general/settings.vim +++ /dev/null @@ -1,61 +0,0 @@ -"set the map leader -let mapleader = " " - -set encoding=utf-8 -set mouse= -set clipboard=unnamedplus -"set clipboard=unnamedplus -set noerrorbells -set nolist -set cmdheight=1 -set sw=2 -set expandtab -set smartindent -set breakindent -set number -set rnu -set numberwidth=2 -set noswapfile -set nobackup -set undodir=~/.config/nvim/.undodir/ -set undofile -set incsearch -set ignorecase -set cursorline -set splitbelow -set splitright -set noshowmode - -"Habilita el Buffer para archivos grandes de JSX -autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart -autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear - -"autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescriptreact - -"---formatear con Eslint - autocmd BufRead,BufNewFile *.astro set filetype=astro - autocmd BufWritePre *.js,*.jsx,*.ts,*.tsx,*.astro EslintFixAll -"----- - -"---formatear archivos de go con GoFmt al guardar - augroup go - autocmd! - autocmd BufWritePre *.go :silent! GoFmt - "Esta linea formatea los archivos de go con una identacion de 4 espacios - "autocmd FileType go setlocal shiftwidth=4 softtabstop=4 tabstop=4 expandtab - augroup END -"------ - -lua </dev/null | tr -d '\n'") -endfunction - -function! StatuslineGit() - let l:branchname = GitBranch() - return strlen(l:branchname) > 0?' '.l:branchname.' ':'' -endfunction - -set laststatus=2 -set noshowmode -set statusline= -set statusline+=%0*\ %n\ " Buffer number - -set statusline+=%1*\ %<%F%m%r%h%w\ " File path, modified, readonly, helpfile, preview - -set statusline+=%#LineNr# -"set statusline+=\ %t -set statusline+=%= " Right Side -set statusline+=%{StatuslineGit()} -"set statusline+=%2*\ col:\ %02v\ " Column number -set statusline+=%1*\ \ %02l/%L\ (%3p%%)\ " Line number / total lines, percentage of document -set statusline+=%0*\ %{toupper(g:currentmode[mode()])}\ " The current mode - -hi User1 ctermfg=007 ctermbg=239 guibg=#4e4e4e guifg=#adadad -hi User2 ctermfg=007 ctermbg=236 guibg=#303030 guifg=#adadad -hi User3 ctermfg=236 ctermbg=236 guibg=#303030 guifg=#303030 -hi User4 ctermfg=239 ctermbg=239 guibg=#4e4e4e guifg=#4e4e4e diff --git a/init.vim b/init.vim index 0406e0a..5950f53 100644 --- a/init.vim +++ b/init.vim @@ -1,26 +1,24 @@ " First list plugins to install source ~/.config/nvim/plug.vim -"source ~/.config/nvim/general/status-line.vim "Import the general settings -source ~/.config/nvim/general/settings.vim -source ~/.config/nvim/general/keys.vim +source ~/.config/nvim/general/settings.lua +source ~/.config/nvim/general/keys.lua "Theme source ~/.config/nvim/themes/zenbones.lua -source ~/.config/nvim/general/colors.vim +source ~/.config/nvim/general/colors.lua "Import plugin settings -source ~/.config/nvim/plug-settings/easy-motion.vim -source ~/.config/nvim/plug-settings/web-devicons.vim +source ~/.config/nvim/plug-settings/easy-motion.lua +source ~/.config/nvim/plug-settings/web-devicons.lua "LSP source ~/.config/nvim/plug-settings/mason.lua -source ~/.config/nvim/plug-settings/lsp.vim -source ~/.config/nvim/plug-settings/nvim-cmp.vim +source ~/.config/nvim/plug-settings/lsp.lua +source ~/.config/nvim/plug-settings/cmp.lua source ~/.config/nvim/plug-settings/lspkind.lua -"Lua Configs Plugins "source ~/.config/nvim/plug-settings/bufferline.lua source ~/.config/nvim/plug-settings/lualine.lua source ~/.config/nvim/plug-settings/autopairs.lua diff --git a/plug-settings/blamer.vim b/plug-settings/blamer.vim deleted file mode 100644 index b43efa0..0000000 --- a/plug-settings/blamer.vim +++ /dev/null @@ -1,6 +0,0 @@ -let g:blamer_enabled = 1 -let g:blamer_show_in_insert_modes = 0 -let g:blamer_show_in_visual_modes = 0 -highlight Blamer guifg=#434C5E -let g:blamer_template = '{} []' -let g:blamer_date_format = '%d/%m/%y' diff --git a/plug-settings/cmp.lua b/plug-settings/cmp.lua new file mode 100644 index 0000000..79df90c --- /dev/null +++ b/plug-settings/cmp.lua @@ -0,0 +1,98 @@ +vim.o.completeopt = "menu,menuone,noselect" + +local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +local cmp = require'cmp' +local lspkind = require'lspkind' +local luasnip = require'luasnip' +local cmp_buffer = require'cmp_buffer' + +cmp.setup({ + performance = { debounce = 300, throttle = 40 }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + window = { + documentation = cmp.config.window.bordered(), + }, + completion = { keyword_length = 1 }, + formatting = { + fields = { "abbr", "kind" }, + format = require("lspkind").cmp_format({ + mode = "symbol_text", + }), + }, + sources = { + {name = 'path'}, + {name = 'nvim_lsp' }, + {name = 'buffer' }, + {name = 'luasnip'}, + {name= 'cmp_tabnine'}, + }, + mapping = { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + + --- Tab tigger seleccion + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { 'i', 'c' }), + + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 'c' }), + }, +}) + +-- 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' }, + { max_item_count = 10 }, + }) +}) + +-- Use buffer source for `/` (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' } + }) +}) + +vim.cmd [[highlight! default link CmpItemKind CmpItemMenuDefault]] + diff --git a/plug-settings/easy-motion.lua b/plug-settings/easy-motion.lua new file mode 100644 index 0000000..3ae0f2d --- /dev/null +++ b/plug-settings/easy-motion.lua @@ -0,0 +1 @@ +vim.g.EasyMotion_smartcase = 1 diff --git a/plug-settings/easy-motion.vim b/plug-settings/easy-motion.vim deleted file mode 100644 index 7358056..0000000 --- a/plug-settings/easy-motion.vim +++ /dev/null @@ -1,2 +0,0 @@ -"easymotion -let g:EasyMotion_smartcase = 1 diff --git a/plug-settings/lsp.vim b/plug-settings/lsp.lua similarity index 70% rename from plug-settings/lsp.vim rename to plug-settings/lsp.lua index 3ed88c5..cce0e9c 100644 --- a/plug-settings/lsp.vim +++ b/plug-settings/lsp.lua @@ -1,10 +1,9 @@ -lua << EOF --LSP Instaler local nvim_lsp = require('lspconfig') -- Set up completion using nvim_cmp with LSP source local capabilities = require('cmp_nvim_lsp').default_capabilities( - vim.lsp.protocol.make_client_capabilities() +vim.lsp.protocol.make_client_capabilities() ) capabilities.textDocument.completion.completionItem.snippetSupport = true @@ -25,12 +24,12 @@ local on_attach = function(client, bufnr) -- 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', 'el', vim.diagnostic.setloclist, bufopts) - vim.keymap.set('n', 'er', vim.diagnostic.open_float, bufopts) - end + 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', 'el', vim.diagnostic.setloclist, bufopts) + vim.keymap.set('n', 'er', vim.diagnostic.open_float, bufopts) +end local lsp_flags = { -- This is the default in Nvim 0.7+ @@ -41,13 +40,13 @@ local lsp_flags = { --Typescript, Javascript, JSX, TSX require('lspconfig')['tsserver'].setup{ - capabilities = capabilities, - on_attach = on_attach, - flags = lsp_flags, + capabilities = capabilities, + on_attach = on_attach, + flags = lsp_flags, } --Go Server - require'lspconfig'.gopls.setup{ +require'lspconfig'.gopls.setup{ on_attach = on_attach, capabilities = capabilities, flags = lsp_flags, @@ -79,13 +78,13 @@ require('lspconfig')['cssls'].setup { }, settings = { css = { - validate = true - }, + validate = true + }, less = { validate = true }, scss = { - validate = true + validate = true } }, single_file_support = true, @@ -109,9 +108,9 @@ require('lspconfig')['lua_ls'].setup{} --ESLINT Server Config require("lspconfig").eslint.setup({ - on_attach = on_attach, - flags = lsp_flags, - settings = { format = false }, + on_attach = on_attach, + flags = lsp_flags, + settings = { format = false }, }) --- StyleLint Config @@ -122,11 +121,11 @@ require('lspconfig')['stylelint_lsp'].setup{ handlers = handlers, on_attach = on_attach, settings = { - autoFixOnSave = true, - autoFixOnFormat = true, - validateOnType = true - -- other settings... - } + autoFixOnSave = true, + autoFixOnFormat = true, + validateOnType = true + -- other settings... + } } --JSON Lenguaje @@ -137,27 +136,25 @@ require('lspconfig')['jsonls'].setup{ -- Tailwind -- require("lspconfig").tailwindcss.setup({ - -- on_attach = on_attach, + -- on_attach = on_attach, -- flags = lsp_flags, - -- capabilities = capabilities, - --}) - ---LSP Colors -require("lsp-colors").setup({ - Error = "#db4b4b", - Warning = "#e0af68", - Information = "#0db9d7", - Hint = "#10B981" -}) - --- Errors hover LSP -vim.diagnostic.config({ - underline = true, - virtual_text = false, - update_in_insert = false -}) - --- Show line diagnostics automatically in hover window -vim.o.updatetime = 250 - -EOF + -- capabilities = capabilities, + --}) + + --LSP Colors + require("lsp-colors").setup({ + Error = "#db4b4b", + Warning = "#e0af68", + Information = "#0db9d7", + Hint = "#10B981" + }) + + -- Errors hover LSP + vim.diagnostic.config({ + underline = true, + virtual_text = false, + update_in_insert = false + }) + + -- Show line diagnostics automatically in hover window + vim.o.updatetime = 250 diff --git a/plug-settings/nvim-cmp.vim b/plug-settings/nvim-cmp.vim deleted file mode 100644 index af96db5..0000000 --- a/plug-settings/nvim-cmp.vim +++ /dev/null @@ -1,101 +0,0 @@ -set completeopt=menu,menuone,noselect - -lua <'] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), - - --- Tab tigger seleccion - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { 'i', 'c' }), - - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 'c' }), - }, - }) - - -- 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' }, - { max_item_count = 10 }, - }) - }) - - -- Use buffer source for `/` (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' } - }) - }) - - vim.cmd [[highlight! default link CmpItemKind CmpItemMenuDefault]] -EOF - diff --git a/plug-settings/web-devicons.vim b/plug-settings/web-devicons.lua similarity index 80% rename from plug-settings/web-devicons.vim rename to plug-settings/web-devicons.lua index e06c725..eda598b 100644 --- a/plug-settings/web-devicons.vim +++ b/plug-settings/web-devicons.lua @@ -1,6 +1,7 @@ -if !exists('g:loaded_devicons') | finish | endif +if vim.g.loaded_devicons == nil then + return +end -lua << EOF require'nvim-web-devicons'.setup { -- your personnal icons can go here (to override) -- DevIcon will be appended to `name` @@ -10,4 +11,3 @@ require'nvim-web-devicons'.setup { -- will get overriden by `get_icons` option default = true; } -EOF diff --git a/plug.vim b/plug.vim index 8b95851..b0c3436 100644 --- a/plug.vim +++ b/plug.vim @@ -106,9 +106,6 @@ if has("nvim") Plug 'mrjones2014/nvim-ts-rainbow' - "Inspirado en Git Lens de VS Code - "Plug "APZelos/blamer.nvim" - "Colorea los comentarios en forma de TODO: Plug 'folke/todo-comments.nvim' "------------