try to fix stopinsert/autowrite again

Tue, 14 Mar 2023 22:56:37 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Tue, 14 Mar 2023 22:56:37 -0500
changeset 1087
bfcf9813c223
parent 1086
82f517e1ae76
child 1088
c221227cbba5

try to fix stopinsert/autowrite again

.config/nvim/lua/config/autocmds.lua file | annotate | diff | comparison | revisions
--- a/.config/nvim/lua/config/autocmds.lua
+++ b/.config/nvim/lua/config/autocmds.lua
@@ -14,14 +14,12 @@ autocmd(g, "FocusGained", "*", cmd.check
 -- >> autowriteall improvment
 -- Stopinsert on leave, or autowriteall doesn't work.
 autocmd(g, { "WinLeave", "FocusLost" }, "*", function()
-  if not fn.pumvisible() then
+  if fn.pumvisible() == 0 then
     fn.stopinsert()
   end
+  cmd.wa()
 end)
 
--- write all on leave
-autocmd(g, "FocusLost", "*", cmd.wa)
-
 -- >> auto mkpath on write
 autocmd(g, "BufWritePre", "*", {
   callback = function(ctx)

mercurial