From 669561e21073e6efafddda25ba3ace69fb43819e Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Tue, 31 Jan 2023 09:44:13 +0100 Subject: feat: apply stylua --- lua/alpha/lsp/attach.lua | 49 ++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'lua/alpha/lsp/attach.lua') diff --git a/lua/alpha/lsp/attach.lua b/lua/alpha/lsp/attach.lua index ce63e02..fa67b2e 100644 --- a/lua/alpha/lsp/attach.lua +++ b/lua/alpha/lsp/attach.lua @@ -1,29 +1,34 @@ -local telescope_mapper = require("alpha.telescope.mappings") +local telescope_mapper = require "alpha.telescope.mappings" local filetype_attach = setmetatable({}, { - __index = function() - return function() end - end, + __index = function() + return function() end + end, }) -return function (client, bufnr) - local filetype = vim.api.nvim_buf_get_option(0, "filetype") - -- keymaps for lsp - vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 }) - vim.keymap.set("n", "vrn", vim.lsp.buf.rename, { buffer = 0 }) - vim.keymap.set("i", "", vim.lsp.buf.signature_help, { buffer = 0 }) - vim.keymap.set("n", "vo", ":LspRestart", { noremap = true }) - vim.keymap.set({ "n", "v" }, "vca", vim.lsp.buf.code_action, {}) - vim.keymap.set("n", "vf", function() - return vim.lsp.buf.format({ async = true }) - end, {}) +return function(client, bufnr) + local filetype = vim.api.nvim_buf_get_option(0, "filetype") + -- keymaps for lsp + vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = 0 }) + vim.keymap.set("n", "vrn", vim.lsp.buf.rename, { buffer = 0 }) + vim.keymap.set("i", "", vim.lsp.buf.signature_help, { buffer = 0 }) + vim.keymap.set("n", "vo", ":LspRestart", { noremap = true }) + vim.keymap.set({ "n", "v" }, "vca", vim.lsp.buf.code_action, {}) + vim.keymap.set("n", "vf", function() + return vim.lsp.buf.format { + async = true, + filter = function(cli) + return cli.name ~= "sumneko_lua" + end, + } + end, {}) - telescope_mapper("gr", "lsp_references", nil, true) - telescope_mapper("pv", "find_symbol", nil, true) - telescope_mapper("pd", "lsp_document_symbols", nil, true) - telescope_mapper("", "lsp_definitions", nil, true) + telescope_mapper("gr", "lsp_references", nil, true) + telescope_mapper("pv", "find_symbol", nil, true) + telescope_mapper("pd", "lsp_document_symbols", nil, true) + telescope_mapper("", "lsp_definitions", nil, true) - vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc" + vim.bo.omnifunc = "v:lua.vim.lsp.omnifunc" - -- Attach any filetype specific options to the client - filetype_attach[filetype](client, bufnr) + -- Attach any filetype specific options to the client + filetype_attach[filetype](client, bufnr) end -- cgit v1.2.3