Skip to content

Commit

Permalink
refactor(init): use argument for BufUnload callback to get bufnr
Browse files Browse the repository at this point in the history
  • Loading branch information
jhofscheier committed Aug 12, 2023
1 parent ca9fa73 commit 8c6ef83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua/ltex-utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ local rule_ui = require("ltex-utils.rule_ui")

-- Writes current LTeX LSP server settings to file
---@return string|nil # error message if writing to file fails
local function on_exit()
local function on_exit(bufmeta)
---@type integer
local bufnr = vim.api.nvim_get_current_buf()
local bufnr = bufmeta.buf

-- delete current buffer from windows list
builtin.wins[bufnr] = nil

---@type boolean, string|nil
local ok, err = pcall(ltex.write_ltex_to_file)
local ok, err = pcall(ltex.write_ltex_to_file, bufnr)

if not ok then
vim.notify("Error on exit: " .. vim.inspect(err), vim.log.levels.ERROR)
Expand Down

0 comments on commit 8c6ef83

Please sign in to comment.