1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

chore: renaming

This commit is contained in:
jdhao 2022-08-14 20:16:00 +08:00
parent 7e6dd23d37
commit 2880d7bce3

View File

@ -21,10 +21,10 @@ local custom_attach = function(client, bufnr)
vim.keymap.set("n", "<space>q", function() vim.diagnostic.setqflist({open = true}) end, opts) vim.keymap.set("n", "<space>q", function() vim.diagnostic.setqflist({open = true}) end, opts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, opts)
vim.api.nvim_create_autocmd("CursorHold", { api.nvim_create_autocmd("CursorHold", {
buffer=bufnr, buffer=bufnr,
callback = function() callback = function()
local opts = { local float_opts = {
focusable = false, focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" }, close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = 'rounded', border = 'rounded',
@ -36,11 +36,11 @@ local custom_attach = function(client, bufnr)
vim.b.diagnostics_pos = { nil, nil } vim.b.diagnostics_pos = { nil, nil }
end end
local cursor_pos = vim.api.nvim_win_get_cursor(0) local cursor_pos = api.nvim_win_get_cursor(0)
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) and if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) and
#vim.diagnostic.get() > 0 #vim.diagnostic.get() > 0
then then
vim.diagnostic.open_float(nil, opts) vim.diagnostic.open_float(nil, float_opts)
end end
vim.b.diagnostics_pos = cursor_pos vim.b.diagnostics_pos = cursor_pos