@@ -107,9 +107,7 @@ function TSContext.update(winid, bufnr, opts)
107107 if win and api .nvim_win_is_valid (win ) and api .nvim_win_get_config (win ).zindex ~= zindex then
108108 api .nvim_win_set_config (win , { zindex = zindex })
109109 -- noautocmd don't ignore WinResized/WinScrolled
110- if fn .exists (" +eventignorewin" ) == 1 and vim .wo [win ][0 ].eventignorewin == " " then
111- vim .wo [win ][0 ].eventignorewin = " WinResized"
112- end
110+ utils .wo [win ].eventignorewin = " WinResized"
113111 end
114112 end
115113 api .nvim_win_call (winid , function ()
@@ -1053,11 +1051,11 @@ function Previewer.base:attach_snacks_image_inline()
10531051 if not ft then return end
10541052 _G ._fzf_lua_snacks_langs = _G ._fzf_lua_snacks_langs or simg .langs ()
10551053 if not vim .tbl_contains (_G ._fzf_lua_snacks_langs , vim .treesitter .language .get_lang (ft )) then
1056- vim .wo [preview_winid ].winblend = self .winblend
1054+ utils .wo [preview_winid ].winblend = self .winblend
10571055 return
10581056 end
10591057
1060- vim .wo [preview_winid ].winblend = 0 -- https://github.com/folke/snacks.nvim/pull/1615
1058+ utils .wo [preview_winid ].winblend = 0 -- https://github.com/folke/snacks.nvim/pull/1615
10611059 vim .b [bufnr ].snacks_image_attached = simg .inline .new (bufnr )
10621060 vim .defer_fn (function ()
10631061 self .win :update_preview_scrollbar ()
@@ -1121,7 +1119,7 @@ function Previewer.buffer_or_file:do_syntax(entry)
11211119 -- nvim_buf_call has less side-effects than window switch
11221120 -- doautocmd filetypedetect BufRead (vim.filetype.match + ftdetect) + do_modeline
11231121 local ok , _ = pcall (api .nvim_buf_call , bufnr , function ()
1124- utils .eventignore (function () vim .cmd (" filetype detect" ) end , preview_winid , " FileType" )
1122+ utils .eventignore (function () vim .cmd (" filetype detect" ) end , " FileType" )
11251123 end )
11261124 if not ok then
11271125 utils .warn ((" ':filetype detect' failed for '%s'" ):format (entry .path or " <null>" ))
@@ -1172,9 +1170,7 @@ function Previewer.base:maybe_set_cursorline(win, pos)
11721170 vim .api .nvim_win_set_cursor (win , pos )
11731171 cursorline = self .winopts .cursorline
11741172 end
1175- if cursorline ~= vim .wo [win ].cursorline then
1176- vim .wo [win ].cursorline = cursorline
1177- end
1173+ utils .wo [win ].cursorline = cursorline
11781174end
11791175
11801176function Previewer .buffer_or_file :set_cursor_hl (entry )
@@ -1211,7 +1207,7 @@ function Previewer.buffer_or_file:set_cursor_hl(entry)
12111207 local lnum , col = tonumber (entry .line ), tonumber (entry .col ) or 0
12121208 if not lnum or lnum < 1 then
12131209 -- set win option is slow with bigfile
1214- if vim .wo .cursorline then vim . wo . cursorline = false end
1210+ utils .wo .cursorline = false
12151211 self .orig_pos = { 1 , 0 }
12161212 api .nvim_win_set_cursor (self .win .preview_winid , cached_pos or self .orig_pos )
12171213 return
0 commit comments