From 3bb469d5bc504dd14c0df22b83dc097eec27952a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D0=BB=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC?= Date: Tue, 2 Jun 2026 14:49:22 +0300 Subject: [PATCH] feat(lsp): Set up vtsls, vue_ls, install miscellaneous plugins --- after/lsp/lua_ls.lua | 24 +++++++++++++++--------- init.lua | 4 ++++ lua/formatting.lua | 14 +++++++++++++- lua/lsp.lua | 19 ++++++++++++++++++- lua/plugins.lua | 7 +++++++ nvim-pack-lock.json | 20 ++++++++++++++++++++ 6 files changed, 77 insertions(+), 11 deletions(-) diff --git a/after/lsp/lua_ls.lua b/after/lsp/lua_ls.lua index cfcb41f..3e265a0 100644 --- a/after/lsp/lua_ls.lua +++ b/after/lsp/lua_ls.lua @@ -1,14 +1,20 @@ ---@type vim.lsp.Config local settings = { - ---@type lspconfig.settings.lua_ls - settings = { - Lua = { - runtime = { - version = 'LuaJIT', - }, - workspace = { checkThirdParty = false, library = vim.list_extend({ vim.fn.expand('$VIMRUNTIME') }, vim.api.nvim_get_runtime_file('lua', true)) }, - }, - }, + ---@type lspconfig.settings.lua_ls + settings = { + Lua = { + hint = { + enable = true, + }, + runtime = { + version = "LuaJIT", + }, + workspace = { + checkThirdParty = false, + library = vim.list_extend({ vim.fn.expand("$VIMRUNTIME") }, vim.api.nvim_get_runtime_file("lua", true)), + }, + }, + }, } return settings diff --git a/init.lua b/init.lua index 3da74a1..4d284cc 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,7 @@ +-- Disable netrw +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + vim.g.mapleader = " " vim.g.localmapleader = " " diff --git a/lua/formatting.lua b/lua/formatting.lua index 58d29dc..61da9af 100644 --- a/lua/formatting.lua +++ b/lua/formatting.lua @@ -2,11 +2,23 @@ local conform = require("conform") ---@type conform.setupOpts local options = { + formatters = { + phpcbf = { + command = "phpcbf", + args = { "-" }, + stdin = true, + exist_codes = { 0, 1 }, + }, + }, formatters_by_ft = { lua = { "stylua" }, + php = { "phpcbf" }, + javascript = { "eslint_d" }, + typescript = { "eslint_d" }, + vue = { "eslint_d" }, }, format_on_save = { - timeout_ms = 500, + timeout_ms = 5000, lsp_format = "fallback", }, } diff --git a/lua/lsp.lua b/lua/lsp.lua index dc00bb2..428294e 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -5,16 +5,33 @@ require("mason-lspconfig").setup({ "lua_ls", "stylua", "intelephense", + "eslint", + "vtsls", + "vue_ls", }, }) + local telescope = require("telescope.builtin") vim.api.nvim_create_autocmd("LspAttach", { - desc = "LSP Keymaps", + desc = "LspAttach", callback = function(args) local bufnr = args.buf local options = { buffer = bufnr } + vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) + vim.diagnostic.config({ + virtual_text = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "\u{F057}", + [vim.diagnostic.severity.WARN] = "\u{F071}", + [vim.diagnostic.severity.HINT] = "\u{F0EB}", + [vim.diagnostic.severity.INFO] = "\u{F05A}", + }, + }, + }) + -- Navigation utils.nmap("gt", telescope.lsp_type_definitions, "Go to Type Definition", options) utils.nmap("gd", telescope.lsp_definitions, "Go to Definition", options) diff --git a/lua/plugins.lua b/lua/plugins.lua index 2cb3ed9..40cfc46 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -21,6 +21,9 @@ vim.pack.add({ -- Code formatting { src = "https://github.com/stevearc/conform.nvim" }, + -- Code linting (non-LSP sources) + { src = "https://github.com/nvimtools/none-ls.nvim" }, + -- Appearance { src = "https://github.com/rose-pine/neovim", name = "rose-pine" }, { src = "https://github.com/nvim-tree/nvim-web-devicons" }, @@ -32,6 +35,10 @@ vim.pack.add({ -- Miscellaneous { src = "https://github.com/windwp/nvim-autopairs" }, { src = "https://github.com/folke/which-key.nvim" }, + { src = "https://github.com/nvim-lualine/lualine.nvim" }, + { src = "https://github.com/nvim-tree/nvim-tree.lua" }, + { src = "https://github.com/tpope/vim-fugitive" }, + { src = "https://github.com/lewis6991/gitsigns.nvim" }, -- WoW Addon API { src = "https://github.com/Tyrannican/warcraft-api.nvim" }, diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json index c5d2eb2..fa92c2d 100644 --- a/nvim-pack-lock.json +++ b/nvim-pack-lock.json @@ -12,6 +12,14 @@ "rev": "619363c30309d29ffa631e67c8183f2a72caa373", "src": "https://github.com/stevearc/conform.nvim" }, + "gitsigns.nvim": { + "rev": "dd3f588bacbeb041be6facf1742e42097f62165d", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, + "lualine.nvim": { + "rev": "221ce6b2d999187044529f49da6554a92f740a96", + "src": "https://github.com/nvim-lualine/lualine.nvim" + }, "mason-lspconfig.nvim": { "rev": "0a695750d747db1e7e70bcf0267ef8951c95fc83", "src": "https://github.com/mason-org/mason-lspconfig.nvim" @@ -20,6 +28,10 @@ "rev": "16ba83bfc8a25f52bb545134f5bee082b195c460", "src": "https://github.com/mason-org/mason.nvim" }, + "none-ls.nvim": { + "rev": "f9d557ac7cd28a3a993b5ea49716498bd540b01f", + "src": "https://github.com/nvimtools/none-ls.nvim" + }, "nvim-autopairs": { "rev": "7b9923abad60b903ece7c52940e1321d39eccc79", "src": "https://github.com/windwp/nvim-autopairs" @@ -28,6 +40,10 @@ "rev": "9573948c38bfabeec353ae7dd7d3ffec4c506a6b", "src": "https://github.com/neovim/nvim-lspconfig" }, + "nvim-tree.lua": { + "rev": "07f541fcaa4a5ae019598240362449ab7e9812b3", + "src": "https://github.com/nvim-tree/nvim-tree.lua" + }, "nvim-web-devicons": { "rev": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c", "src": "https://github.com/nvim-tree/nvim-web-devicons" @@ -52,6 +68,10 @@ "rev": "bb66b815aff01e87b2e26be995116be8d2f91474", "src": "https://github.com/romus204/tree-sitter-manager.nvim" }, + "vim-fugitive": { + "rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0", + "src": "https://github.com/tpope/vim-fugitive" + }, "warcraft-api.nvim": { "rev": "c016bc54ed62bca5058cc3bd7553e429dd8caf37", "src": "https://github.com/Tyrannican/warcraft-api.nvim"