refactor(nvim): general cleanup of deprecated functions and diags
This commit is contained in:
parent
336919dc2b
commit
9dae85a4a3
@ -1 +1 @@
|
|||||||
vim.api.nvim_buf_set_option(0, "commentstring", "// %s")
|
vim.opt_local.commentstring = "// %s"
|
||||||
|
@ -1 +1 @@
|
|||||||
vim.api.nvim_buf_set_option(0, "commentstring", "{# %s #}")
|
vim.opt_local.commentstring = "{# %s #}"
|
||||||
|
@ -2,8 +2,7 @@ local opt_local = vim.opt_local
|
|||||||
|
|
||||||
opt_local.tabstop = 2
|
opt_local.tabstop = 2
|
||||||
opt_local.shiftwidth = 2
|
opt_local.shiftwidth = 2
|
||||||
|
opt_local.commenstring = "# %s"
|
||||||
vim.api.nvim_buf_set_option(0, "commentstring", "# %s")
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>fr", function()
|
vim.keymap.set("n", "<leader>fr", function()
|
||||||
local cmd = {
|
local cmd = {
|
||||||
|
@ -21,7 +21,7 @@ M.setup = function()
|
|||||||
title = "Strip Trail Space",
|
title = "Strip Trail Space",
|
||||||
---@param win integer The window handle
|
---@param win integer The window handle
|
||||||
on_open = function(win)
|
on_open = function(win)
|
||||||
vim.api.nvim_buf_set_option(vim.api.nvim_win_get_buf(win), "filetype", "markdown")
|
vim.api.nvim_set_option_value("filetype", "markdown", { buf = vim.api.nvim_win_get_buf(win) })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end, { desc = "Toggles intercepting BufWritePre to strip trail space" })
|
end, { desc = "Toggles intercepting BufWritePre to strip trail space" })
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
local g = vim.g
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.setup = function() end
|
M.setup = function() end
|
||||||
|
@ -11,24 +11,6 @@ M.setup = function()
|
|||||||
lspSymbol("Info", "", 10)
|
lspSymbol("Info", "", 10)
|
||||||
lspSymbol("Hint", "", 10)
|
lspSymbol("Hint", "", 10)
|
||||||
|
|
||||||
local border = {
|
|
||||||
{ "╭", "FloatBorder" },
|
|
||||||
{ "─", "FloatBorder" },
|
|
||||||
{ "╮", "FloatBorder" },
|
|
||||||
{ "│", "FloatBorder" },
|
|
||||||
{ "╯", "FloatBorder" },
|
|
||||||
{ "─", "FloatBorder" },
|
|
||||||
{ "╰", "FloatBorder" },
|
|
||||||
{ "│", "FloatBorder" },
|
|
||||||
}
|
|
||||||
|
|
||||||
local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview
|
|
||||||
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
|
|
||||||
opts = opts or {}
|
|
||||||
opts.border = opts.border or border
|
|
||||||
return orig_util_open_floating_preview(contents, syntax, opts, ...)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
virtual_lines = true,
|
virtual_lines = true,
|
||||||
|
@ -342,16 +342,16 @@ return {
|
|||||||
-- also, we are adding a nice icon for terminal buffers.
|
-- also, we are adding a nice icon for terminal buffers.
|
||||||
local StatusLineFileFlags = {
|
local StatusLineFileFlags = {
|
||||||
{
|
{
|
||||||
condition = function(self)
|
condition = function()
|
||||||
return vim.api.nvim_buf_get_option(self.bufnr, "modified")
|
return vim.bo.modified
|
||||||
end,
|
end,
|
||||||
provider = " ",
|
provider = " ",
|
||||||
hl = { fg = colors.springGreen },
|
hl = { fg = colors.springGreen },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition = function(self)
|
condition = function()
|
||||||
return not vim.api.nvim_buf_get_option(self.bufnr, "modifiable")
|
return not vim.bo.modifiable
|
||||||
or vim.api.nvim_buf_get_option(self.bufnr, "readonly")
|
or vim.bo.readonly
|
||||||
end,
|
end,
|
||||||
provider = " ",
|
provider = " ",
|
||||||
hl = { fg = colors.roninYellow },
|
hl = { fg = colors.roninYellow },
|
||||||
@ -393,8 +393,8 @@ return {
|
|||||||
|
|
||||||
-- a nice "x" button to close the buffer
|
-- a nice "x" button to close the buffer
|
||||||
local StatusLineCloseButton = {
|
local StatusLineCloseButton = {
|
||||||
condition = function(self)
|
condition = function()
|
||||||
return not vim.api.nvim_buf_get_option(self.bufnr, "modified")
|
return not vim.bo.modified
|
||||||
end,
|
end,
|
||||||
{
|
{
|
||||||
provider = " ",
|
provider = " ",
|
||||||
@ -979,7 +979,6 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
provider = function(self)
|
provider = function(self)
|
||||||
local branch = self.status_dict.head
|
|
||||||
return " " .. self.status_dict.head
|
return " " .. self.status_dict.head
|
||||||
end,
|
end,
|
||||||
hl = { fg = colors.sumiInk0, bg = colors.autumnGreen },
|
hl = { fg = colors.sumiInk0, bg = colors.autumnGreen },
|
||||||
|
@ -12,12 +12,12 @@ return {
|
|||||||
local ignoredFiletypes = { "DiffviewFiles", "DiffviewFileHistory", "neo-tree" }
|
local ignoredFiletypes = { "DiffviewFiles", "DiffviewFileHistory", "neo-tree" }
|
||||||
local ignoredBuftypes = { "terminal" }
|
local ignoredBuftypes = { "terminal" }
|
||||||
|
|
||||||
local isDiff = vim.api.nvim_win_get_option(winid, "diff")
|
local isDiff = vim.api.nvim_get_option_value("diff", { win = winid })
|
||||||
local isFloating = vim.api.nvim_win_get_config(winid).relative ~= ""
|
local isFloating = vim.api.nvim_win_get_config(winid).relative ~= ""
|
||||||
local isIgnoredBuftype =
|
local isIgnoredBuftype =
|
||||||
vim.tbl_contains(ignoredBuftypes, vim.api.nvim_buf_get_option(bufid, "buftype"))
|
vim.tbl_contains(ignoredBuftypes, vim.api.nvim_get_option_value("buftype", { buf = bufid }))
|
||||||
local isIgnoredFiletype =
|
local isIgnoredFiletype =
|
||||||
vim.tbl_contains(ignoredFiletypes, vim.api.nvim_buf_get_option(bufid, "filetype"))
|
vim.tbl_contains(ignoredFiletypes, vim.api.nvim_get_option_value("filetype", { buf = bufid }))
|
||||||
|
|
||||||
return isDiff or isFloating or isIgnoredBuftype or isIgnoredFiletype
|
return isDiff or isFloating or isIgnoredBuftype or isIgnoredFiletype
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user