File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1133,7 +1133,7 @@ function M.line_count(win, buf)
11331133 end
11341134end
11351135
1136- function M . zz ()
1136+ local function _zz ()
11371137 -- skip for terminal buffers
11381138 if M .is_term_buffer () then return end
11391139 local lnum1 = vim .api .nvim_win_get_cursor (0 )[1 ]
@@ -1155,6 +1155,10 @@ function M.zz()
11551155 end
11561156end
11571157
1158+ function M .zz ()
1159+ M .eventignore (_zz , " ModeChanged" )
1160+ end
1161+
11581162--- @param context vim.context.mods
11591163--- @param func function
11601164--- @return ... any
@@ -1171,9 +1175,10 @@ end
11711175function M .eventignore (func , scope )
11721176 local save_ei = vim .o .eventignore
11731177 vim .o .eventignore = scope or " all"
1174- local ret = { func ( ) }
1178+ local ret = { pcall ( func ) }
11751179 vim .o .eventignore = save_ei
1176- return unpack (ret )
1180+ if not ret [1 ] then error (ret [2 ]) end
1181+ return select (2 , unpack (ret ))
11771182end
11781183
11791184-- Set buffer for window without an autocmd
You can’t perform that action at this time.
0 commit comments