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")
|
||||||
require("lsp.cmp")
|
require("lsp.cmp")
|
||||||
require("lsp.null-ls")
|
require("lsp.null-ls")
|
||||||
|
require("lsp.ui")
|
||||||
|
|
||||||
require("nvim-dap")
|
require("nvim-dap")
|
||||||
|
@ -49,7 +49,7 @@ wk.register({
|
|||||||
p = { ":Telescope projects<CR>", "Open project" },
|
p = { ":Telescope projects<CR>", "Open project" },
|
||||||
r = { ":Telescope oldfiles<CR>", "Recent files" },
|
r = { ":Telescope oldfiles<CR>", "Recent files" },
|
||||||
f = { ":Telescope file_browser<CR>", "File browser" },
|
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" },
|
s = { ":Telescope live_grep<CR>", "Search in project" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -1,21 +1,35 @@
|
|||||||
return {
|
return {
|
||||||
on_setup = function(server)
|
on_setup = function(server)
|
||||||
server.setup({
|
server.setup({
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
},
|
},
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
-- 禁用格式化功能,交给专门插件插件处理
|
-- 禁用格式化功能,交给专门插件插件处理
|
||||||
client.server_capabilities.document_formatting = false
|
client.server_capabilities.document_formatting = false
|
||||||
client.server_capabilities.document_range_formatting = false
|
client.server_capabilities.document_range_formatting = false
|
||||||
|
|
||||||
-- local function buf_set_keymap(...)
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
buffer = bufnr,
|
||||||
-- end
|
callback = function()
|
||||||
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
local opts = {
|
||||||
-- 绑定快捷键
|
focusable = false,
|
||||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||||
end,
|
border = "rounded",
|
||||||
})
|
source = "always",
|
||||||
end,
|
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_formatting = false
|
||||||
client.server_capabilities.document_range_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(...)
|
-- local function buf_set_keymap(...)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
-- end
|
-- end
|
||||||
|
@ -35,6 +35,20 @@ local opts = {
|
|||||||
client.server_capabilities.document_formatting = false
|
client.server_capabilities.document_formatting = false
|
||||||
client.server_capabilities.document_range_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(...)
|
-- local function buf_set_keymap(...)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
end,
|
end,
|
||||||
|
@ -1,21 +1,35 @@
|
|||||||
return {
|
return {
|
||||||
on_setup = function(server)
|
on_setup = function(server)
|
||||||
server.setup({
|
server.setup({
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
},
|
},
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
-- 禁用格式化功能,交给专门插件插件处理
|
-- 禁用格式化功能,交给专门插件插件处理
|
||||||
client.server_capabilities.document_formatting = false
|
client.server_capabilities.document_formatting = false
|
||||||
client.server_capabilities.document_range_formatting = false
|
client.server_capabilities.document_range_formatting = false
|
||||||
|
|
||||||
-- local function buf_set_keymap(...)
|
vim.api.nvim_create_autocmd("CursorHold", {
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
buffer = bufnr,
|
||||||
-- end
|
callback = function()
|
||||||
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
local opts = {
|
||||||
-- 绑定快捷键
|
focusable = false,
|
||||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
|
||||||
end,
|
border = "rounded",
|
||||||
})
|
source = "always",
|
||||||
end,
|
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
|
-- telescope-file-browser
|
||||||
use({ "nvim-telescope/telescope-file-browser.nvim" })
|
use({ "nvim-telescope/telescope-file-browser.nvim" })
|
||||||
|
|
||||||
|
-- create new file
|
||||||
|
-- 快捷创建新文件
|
||||||
|
use("Mohammed-Taher/AdvancedNewFile.nvim")
|
||||||
|
|
||||||
-- project
|
-- project
|
||||||
-- 项目管理
|
-- 项目管理
|
||||||
use({
|
use({
|
||||||
|
Loading…
Reference in New Issue
Block a user