updates to nvim, not sure about all this yet...
This commit is contained in:
parent
95c67eafb0
commit
8a9f62baaf
@ -131,8 +131,8 @@ cmd mkfile_and_edit ${{
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
cmd zk_edit ${{
|
cmd zk_edit ${{
|
||||||
eval zk edit -i
|
eval zk edit --interactive --sort modified-
|
||||||
}}
|
}}
|
||||||
|
|
||||||
cmd zk_edit_file ${{
|
cmd zk_edit_file ${{
|
||||||
name=$(echo "$f" | sed 's/\..*//' | sed 's/.*\///')
|
name=$(echo "$f" | sed 's/\..*//' | sed 's/.*\///')
|
||||||
|
|||||||
@ -34,7 +34,7 @@ require "user.spectre"
|
|||||||
-- require "user.bufferline" -- replaced with cybu and bbye
|
-- require "user.bufferline" -- replaced with cybu and bbye
|
||||||
-- disabled due to "Not enough room" issue see https://github.com/neovim/neovim/issues/19464
|
-- disabled due to "Not enough room" issue see https://github.com/neovim/neovim/issues/19464
|
||||||
-- and potential conflict with noice, I added it same time as updating so maybe not.
|
-- and potential conflict with noice, I added it same time as updating so maybe not.
|
||||||
-- require "user.winbar"
|
require "user.winbar"
|
||||||
require "user.zk"
|
require "user.zk"
|
||||||
require "user.tabout"
|
require "user.tabout"
|
||||||
require "user.cybu"
|
require "user.cybu"
|
||||||
|
|||||||
@ -23,7 +23,6 @@ dashboard.section.header.val = {
|
|||||||
dashboard.section.buttons.val = {
|
dashboard.section.buttons.val = {
|
||||||
button("f", icons.documents.Files .. " Find file", ":Telescope find_files <CR>"),
|
button("f", icons.documents.Files .. " Find file", ":Telescope find_files <CR>"),
|
||||||
button("e", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert <CR>"),
|
button("e", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert <CR>"),
|
||||||
button("p", icons.git.Repo .. " Find project", ":lua require('telescope').extensions.projects.projects()<CR>"),
|
|
||||||
button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"),
|
button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"),
|
||||||
button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"),
|
button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"),
|
||||||
button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"),
|
button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"),
|
||||||
|
|||||||
@ -4,145 +4,147 @@ M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
|||||||
|
|
||||||
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||||
if not status_cmp_ok then
|
if not status_cmp_ok then
|
||||||
print "cmp_nvim_lsp error!"
|
print("cmp_nvim_lsp error!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
|
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
|
||||||
|
|
||||||
M.setup = function()
|
M.setup = function()
|
||||||
local icons = require "user.icons"
|
local icons = require("user.icons")
|
||||||
local signs = {
|
local signs = {
|
||||||
{ name = "DiagnosticSignError", text = icons.diagnostics.Error },
|
{ name = "DiagnosticSignError", text = icons.diagnostics.Error },
|
||||||
{ name = "DiagnosticSignWarn", text = icons.diagnostics.Warning },
|
{ name = "DiagnosticSignWarn", text = icons.diagnostics.Warning },
|
||||||
{ name = "DiagnosticSignHint", text = icons.diagnostics.Hint },
|
{ name = "DiagnosticSignHint", text = icons.diagnostics.Hint },
|
||||||
{ name = "DiagnosticSignInfo", text = icons.diagnostics.Information },
|
{ name = "DiagnosticSignInfo", text = icons.diagnostics.Information },
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, sign in ipairs(signs) do
|
for _, sign in ipairs(signs) do
|
||||||
vim.fn.sign_define(sign.name, {
|
vim.fn.sign_define(sign.name, {
|
||||||
texthl = sign.name, text = sign.text, numhl = ""
|
texthl = sign.name,
|
||||||
})
|
text = sign.text,
|
||||||
end
|
numhl = "",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
-- disable virtual text
|
-- disable virtual text
|
||||||
virtual_lines = false,
|
virtual_lines = false,
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
-- virtual_text = {
|
-- virtual_text = {
|
||||||
-- -- spacing = 7,
|
-- -- spacing = 7,
|
||||||
-- -- update_in_insert = false,
|
-- -- update_in_insert = false,
|
||||||
-- -- severity_sort = true,
|
-- -- severity_sort = true,
|
||||||
-- -- prefix = "<-",
|
-- -- prefix = "<-",
|
||||||
-- prefix = " ●",
|
-- prefix = " ●",
|
||||||
-- source = "if_many", -- Or "always"
|
-- source = "if_many", -- Or "always"
|
||||||
-- -- format = function(diag)
|
-- -- format = function(diag)
|
||||||
-- -- return diag.message .. "blah"
|
-- -- return diag.message .. "blah"
|
||||||
-- -- end,
|
-- -- end,
|
||||||
-- },
|
-- },
|
||||||
|
|
||||||
-- show signs
|
-- show signs
|
||||||
signs = {
|
signs = {
|
||||||
active = signs,
|
active = signs,
|
||||||
},
|
},
|
||||||
update_in_insert = true,
|
update_in_insert = true,
|
||||||
underline = true,
|
underline = true,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
float = {
|
float = {
|
||||||
focusable = true,
|
focusable = true,
|
||||||
style = "minimal",
|
style = "minimal",
|
||||||
border = "rounded",
|
border = "rounded",
|
||||||
-- border = {"▄","▄","▄","█","▀","▀","▀","█"},
|
-- border = {"▄","▄","▄","█","▀","▀","▀","█"},
|
||||||
source = "if_many", -- Or "always"
|
source = "if_many", -- Or "always"
|
||||||
header = "",
|
header = "",
|
||||||
prefix = "",
|
prefix = "",
|
||||||
-- width = 40,
|
-- width = 40,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.diagnostic.config(config)
|
vim.diagnostic.config(config)
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] =
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||||
vim.lsp.with(vim.lsp.handlers.hover, {
|
border = "rounded",
|
||||||
border = "rounded",
|
-- width = 60,
|
||||||
-- width = 60,
|
-- height = 30,
|
||||||
-- height = 30,
|
})
|
||||||
})
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] =
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||||
vim.lsp.with(vim.lsp.handlers.signature_help, {
|
border = "rounded",
|
||||||
border = "rounded",
|
-- width = 60,
|
||||||
-- width = 60,
|
-- height = 30,
|
||||||
-- height = 30,
|
})
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function attach_navic(client, bufnr)
|
local function attach_navic(client, bufnr)
|
||||||
vim.g.navic_silence = true
|
vim.g.navic_silence = false
|
||||||
local status_ok, navic = pcall(require, "nvim-navic")
|
local status_ok, navic = pcall(require, "nvim-navic")
|
||||||
if not status_ok then
|
if not status_ok then
|
||||||
print "nvim-navic error!"
|
print"nvim-navic error!"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
navic.attach(client, bufnr)
|
if client.server_capabilities.documentSymbolProvider then
|
||||||
|
navic.attach(client, bufnr)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function lsp_keymaps(bufnr)
|
local function lsp_keymaps(bufnr)
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>Telescope lsp_declarations<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>Telescope lsp_declarations<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", "<cmd>Telescope lsp_implementations<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gI", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-f>", "<cmd>Format<cr>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-f>", "<cmd>Format<cr>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-a>", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-a>", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-s>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<M-s>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||||
-- vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format({ async = true })' ]]
|
-- vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format({ async = true })' ]]
|
||||||
end
|
end
|
||||||
|
|
||||||
M.on_attach = function(client, bufnr)
|
M.on_attach = function(client, bufnr)
|
||||||
lsp_keymaps(bufnr)
|
lsp_keymaps(bufnr)
|
||||||
attach_navic(client, bufnr)
|
attach_navic(client, bufnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.enable_format_on_save()
|
function M.enable_format_on_save()
|
||||||
vim.cmd [[
|
vim.cmd([[
|
||||||
augroup format_on_save
|
augroup format_on_save
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWritePre * lua vim.lsp.buf.format({ async = false })
|
autocmd BufWritePre * lua vim.lsp.buf.format({ async = false })
|
||||||
augroup end
|
augroup end
|
||||||
]]
|
]])
|
||||||
vim.notify "Enabled format on save"
|
vim.notify("Enabled format on save")
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.disable_format_on_save()
|
function M.disable_format_on_save()
|
||||||
M.remove_augroup "format_on_save"
|
M.remove_augroup("format_on_save")
|
||||||
vim.notify "Disabled format on save"
|
vim.notify("Disabled format on save")
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.toggle_format_on_save()
|
function M.toggle_format_on_save()
|
||||||
if vim.fn.exists "#format_on_save#BufWritePre" == 0 then
|
if vim.fn.exists("#format_on_save#BufWritePre") == 0 then
|
||||||
M.enable_format_on_save()
|
M.enable_format_on_save()
|
||||||
else
|
else
|
||||||
M.disable_format_on_save()
|
M.disable_format_on_save()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.remove_augroup(name)
|
function M.remove_augroup(name)
|
||||||
if vim.fn.exists("#" .. name) == 1 then
|
if vim.fn.exists("#" .. name) == 1 then
|
||||||
vim.cmd("au! " .. name)
|
vim.cmd("au! " .. name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.cmd [[ command! LspToggleAutoFormat execute 'lua require("user.lsp.handlers").toggle_format_on_save()' ]]
|
vim.cmd([[ command! LspToggleAutoFormat execute 'lua require("user.lsp.handlers").toggle_format_on_save()' ]])
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@ -81,7 +81,9 @@ for _, server in pairs(servers) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
if server == "sumneko_lua" then
|
if server == "sumneko_lua" then
|
||||||
lspconfig.sumneko_lua.setup({})
|
lspconfig.sumneko_lua.setup({
|
||||||
|
on_attach = require("user.lsp.handlers").on_attach,
|
||||||
|
})
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ end
|
|||||||
|
|
||||||
noice.setup({
|
noice.setup({
|
||||||
cmdline = {
|
cmdline = {
|
||||||
enabled = true, -- enables the Noice cmdline UI
|
enabled = false, -- enables the Noice cmdline UI
|
||||||
view = "cmdline_popup", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom
|
view = "cmdline_popup", -- view for rendering the cmdline. Change to `cmdline` to get a classic cmdline at the bottom
|
||||||
opts = {}, -- global options for the cmdline. See section on views
|
opts = {}, -- global options for the cmdline. See section on views
|
||||||
---@type table<string, CmdlineFormat>
|
---@type table<string, CmdlineFormat>
|
||||||
@ -28,7 +28,7 @@ noice.setup({
|
|||||||
messages = {
|
messages = {
|
||||||
-- NOTE: If you enable messages, then the cmdline is enabled automatically.
|
-- NOTE: If you enable messages, then the cmdline is enabled automatically.
|
||||||
-- This is a current Neovim limitation.
|
-- This is a current Neovim limitation.
|
||||||
enabled = true, -- enables the Noice messages UI
|
enabled = false, -- enables the Noice messages UI
|
||||||
view = "notify", -- default view for messages
|
view = "notify", -- default view for messages
|
||||||
view_error = "notify", -- view for errors
|
view_error = "notify", -- view for errors
|
||||||
view_warn = "notify", -- view for warnings
|
view_warn = "notify", -- view for warnings
|
||||||
@ -109,9 +109,9 @@ noice.setup({
|
|||||||
-- override the default lsp markdown formatter with Noice
|
-- override the default lsp markdown formatter with Noice
|
||||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||||
-- override the lsp markdown formatter with Noice
|
-- override the lsp markdown formatter with Noice
|
||||||
["vim.lsp.util.stylize_markdown"] = false,
|
["vim.lsp.util.stylize_markdown"] = true,
|
||||||
-- override cmp documentation with Noice (needs the other options to work)
|
-- override cmp documentation with Noice (needs the other options to work)
|
||||||
["cmp.entry.get_documentation"] = false,
|
["cmp.entry.get_documentation"] = true,
|
||||||
},
|
},
|
||||||
hover = {
|
hover = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ end
|
|||||||
winbar.setup({
|
winbar.setup({
|
||||||
enabled = true,
|
enabled = true,
|
||||||
|
|
||||||
show_file_path = true,
|
show_file_path = false,
|
||||||
show_symbols = true,
|
show_symbols = true,
|
||||||
|
|
||||||
colors = {
|
colors = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user