"Use vimproc if available under windows to prevent opening a console window function! merginal#system(command,...) if has('win32') && exists(':VimProcBang') "We don't need vimproc when we use linux if empty(a:000) return vimproc#system(a:command) else return vimproc#system(a:command,a:000[0]) endif else if empty(a:000) return system(a:command) else return system(a:command,a:000[0]) endif endif endfunction function! merginal#bang(command) if exists(':terminal') redraw "Release 'Press ENTER or type command to continue' let l:oldWinView = winsaveview() botright new call winrestview(l:oldWinView) resize 5 call termopen(a:command) autocmd BufWinLeave execute winnr('#').'wincmd w' normal! A else execute '!'.a:command endif endfunction "Opens a file that belongs to a repo in a window that already belongs to that "repo. Creates a new window if can't find suitable window. function! merginal#openFileDecidedWindow(repo,fileName) "We have to check with bufexists, because bufnr also match prefixes of the "file name let l:fileBuffer=-1 if bufexists(a:fileName) let l:fileBuffer=bufnr(a:fileName) endif "We have to check with bufloaded, because bufwinnr also matches closed "windows... let l:windowToOpenIn=-1 if bufloaded(l:fileBuffer) let l:windowToOpenIn=bufwinnr(l:fileBuffer) endif "If we found an open window with the correct file, we jump to it if -1