Commits

ZyX_I committed c4907c2

@/os: Modify s:F.run so that it can be used from the statusline.
Note: new version will overwrite information previously used directory

Comments (0)

Files changed (1)

plugin/frawor/os.vim

         \}
 function s:F.run(cmd, ...)
     try
-        if a:0
+        let hasnls=(stridx(a:cmd, "\n")!=-1)
+        if hasnls
             let savedopts={}
             for [opt, val] in items(s:opts)
                 let savedopts[opt]=eval('&g:'.opt)
                 execute 'let &g:'.opt.'=val'
             endfor
-            new
-            if !s:os.chdir(a:1, 1)
+        endif
+        if a:0
+            if !s:os.chdir(a:1)
                 return -1
             endif
         endif
-        execute 'silent! !'.a:cmd
+        if hasnls
+            execute 'silent! !'.a:cmd
+        else
+            call system(a:cmd)
+        endif
         return v:shell_error
     finally
+        if a:0
+            cd -
+        endif
         if exists('savedopts')
             for [opt, val] in items(savedopts)
                 execute 'let &g:'.opt.'=val'
             endfor
-            bwipeout!
             redraw!
         endif
     endtry