From 5e62f0a6b2d506c0daf7bd59ff2c23bbdc8d3a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Monroy=20Dom=C3=ADnguez?= Date: Wed, 23 Jul 2025 13:41:45 -0600 Subject: [PATCH] Versionado --- init.lua | 66 +++++++++++++++++++++++++---- lua/custom/plugins/copilot.lua | 19 +++++++++ lua/custom/plugins/intelephense.lua | 14 ++++++ lua/custom/plugins/laravel.lua | 30 +++++++++++++ lua/kickstart/plugins/neo-tree.lua | 2 +- lua/lsp/init.lua | 32 ++++++++++++++ 6 files changed, 154 insertions(+), 9 deletions(-) create mode 100644 lua/custom/plugins/copilot.lua create mode 100644 lua/custom/plugins/intelephense.lua create mode 100644 lua/custom/plugins/laravel.lua create mode 100644 lua/lsp/init.lua diff --git a/init.lua b/init.lua index b98ffc6198a..d151afa6c1e 100644 --- a/init.lua +++ b/init.lua @@ -166,6 +166,9 @@ vim.o.scrolloff = 10 -- See `:help 'confirm'` vim.o.confirm = true +-- Relative numbers in the quickfix window +vim.o.relativenumber = true + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -572,6 +575,9 @@ require('lazy').setup({ -- the definition of its *type*, not where it was *defined*. map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- Jump to the definition of the word under your cursor. + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) ---@param client vim.lsp.Client ---@param method vim.lsp.protocol.Method @@ -661,6 +667,37 @@ require('lazy').setup({ -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. local capabilities = require('blink.cmp').get_lsp_capabilities() + local vue_language_server_path = vim.fn.stdpath 'data' .. '/mason/packages/vue-language-server/node_modules/@vue/language-server' + + vim.notify('Setting up Vue Language Server at ' .. vue_language_server_path, vim.log.levels.INFO, { + title = 'Kickstart.nvim', + }) + + local vue_plugin = { + name = '@vue/typescript-plugin', + location = vue_language_server_path, + languages = { 'vue' }, + configNamespace = 'typescript', + } + + vim.lsp.enable 'vtsls' + + vim.lsp.config('vtsls', { + settings = { + vtsls = { + tsserver = { + globalPlugins = { + vue_plugin, + }, + }, + }, + }, + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, + }) + + -- (Opcional) vue-language-server para otras funcionalidades + vim.lsp.config('vue_ls', {}) + -- Enable the following language servers -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. -- @@ -714,14 +751,18 @@ require('lazy').setup({ -- You can add other tools here that you want Mason to install -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'vtsls', -- Vetur Language Server for Vue + 'vue-language-server', -- Vue Language Server }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('mason-lspconfig').setup { ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, + automatic_installation = true, handlers = { function(server_name) local server = servers[server_name] or {} @@ -772,7 +813,9 @@ require('lazy').setup({ -- python = { "isort", "black" }, -- -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + -- Formato de Vue con prettierd + vue = { 'prettierd' }, }, }, }, @@ -854,9 +897,16 @@ require('lazy').setup({ }, sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, + default = { 'lsp', 'path', 'snippets', 'lazydev', 'copilot' }, providers = { lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, + -- Integración de Copilot con Blink.cmp, para evitar las letras grises + copilot = { + name = 'copilot', + module = 'blink-cmp-copilot', + score_offset = 100, + async = true, + }, }, }, @@ -944,7 +994,7 @@ require('lazy').setup({ main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'php', 'javascript', 'vue' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -976,15 +1026,15 @@ require('lazy').setup({ -- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.indent_line', -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000000..a7f44a41c5f --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,19 @@ +return { + -- GitHub Copilot backend (sin ghost text ni panel) + { + 'zbirenbaum/copilot.lua', + event = 'InsertEnter', + config = function() + require('copilot').setup { + suggestion = { enabled = false }, -- ✅ no ghost text + panel = { enabled = false }, -- ✅ no panel + } + end, + }, + + -- Integración con blink.cmp + { + 'giuxtaposition/blink-cmp-copilot', + dependencies = { 'zbirenbaum/copilot.lua' }, + }, +} diff --git a/lua/custom/plugins/intelephense.lua b/lua/custom/plugins/intelephense.lua new file mode 100644 index 00000000000..1ed1c0d066e --- /dev/null +++ b/lua/custom/plugins/intelephense.lua @@ -0,0 +1,14 @@ +return { + require('lspconfig').intelephense.setup { + settings = { + intelephense = { + environment = { + phpVersion = '8.3', + }, + files = { + maxSize = 5000000, + }, + }, + }, + }, +} diff --git a/lua/custom/plugins/laravel.lua b/lua/custom/plugins/laravel.lua new file mode 100644 index 00000000000..5fe4ea55bd3 --- /dev/null +++ b/lua/custom/plugins/laravel.lua @@ -0,0 +1,30 @@ +return { + 'adalessa/laravel.nvim', + dependencies = { + 'tpope/vim-dotenv', + 'nvim-telescope/telescope.nvim', + 'MunifTanjim/nui.nvim', + 'kevinhwang91/promise-async', + }, + cmd = { 'Laravel' }, + keys = { + { 'la', ':Laravel artisan' }, + { 'lr', ':Laravel routes' }, + { 'lm', ':Laravel related' }, + { + 'gf', + function() + if require('laravel').app('gf').cursor_on_resource() then + return 'Laravel gf' + else + return 'gf' + end + end, + noremap = false, + expr = true, + }, + }, + event = { 'VeryLazy' }, + opts = {}, + config = true, +} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index c7067891df0..690cec415f6 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -11,7 +11,7 @@ return { }, lazy = false, keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, + { '', ':Neotree toggle', desc = 'NeoTree toggle', silent = true }, }, opts = { filesystem = { diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua new file mode 100644 index 00000000000..c6870ae3095 --- /dev/null +++ b/lua/lsp/init.lua @@ -0,0 +1,32 @@ +print '✅ lsp/init.lua cargado correctamente' +vim.notify('✅ LSP init.lua cargado', vim.log.levels.INFO) + +local lspconfig = require 'lspconfig' +local capabilities = require('cmp_nvim_lsp').default_capabilities() + +local vue_language_server_path = vim.fn.stdpath 'data' .. '/mason/packages/vue-language-server/node_modules/@vue/language-server' + +local vue_plugin = { + name = '@vue/typescript-plugin', + location = vue_language_server_path, + languages = { 'vue' }, + configNamespace = 'typescript', +} + +lspconfig.vtsls.setup('vtsls', { + settings = { + vtsls = { + tsserver = { + globalPlugins = { + vue_plugin, + }, + }, + }, + }, + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, +}) + +-- ✅ (Opcional) vue-language-server para otras funcionalidades +lspconfig.vue_ls.setup { + capabilities = capabilities, +}