1. ZyX_I
  2. aurum

Commits

ZyX_I  committed 3355f25

Do not let buffer created by utils.run stay

  • Participants
  • Parent commits 095aa58
  • Branches default

Comments (0)

Files changed (1)

File autoload/aurum/drivers/common/utils.vim

View file
  • Ignore whitespace
         let savedeventignore=&eventignore
         let savedbufhidden=&l:bufhidden
         let savedpwd=fnamemodify('.', ':p')
-        set eventignore=all
-        set lazyredraw
-        set bufhidden=hide
+        set      eventignore=all
+        set      lazyredraw
+        setlocal bufhidden=hide
         let prevbufnr=bufnr('%')
         try
-            enew
+            silent enew
             let newbufnr=bufnr('%')
             setlocal buftype=nofile modifiable noreadonly bufhidden=wipe
             if !empty(a:cdpath)
             silent execute '%!'.join(map(copy(a:cmd), 'shellescape(v:val, 1)'))
             let r=getline(1, '$')
         finally
-            execute 'lcd' fnameescape(savedpwd)
-            if bufexists(prevbufnr)
-                execute 'silent buffer!' prevbufnr
+            if newbufnr == prevbufnr
+                silent enew!
+                execute 'lcd' fnameescape(savedpwd)
+            elseif bufexists(prevbufnr)
+                execute 'unsilent buffer!' prevbufnr
                 call setbufvar(prevbufnr, 'bufhidden', savedbufhidden)
             endif
             let &lazyredraw=savedlazyredraw