From ec14fc3dcb355a12df92f77073ad09ec8ebc36c2 Mon Sep 17 00:00:00 2001 From: Dom324 Date: Thu, 3 Jul 2025 11:40:11 +0200 Subject: [PATCH] fix: Exec BufRead and BufReadPre after load --- lua/resession/init.lua | 3 +++ lua/resession/layout.lua | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lua/resession/init.lua b/lua/resession/init.lua index 11cae08..00fcd9e 100644 --- a/lua/resession/init.lua +++ b/lua/resession/init.lua @@ -621,6 +621,9 @@ M.load = function(name, opts) _is_loading = false dispatch("post_load", name, opts) + vim.api.nvim_exec_autocmds("BufReadPre", {}) + vim.api.nvim_exec_autocmds("BufRead", {}) + -- In case the current buffer has a swapfile, make sure we trigger all the necessary autocmds vim.b._resession_need_edit = nil vim.cmd.edit({ mods = { emsg_silent = true } }) diff --git a/lua/resession/layout.lua b/lua/resession/layout.lua index 23e73b2..b1bc50f 100644 --- a/lua/resession/layout.lua +++ b/lua/resession/layout.lua @@ -145,10 +145,6 @@ local function set_winlayout_data(layout, scale_factor, visit_data) else local bufnr = vim.fn.bufadd(win.bufname) vim.api.nvim_win_set_buf(win.winid, bufnr) - -- After setting the buffer into the window, manually set the filetype to trigger syntax highlighting - vim.o.eventignore = "" - vim.bo[bufnr].filetype = vim.bo[bufnr].filetype - vim.o.eventignore = "all" vim.b[bufnr].resession_restore_last_pos = nil end util.restore_win_options(win.winid, win.options)