[nvim] added fzf-lua and refactor of mason-lspconfig
This commit is contained in:
parent
14b6215464
commit
b7b751d4c1
2 changed files with 128 additions and 0 deletions
34
.config/nvim/lua/plugins/fzf-lua.lua
Normal file
34
.config/nvim/lua/plugins/fzf-lua.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local fzflua = require('fzf-lua')
|
||||
fzflua.register_ui_select()
|
||||
fzflua.setup({
|
||||
defaults = {
|
||||
headers = false,
|
||||
formatter = "path.filename_first",
|
||||
winopts = {
|
||||
border = "single",
|
||||
width = 0.6,
|
||||
height = 0.5,
|
||||
},
|
||||
},
|
||||
files = {
|
||||
previewer = false,
|
||||
winopts = {
|
||||
width = 0.5,
|
||||
height = 0.3,
|
||||
}
|
||||
},
|
||||
grep = {
|
||||
winopts = {
|
||||
width = 0.7,
|
||||
preview = {
|
||||
layout = "horizontal",
|
||||
horizontal = "right:40%"
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
vim.keymap.set('n', '<leader>ff', fzflua.files, {})
|
||||
vim.keymap.set('n', '<leader>fe', fzflua.diagnostics_workspace, {})
|
||||
vim.keymap.set('n', '<leader>fg', fzflua.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fb', fzflua.buffers, {})
|
||||
vim.keymap.set('n', '<leader>fh', fzflua.help_tags, {})
|
94
.config/nvim/lua/plugins/mason-lspconfig.lua
Normal file
94
.config/nvim/lua/plugins/mason-lspconfig.lua
Normal file
|
@ -0,0 +1,94 @@
|
|||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
mason_lspconfig.setup({
|
||||
automatic_installation = false,
|
||||
})
|
||||
|
||||
local lsp_defaults = lspconfig.util.default_config
|
||||
local capabilities =
|
||||
vim.tbl_deep_extend("force", lsp_defaults.capabilities, require("cmp_nvim_lsp").default_capabilities())
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end,
|
||||
["gopls"] = function()
|
||||
lspconfig["gopls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
gopls = {
|
||||
["ui.completion.usePlaceholders"] = true,
|
||||
["ui.diagnostic.staticcheck"] = true,
|
||||
["ui.inlayhint.hints"] = {
|
||||
assignVariablesTypes = true,
|
||||
compositeLiteralFields = true,
|
||||
compositeLiteralTypes = true,
|
||||
constantValues = true,
|
||||
functionTypeParameters = true,
|
||||
parameterNames = true,
|
||||
rangeVariableTypes = true
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
end,
|
||||
["lua_ls"] = function()
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
hint = { enable = true }
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
["ltex"] = function()
|
||||
lspconfig["ltex"].setup({
|
||||
capabilities = capabilities,
|
||||
--Local on attach
|
||||
on_attach = function(_, _)
|
||||
-- rest of your on_attach process.
|
||||
require("ltex_extra").setup()
|
||||
end,
|
||||
settings = {
|
||||
ltex = {
|
||||
language = "en-US",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
["basedpyright"] = function()
|
||||
lspconfig["basedpyright"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
verboseOutput = true,
|
||||
autoImportCompletion = true,
|
||||
basedpyright = {
|
||||
analysis = {
|
||||
typeCheckingMode = "all",
|
||||
autoSearchPaths = true,
|
||||
useLibraryCodeForTypes = true,
|
||||
diagnosticMode = "openFilesOnly",
|
||||
indexing = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
Loading…
Reference in a new issue