diff --git a/autoload/sy/repo.vim b/autoload/sy/repo.vim index 8602924..72a32d6 100644 --- a/autoload/sy/repo.vim +++ b/autoload/sy/repo.vim @@ -162,13 +162,8 @@ endfunction " Function: #get_diff_perforce {{{1 function! sy#repo#get_diff_perforce() abort - if has('win32') || has ('win64') - let null = 'NUL' - else - let null = '/dev/null' - endif let diffoptions = has_key(g:signify_diffoptions, 'perforce') ? g:signify_diffoptions.perforce : '' - let diff = system('p4 monitor show 2>&1 >' . null . ' && env P4DIFF=diff p4 diff -dU0 '. diffoptions .' '. sy#util#escape(b:sy.path)) + let diff = system('p4 monitor show 2>&1 >' . sy#util#devnull() . ' && env P4DIFF=diff p4 diff -dU0 '. diffoptions .' '. sy#util#escape(b:sy.path)) return v:shell_error ? [0, ''] : [1, diff] endfunction diff --git a/autoload/sy/util.vim b/autoload/sy/util.vim index 402112f..7693c2a 100644 --- a/autoload/sy/util.vim +++ b/autoload/sy/util.vim @@ -75,3 +75,13 @@ function! sy#util#hunk_text_object(emptylines) abort execute hunks[0].end endif endfunction + +" Function: #devnull {{{1 +function! sy#util#devnull() abort + if has('win32') || has ('win64') + let null = 'NUL' + else + let null = '/dev/null' + endif + return null +endfunction