updates to nvim, not sure about all this yet...

This commit is contained in:
Solomon Laing 2022-11-09 21:22:52 +10:30
parent 95c67eafb0
commit 8a9f62baaf
7 changed files with 114 additions and 111 deletions

View File

@ -131,7 +131,7 @@ cmd mkfile_and_edit ${{
}}
cmd zk_edit ${{
eval zk edit -i
eval zk edit --interactive --sort modified-
}}
cmd zk_edit_file ${{

View File

@ -34,7 +34,7 @@ require "user.spectre"
-- require "user.bufferline" -- replaced with cybu and bbye
-- 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.
-- require "user.winbar"
require "user.winbar"
require "user.zk"
require "user.tabout"
require "user.cybu"

View File

@ -23,7 +23,6 @@ dashboard.section.header.val = {
dashboard.section.buttons.val = {
button("f", icons.documents.Files .. " Find file", ":Telescope find_files <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("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"),
button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"),

View File

@ -4,7 +4,7 @@ M.capabilities = vim.lsp.protocol.make_client_capabilities()
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
if not status_cmp_ok then
print "cmp_nvim_lsp error!"
print("cmp_nvim_lsp error!")
return
end
@ -12,7 +12,7 @@ M.capabilities.textDocument.completion.completionItem.snippetSupport = true
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
M.setup = function()
local icons = require "user.icons"
local icons = require("user.icons")
local signs = {
{ name = "DiagnosticSignError", text = icons.diagnostics.Error },
{ name = "DiagnosticSignWarn", text = icons.diagnostics.Warning },
@ -22,7 +22,9 @@ M.setup = function()
for _, sign in ipairs(signs) do
vim.fn.sign_define(sign.name, {
texthl = sign.name, text = sign.text, numhl = ""
texthl = sign.name,
text = sign.text,
numhl = "",
})
end
@ -63,15 +65,13 @@ M.setup = function()
vim.diagnostic.config(config)
vim.lsp.handlers["textDocument/hover"] =
vim.lsp.with(vim.lsp.handlers.hover, {
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "rounded",
-- width = 60,
-- height = 30,
})
vim.lsp.handlers["textDocument/signatureHelp"] =
vim.lsp.with(vim.lsp.handlers.signature_help, {
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
border = "rounded",
-- width = 60,
-- height = 30,
@ -79,14 +79,16 @@ M.setup = function()
end
local function attach_navic(client, bufnr)
vim.g.navic_silence = true
vim.g.navic_silence = false
local status_ok, navic = pcall(require, "nvim-navic")
if not status_ok then
print"nvim-navic error!"
return
end
if client.server_capabilities.documentSymbolProvider then
navic.attach(client, bufnr)
end
end
local function lsp_keymaps(bufnr)
local opts = { noremap = true, silent = true }
@ -115,22 +117,22 @@ M.on_attach = function(client, bufnr)
end
function M.enable_format_on_save()
vim.cmd [[
vim.cmd([[
augroup format_on_save
autocmd!
autocmd BufWritePre * lua vim.lsp.buf.format({ async = false })
augroup end
]]
vim.notify "Enabled format on save"
]])
vim.notify("Enabled format on save")
end
function M.disable_format_on_save()
M.remove_augroup "format_on_save"
vim.notify "Disabled format on save"
M.remove_augroup("format_on_save")
vim.notify("Disabled format on save")
end
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()
else
M.disable_format_on_save()
@ -143,6 +145,6 @@ function M.remove_augroup(name)
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

View File

@ -81,7 +81,9 @@ for _, server in pairs(servers) do
end
if server == "sumneko_lua" then
lspconfig.sumneko_lua.setup({})
lspconfig.sumneko_lua.setup({
on_attach = require("user.lsp.handlers").on_attach,
})
goto continue
end

View File

@ -5,7 +5,7 @@ end
noice.setup({
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
opts = {}, -- global options for the cmdline. See section on views
---@type table<string, CmdlineFormat>
@ -28,7 +28,7 @@ noice.setup({
messages = {
-- NOTE: If you enable messages, then the cmdline is enabled automatically.
-- 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_error = "notify", -- view for errors
view_warn = "notify", -- view for warnings
@ -109,9 +109,9 @@ noice.setup({
-- override the default lsp markdown formatter with Noice
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
-- 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)
["cmp.entry.get_documentation"] = false,
["cmp.entry.get_documentation"] = true,
},
hover = {
enabled = true,

View File

@ -6,7 +6,7 @@ end
winbar.setup({
enabled = true,
show_file_path = true,
show_file_path = false,
show_symbols = true,
colors = {