local function on_attach() -- keymaps for lsp vim.api.nvim_set_keymap('n', 'K', ':lua vim.lsp.buf.hover()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vd', ':lua vim.lsp.buf.definition()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vo', ':LspRestart', {noremap = true}) -- diagnostics to move between info and errors vim.api.nvim_set_keymap('n', 'vn', ':lua vim.lsp.diagnostic.goto_next()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vp', ':lua vim.lsp.diagnostic.goto_prev()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vp', ':lua vim.lsp.diagnostic.goto_prev()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vca', ':lua vim.lsp.buf.code_action()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vf', ':lua vim.lsp.buf.formatting()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vi', ':lua vim.lsp.buf.implementation()', {noremap = true}) vim.api.nvim_set_keymap('n', 'vrn', ':lua vim.lsp.buf.rename()', {noremap = true}) -- not sure since when I need signature help cant access this, maybe move to normal, but already have -- the new snippet for the floating -- vim.api.nvim_set_keymap('n', 'vsh', ':lua vim.lsp.buf.signature_help()', {noremap = true}) require "lsp_signature".on_attach() vim.cmd [[au Filetype php setl omnifunc=v:lua.vim.lsp.omnifunc]] vim.cmd [[autocmd FileType go setlocal omnifunc=v:lua.vim.lsp.omnifunc]] vim.g.completion_matching_strategy_list = { 'exact', 'substring', 'fuzzy' } end local lsp_installer = require("nvim-lsp-installer") lsp_installer.on_server_ready(function(server) local opts = {} -- (optional) Customize the options passed to the server if server.name == "emmet_ls" then opts.filetypes = {"html", "css", "blade"} end opts.on_attach = on_attach -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) server:setup(opts) vim.cmd [[ do User LspAttachBuffers ]] end)