updated nvim config to 0.11 lsp
This commit is contained in:
parent
af6b443ef6
commit
04e711f146
5 changed files with 49 additions and 63 deletions
|
|
@ -1,2 +1,3 @@
|
|||
require('config.lazy')
|
||||
require('config.rest')
|
||||
require('config.lsp')
|
||||
|
|
|
|||
6
nvim/lua/config/lsp.lua
Normal file
6
nvim/lua/config/lsp.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
vim.diagnostic.config({
|
||||
virtual_lines = {
|
||||
current_line = true,
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -27,15 +27,15 @@ vim.o.clipboard = "unnamedplus"
|
|||
-- ["*"] = paste,
|
||||
-- },
|
||||
-- }
|
||||
-- vim.api.nvim_exec(
|
||||
-- [[
|
||||
-- augroup YankHighlight
|
||||
-- autocmd!
|
||||
-- autocmd TextYankPost * silent! lua vim.highlight.on_yank()
|
||||
-- augroup end
|
||||
-- ]],
|
||||
-- false
|
||||
-- )
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
augroup YankHighlight
|
||||
autocmd!
|
||||
autocmd TextYankPost * silent! lua vim.highlight.on_yank()
|
||||
augroup end
|
||||
]],
|
||||
false
|
||||
)
|
||||
|
||||
-- Restore cursor
|
||||
local restore_cursor_augroup = vim.api.nvim_create_augroup("restore_cursor_shape_on_exit", { clear = true })
|
||||
|
|
|
|||
|
|
@ -1,31 +1,12 @@
|
|||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
cmd = "Mason",
|
||||
},
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
require("mason").setup()
|
||||
|
||||
if not vim.g.pre_load then
|
||||
require("mason-lspconfig").setup({
|
||||
-- The first entry (without a key) will be the default handler
|
||||
-- and will be called for each installed server that doesn't have
|
||||
-- a dedicated handler.
|
||||
-- function(server_name) -- default handler (optional)
|
||||
-- require("lspconfig")[server_name].setup({})
|
||||
-- end,
|
||||
-- Next, you can provide a dedicated handler for specific servers.
|
||||
-- For example, a handler override for the `rust_analyzer`:
|
||||
-- ["rust_analyzer"] = function ()
|
||||
-- require("rust-tools").setup {}
|
||||
-- end
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
opts = {},
|
||||
dependencies = {
|
||||
{ "mason-org/mason.nvim", opts = {} },
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
},
|
||||
{
|
||||
"ray-x/lsp_signature.nvim",
|
||||
event = "VeryLazy",
|
||||
|
|
@ -47,25 +28,22 @@ return {
|
|||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
opts = function()
|
||||
local mason_reg = require("mason-registry")
|
||||
|
||||
|
||||
local formatters = {}
|
||||
local formatters_by_ft = {}
|
||||
|
||||
|
||||
-- add diff langue vs filetype
|
||||
local keymap = {
|
||||
["c++"] = "cpp",
|
||||
["c#"] = "cs",
|
||||
}
|
||||
|
||||
|
||||
-- add dif conform vs mason
|
||||
local name_map = {
|
||||
["cmakelang"] = "cmake_format",
|
||||
|
|
@ -79,7 +57,7 @@ return {
|
|||
["sql-formatter"] = "sql_formatter",
|
||||
["xmlformatter"] = "xmlformat",
|
||||
}
|
||||
|
||||
|
||||
for _, pkg in pairs(mason_reg.get_installed_packages()) do
|
||||
for _, type in pairs(pkg.spec.categories) do
|
||||
-- only act upon a formatter
|
||||
|
|
@ -94,7 +72,7 @@ return {
|
|||
-- this should be replaced by a function
|
||||
-- that quieries the configured mason install path
|
||||
local prefix = vim.fn.stdpath("data") .. "/mason/bin/"
|
||||
|
||||
|
||||
formatters[pkg.spec.name] = {
|
||||
command = prefix .. bin,
|
||||
args = { "$FILENAME" },
|
||||
|
|
@ -102,7 +80,7 @@ return {
|
|||
require_cwd = false,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
-- finally add the formatter to it's compatible filetype(s)
|
||||
for _, ft in pairs(pkg.spec.languages) do
|
||||
local ftl = string.lower(ft)
|
||||
|
|
@ -121,7 +99,7 @@ return {
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
formatters = formatters,
|
||||
formatters_by_ft = formatters_by_ft,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue