make lsp some changes and a easy new file
This commit is contained in:
parent
e1ecbd9818
commit
1941ccef40
1
init.lua
1
init.lua
@ -31,5 +31,6 @@ require("plugin-config/lazygit")
|
||||
require("lsp")
|
||||
require("lsp.cmp")
|
||||
require("lsp.null-ls")
|
||||
require("lsp.ui")
|
||||
|
||||
require("nvim-dap")
|
||||
|
@ -49,7 +49,7 @@ wk.register({
|
||||
p = { ":Telescope projects<CR>", "Open project" },
|
||||
r = { ":Telescope oldfiles<CR>", "Recent files" },
|
||||
f = { ":Telescope file_browser<CR>", "File browser" },
|
||||
n = { ":enew<CR>", "New file" },
|
||||
n = { ":AdvancedNewFile<CR>", "New file" },
|
||||
s = { ":Telescope live_grep<CR>", "Search in project" },
|
||||
},
|
||||
})
|
||||
|
@ -1,21 +1,35 @@
|
||||
return {
|
||||
on_setup = function(server)
|
||||
server.setup({
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
-- 禁用格式化功能,交给专门插件插件处理
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
on_setup = function(server)
|
||||
server.setup({
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
-- 禁用格式化功能,交给专门插件插件处理
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
|
||||
-- local function buf_set_keymap(...)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
-- end
|
||||
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
-- 绑定快捷键
|
||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
prefix = " ",
|
||||
scope = "cursor",
|
||||
}
|
||||
vim.diagnostic.open_float(nil, opts)
|
||||
end,
|
||||
})
|
||||
-- local function buf_set_keymap(...)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
-- end
|
||||
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
-- 绑定快捷键
|
||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
@ -9,6 +9,20 @@ return {
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
prefix = " ",
|
||||
scope = "cursor",
|
||||
}
|
||||
vim.diagnostic.open_float(nil, opts)
|
||||
end,
|
||||
})
|
||||
-- local function buf_set_keymap(...)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
-- end
|
||||
|
@ -35,6 +35,20 @@ local opts = {
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
prefix = " ",
|
||||
scope = "cursor",
|
||||
}
|
||||
vim.diagnostic.open_float(nil, opts)
|
||||
end,
|
||||
})
|
||||
-- local function buf_set_keymap(...)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end,
|
||||
|
@ -1,21 +1,35 @@
|
||||
return {
|
||||
on_setup = function(server)
|
||||
server.setup({
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
-- 禁用格式化功能,交给专门插件插件处理
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
on_setup = function(server)
|
||||
server.setup({
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
-- 禁用格式化功能,交给专门插件插件处理
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
|
||||
-- local function buf_set_keymap(...)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
-- end
|
||||
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
-- 绑定快捷键
|
||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
local opts = {
|
||||
focusable = false,
|
||||
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
prefix = " ",
|
||||
scope = "cursor",
|
||||
}
|
||||
vim.diagnostic.open_float(nil, opts)
|
||||
end,
|
||||
})
|
||||
-- local function buf_set_keymap(...)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
-- end
|
||||
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
-- 绑定快捷键
|
||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
13
lua/lsp/ui.lua
Normal file
13
lua/lsp/ui.lua
Normal file
@ -0,0 +1,13 @@
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = false,
|
||||
})
|
||||
|
||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||
end
|
@ -98,6 +98,10 @@ return require("packer").startup(function()
|
||||
-- telescope-file-browser
|
||||
use({ "nvim-telescope/telescope-file-browser.nvim" })
|
||||
|
||||
-- create new file
|
||||
-- 快捷创建新文件
|
||||
use("Mohammed-Taher/AdvancedNewFile.nvim")
|
||||
|
||||
-- project
|
||||
-- 项目管理
|
||||
use({
|
||||
|
Loading…
Reference in New Issue
Block a user