refactor(nvim): general cleanup of deprecated functions and diags

This commit is contained in:
Price Hiller 2024-02-19 04:30:05 -06:00
parent 336919dc2b
commit 9dae85a4a3
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
8 changed files with 14 additions and 36 deletions

View File

@ -1 +1 @@
vim.api.nvim_buf_set_option(0, "commentstring", "// %s")
vim.opt_local.commentstring = "// %s"

View File

@ -1 +1 @@
vim.api.nvim_buf_set_option(0, "commentstring", "{# %s #}")
vim.opt_local.commentstring = "{# %s #}"

View File

@ -2,8 +2,7 @@ local opt_local = vim.opt_local
opt_local.tabstop = 2
opt_local.shiftwidth = 2
vim.api.nvim_buf_set_option(0, "commentstring", "# %s")
opt_local.commenstring = "# %s"
vim.keymap.set("n", "<leader>fr", function()
local cmd = {

View File

@ -21,7 +21,7 @@ M.setup = function()
title = "Strip Trail Space",
---@param win integer The window handle
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, { desc = "Toggles intercepting BufWritePre to strip trail space" })

View File

@ -1,5 +1,3 @@
local g = vim.g
local M = {}
M.setup = function() end

View File

@ -11,24 +11,6 @@ M.setup = function()
lspSymbol("Info", "󰋼", 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({
virtual_text = false,
virtual_lines = true,

View File

@ -342,16 +342,16 @@ return {
-- also, we are adding a nice icon for terminal buffers.
local StatusLineFileFlags = {
{
condition = function(self)
return vim.api.nvim_buf_get_option(self.bufnr, "modified")
condition = function()
return vim.bo.modified
end,
provider = "",
hl = { fg = colors.springGreen },
},
{
condition = function(self)
return not vim.api.nvim_buf_get_option(self.bufnr, "modifiable")
or vim.api.nvim_buf_get_option(self.bufnr, "readonly")
condition = function()
return not vim.bo.modifiable
or vim.bo.readonly
end,
provider = "",
hl = { fg = colors.roninYellow },
@ -393,8 +393,8 @@ return {
-- a nice "x" button to close the buffer
local StatusLineCloseButton = {
condition = function(self)
return not vim.api.nvim_buf_get_option(self.bufnr, "modified")
condition = function()
return not vim.bo.modified
end,
{
provider = " 󰅙 ",
@ -979,7 +979,6 @@ return {
},
{
provider = function(self)
local branch = self.status_dict.head
return " " .. self.status_dict.head
end,
hl = { fg = colors.sumiInk0, bg = colors.autumnGreen },

View File

@ -12,12 +12,12 @@ return {
local ignoredFiletypes = { "DiffviewFiles", "DiffviewFileHistory", "neo-tree" }
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 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 =
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
end,