update nvim
This commit is contained in:
parent
c1de9ef4ff
commit
af02e31fe9
25 changed files with 957 additions and 133 deletions
34
nvim/lua/configs/lsp/e-lspconfig.lua
Normal file
34
nvim/lua/configs/lsp/e-lspconfig.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
local M = {}
|
||||
local api = vim.api
|
||||
|
||||
local function check_triggeredChars(triggerChars)
|
||||
local cur_line = api.nvim_get_current_line()
|
||||
local pos = api.nvim_win_get_cursor(0)[2]
|
||||
local prev_char = cur_line:sub(pos - 1, pos - 1)
|
||||
local cur_char = cur_line:sub(pos, pos)
|
||||
|
||||
for _, char in ipairs(triggerChars) do
|
||||
if cur_char == char or prev_char == char then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
M.setup = function(client, bufnr)
|
||||
local group = api.nvim_create_augroup("LspSignature", { clear = false })
|
||||
api.nvim_clear_autocmds { group = group, buffer = bufnr }
|
||||
|
||||
local triggerChars = client.server_capabilities.signatureHelpProvider.triggerCharacters
|
||||
|
||||
api.nvim_create_autocmd("TextChangedI", {
|
||||
group = group,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
if check_triggeredChars(triggerChars) then
|
||||
vim.lsp.buf.signature_help { focus = false, silent = true, max_height = 7, border = "single" }
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return M
|
||||
65
nvim/lua/configs/lsp/lspconfig.lua
Normal file
65
nvim/lua/configs/lsp/lspconfig.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
local on_attach = require("configs.lsp.e-lspconfig").on_attach
|
||||
local on_init = require("configs.lsp.e-lspconfig").on_init
|
||||
local capabilities = require("configs.lsp.e-lspconfig").capabilities
|
||||
|
||||
-- clangd lsp server
|
||||
vim.lsp.config('clangd', {
|
||||
on_attach = on_attach,
|
||||
on_init = on_init,
|
||||
capabilities = capabilities,
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--background-index-priority=normal",
|
||||
"--clang-tidy",
|
||||
"--experimental-modules-support",
|
||||
"--all-scopes-completion",
|
||||
"--completion-style=detailed",
|
||||
"--header-insertion=iwyu",
|
||||
"--limit-references=5",
|
||||
"--malloc-trim",
|
||||
"--pch-storage=disk",
|
||||
},
|
||||
filetypes = { "c", "cpp", "objc", "objcpp" },
|
||||
init_options = {
|
||||
fallbackFlags = {'-std=c++20'},
|
||||
}
|
||||
})
|
||||
vim.lsp.enable('clangd')
|
||||
|
||||
-- Lua
|
||||
vim.lsp.config('lua_ls', {
|
||||
cmd = { 'lua-language-server' },
|
||||
filetypes = { 'lua' },
|
||||
root_markers = { '.luarc.json', '.luarc.jsonc', '.git' },
|
||||
single_file_support = true,
|
||||
settings = {
|
||||
Lua = {
|
||||
telemetry = { enable = false },
|
||||
runtime = { version = 'LuaJIT' },
|
||||
diagnostics = { globals = { 'vim' } },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
vim.fn.stdpath('config'),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
vim.lsp.enable('lua_ls')
|
||||
|
||||
-- Bash
|
||||
vim.lsp.config('bashls', {
|
||||
cmd = { 'bash-language-server', 'start' },
|
||||
filetypes = { 'sh', 'bash' },
|
||||
root_markers = { '.git' },
|
||||
single_file_support = true,
|
||||
})
|
||||
vim.lsp.enable('bashls')
|
||||
|
||||
-- For all
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue