Merge pull request #405 from willothy/deprecations

refactor: remove uses of deprecated `buf_set_option`
This commit is contained in:
ThePrimeagen 2023-12-10 18:32:55 -07:00 committed by GitHub
commit f7d3c7360d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -45,7 +45,9 @@ function M.setup_autocmds_and_keymaps(bufnr)
vim.api.nvim_buf_set_name(bufnr, get_harpoon_menu_name()) vim.api.nvim_buf_set_name(bufnr, get_harpoon_menu_name())
end end
vim.api.nvim_buf_set_option(bufnr, "filetype", "harpoon") vim.api.nvim_set_option_value("filetype", "harpoon", {
buf = bufnr,
})
vim.keymap.set("n", "q", function() vim.keymap.set("n", "q", function()
M.run_toggle_command("q") M.run_toggle_command("q")
end, { buffer = bufnr, silent = true }) end, { buffer = bufnr, silent = true })

View File

@ -114,7 +114,9 @@ function M.get_default_config()
end end
if not vim.api.nvim_buf_is_loaded(bufnr) then if not vim.api.nvim_buf_is_loaded(bufnr) then
vim.fn.bufload(bufnr) vim.fn.bufload(bufnr)
vim.api.nvim_buf_set_option(bufnr, "buflisted", true) vim.api.nvim_set_option_value("buflisted", true, {
buf = bufnr,
})
end end
if options.vsplit then if options.vsplit then

View File

@ -55,7 +55,9 @@ end
---@param contents string[] ---@param contents string[]
function M.create_file(name, contents, row, col) function M.create_file(name, contents, row, col)
local bufnr = vim.fn.bufnr(name, true) local bufnr = vim.fn.bufnr(name, true)
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "hide") vim.api.nvim_set_option_value("bufhidden", "hide", {
buf = bufnr,
})
vim.api.nvim_set_current_buf(bufnr) vim.api.nvim_set_current_buf(bufnr)
vim.api.nvim_buf_set_text(0, 0, 0, 0, 0, contents) vim.api.nvim_buf_set_text(0, 0, 0, 0, 0, contents)
if row then if row then

View File

@ -97,7 +97,9 @@ function HarpoonUI:_create_window(toggle_opts)
Buffer.setup_autocmds_and_keymaps(bufnr) Buffer.setup_autocmds_and_keymaps(bufnr)
self.win_id = win_id self.win_id = win_id
vim.api.nvim_win_set_option(win_id, "number", true) vim.api.nvim_set_option_value("number", true, {
win = win_id
})
Listeners.listeners:emit(Listeners.event_names.UI_CREATE, { Listeners.listeners:emit(Listeners.event_names.UI_CREATE, {
win_id = win_id, win_id = win_id,