.config/nvim/lua/config/autocmds.lua

changeset 1087
bfcf9813c223
parent 1086
82f517e1ae76
child 1088
c221227cbba5
--- 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