Skip to content

Commit

Permalink
Merge pull request #57 from mistweaverco/fix/augroup
Browse files Browse the repository at this point in the history
fix(autocmd): add augroup
  • Loading branch information
gorillamoe authored Jul 15, 2024
2 parents 3f296d4 + 571e439 commit 29e23d7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lua/kulala/globals/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local FS = require("kulala.utils.fs")

local M = {}

M.VERSION = "2.2.1"
M.VERSION = "2.2.2"
M.UI_ID = "kulala://ui"
M.HEADERS_FILE = FS.get_plugin_tmp_dir() .. "/headers.txt"
M.BODY_FILE = FS.get_plugin_tmp_dir() .. "/body.txt"
Expand Down
4 changes: 3 additions & 1 deletion lua/kulala/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ end
-- Create an autocmd to delete the buffer when the window is closed
-- This is necessary to prevent the buffer from being left behind
-- when the window is closed
local augroup = vim.api.nvim_create_augroup("kulala_window_closed", { clear = true })
vim.api.nvim_create_autocmd("WinClosed", {
group = augroup,
callback = function(args)
-- if the window path is the same as the GLOBALS.UI_ID and the buffer exists
if args.buf == get_buffer() then
Expand Down Expand Up @@ -114,7 +116,7 @@ M.show_headers = function()
open_buffer()
end
local h = FS.read_file(GLOBALS.HEADERS_FILE)
h = h:gsub('\r\n', '\n')
h = h:gsub("\r\n", "\n")
set_buffer_contents(h, "plaintext")
else
vim.notify("No headers found", vim.log.levels.WARN)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "kulala.nvim",
"version": "2.2.1"
"version": "2.2.2"
}

0 comments on commit 29e23d7

Please sign in to comment.