diff --git a/init.lua b/init.lua index 60d0586..050d175 100644 --- a/init.lua +++ b/init.lua @@ -75,25 +75,12 @@ require('lazy').setup({ -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', - -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. + -- seems i need this regardless + 'neovim/nvim-lspconfig', { - -- LSP Configuration & Plugins - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, - 'williamboman/mason-lspconfig.nvim', - - -- Useful status updates for LSP - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', tag = 'legacy', opts = {} }, - - -- Additional lua configuration, makes nvim stuff amazing! - -- 'folke/neodev.nvim', - }, + 'williamboman/mason.nvim', config = true }, - + 'williamboman/mason-lspconfig.nvim', { -- Autocompletion 'hrsh7th/nvim-cmp', diff --git a/lua/custom/lspconfig.lua b/lua/custom/lspconfig.lua index c9d0c9b..9833d6b 100644 --- a/lua/custom/lspconfig.lua +++ b/lua/custom/lspconfig.lua @@ -55,7 +55,10 @@ local on_attach = function(_, bufnr) keymap.set("n", "g0", "lua vim.lsp.buf.document_symbol()", opts) keymap.set("n", "gd", "lua vim.lsp.buf.definition()", opts) keymap.set("n", "gi", "lua vim.lsp.buf.implementation()", opts) - keymap.set("n", "l", smart_format, opts) + -- keymap.set("n", "l", smart_format, opts) + keymap.set("n", "l", function() + vim.lsp.buf.format() + end, { desc = "Format code function" }) keymap.set("n", "rn", "lua vim.lsp.buf.rename()", opts) keymap.set( "n", @@ -123,7 +126,7 @@ setup_server("rust_analyzer", { -- PHP LSPs local util = vim.lsp.util -root_dir = function(fname) +local root_dir = function(fname) return util.root_pattern("composer.json", ".git")(fname) or util.path.dirname(fname) end @@ -141,12 +144,13 @@ setup_server("phpactor", { }, }) -vim.lsp.config("lua_ls", { +setup_server("lua_ls", { filetypes = { "lua" }, settings = { Lua = { diagnostics = { - globals = { "vim" } } + globals = { "vim" } }, + format = { enable = true }, } } })