Minor syntactic style changes

This commit is contained in:
Marco Hinz 2013-08-07 15:46:37 +02:00
parent 52d025975b
commit 78a96c4b49
2 changed files with 23 additions and 43 deletions

View File

@ -24,7 +24,7 @@ else
endif endif
endif endif
let s:diffoptions = '' let s:diffoptions = get(g:, 'signify_diffoptions', {})
" Function: #detect {{{1 " Function: #detect {{{1
function! sy#repo#detect(path) abort function! sy#repo#detect(path) abort
@ -41,10 +41,8 @@ endfunction
" Function: #get_diff_git {{{1 " Function: #get_diff_git {{{1
function! sy#repo#get_diff_git(path) abort function! sy#repo#get_diff_git(path) abort
if executable('git') if executable('git')
if exists('g:signify_diffoptions["git"]') let diffoptions = has_key(s:diffoptions, 'git') ? s:diffoptions.git : ''
let s:diffoptions = g:signify_diffoptions['git'] let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && git diff --no-ext-diff -U0 '. diffoptions .' -- '. sy#util#escape(a:path))
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && git diff --no-ext-diff -U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction
@ -83,10 +81,8 @@ endfunction
" Function: #get_diff_hg {{{1 " Function: #get_diff_hg {{{1
function! sy#repo#get_diff_hg(path) abort function! sy#repo#get_diff_hg(path) abort
if executable('hg') if executable('hg')
if exists('g:signify_diffoptions["hg"]') let diffoptions = has_key(s:diffoptions, 'hg') ? s:diffoptions.hg : ''
let s:diffoptions = g:signify_diffoptions['hg'] let diff = system('hg diff --nodates -U0 '. diffoptions .' -- '. sy#util#escape(a:path))
endif
let diff = system('hg diff --nodates -U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction
@ -94,10 +90,8 @@ endfunction
" Function: #get_diff_svn {{{1 " Function: #get_diff_svn {{{1
function! sy#repo#get_diff_svn(path) abort function! sy#repo#get_diff_svn(path) abort
if executable('svn') if executable('svn')
if exists('g:signify_diffoptions["svn"]') let diffoptions = has_key(s:diffoptions, 'svn') ? s:diffoptions.svn : ''
let s:diffoptions = g:signify_diffoptions['svn'] let diff = system('svn diff --diff-cmd '. s:difftool .' -x -U0 '. diffoptions .' -- '. sy#util#escape(a:path))
endif
let diff = system('svn diff --diff-cmd '. s:difftool .' -x -U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction
@ -105,10 +99,8 @@ endfunction
" Function: #get_diff_bzr {{{1 " Function: #get_diff_bzr {{{1
function! sy#repo#get_diff_bzr(path) abort function! sy#repo#get_diff_bzr(path) abort
if executable('bzr') if executable('bzr')
if exists('g:signify_diffoptions["bzr"]') let diffoptions = has_key(s:diffoptions, 'bzr') ? s:diffoptions.bzr : ''
let s:diffoptions = g:signify_diffoptions['bzr'] let diff = system('bzr diff --using '. s:difftool .' --diff-options=-U0 '. diffoptions .' -- '. sy#util#escape(a:path))
endif
let diff = system('bzr diff --using '. s:difftool .' --diff-options=-U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
return ((v:shell_error == 0) || (v:shell_error == 1) || (v:shell_error == 2)) ? diff : '' return ((v:shell_error == 0) || (v:shell_error == 1) || (v:shell_error == 2)) ? diff : ''
endif endif
endfunction endfunction
@ -116,10 +108,8 @@ endfunction
" Function: #get_diff_darcs {{{1 " Function: #get_diff_darcs {{{1
function! sy#repo#get_diff_darcs(path) abort function! sy#repo#get_diff_darcs(path) abort
if executable('darcs') if executable('darcs')
if exists('g:signify_diffoptions["darcs"]') let diffoptions = has_key(s:diffoptions, 'darcs') ? s:diffoptions.darcs : ''
let s:diffoptions = g:signify_diffoptions['darcs'] let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && darcs diff --no-pause-for-gui --diff-command="'. s:difftool .' -U0 %1 %2" '. diffoptions .' -- '. sy#util#escape(a:path))
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && darcs diff --no-pause-for-gui --diff-command="'. s:difftool .' -U0 %1 %2" '. s:diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction
@ -127,10 +117,8 @@ endfunction
" Function: #get_diff_fossil {{{1 " Function: #get_diff_fossil {{{1
function! sy#repo#get_diff_fossil(path) abort function! sy#repo#get_diff_fossil(path) abort
if executable('fossil') if executable('fossil')
if exists('g:signify_diffoptions["fossil"]') let diffoptions = has_key(s:diffoptions, 'fossil') ? s:diffoptions.fossil : ''
let s:diffoptions = g:signify_diffoptions['fossil'] let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && fossil set diff-command "'. s:difftool .' -U 0" && fossil diff --unified -c 0 '. diffoptions .' -- '. sy#util#escape(a:path))
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && fossil set diff-command "'. s:difftool .' -U 0" && fossil diff --unified -c 0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction
@ -138,10 +126,8 @@ endfunction
" Function: #get_diff_cvs {{{1 " Function: #get_diff_cvs {{{1
function! sy#repo#get_diff_cvs(path) abort function! sy#repo#get_diff_cvs(path) abort
if executable('cvs') if executable('cvs')
if exists('g:signify_diffoptions["cvs"]') let diffoptions = has_key(s:diffoptions, 'cvs') ? s:diffoptions.cvs : ''
let s:diffoptions = g:signify_diffoptions['cvs'] let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && cvs diff -U0 '. diffoptions .' -- '. sy#util#escape(fnamemodify(a:path, ':t')))
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && cvs diff -U0 '. s:diffoptions .' -- '. sy#util#escape(fnamemodify(a:path, ':t')))
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction
@ -149,10 +135,8 @@ endfunction
" Function: #get_diff_rcs {{{1 " Function: #get_diff_rcs {{{1
function! sy#repo#get_diff_rcs(path) abort function! sy#repo#get_diff_rcs(path) abort
if executable('rcs') if executable('rcs')
if exists('g:signify_diffoptions["rcs"]') let diffoptions = has_key(s:diffoptions, 'rcs') ? s:diffoptions.rcs : ''
let s:diffoptions = g:signify_diffoptions['rcs'] let diff = system('rcsdiff -U0 '. diffoptions .' '. sy#util#escape(a:path) .' 2>/dev/null')
endif
let diff = system('rcsdiff -U0 '. s:diffoptions .' '. sy#util#escape(a:path) .' 2>/dev/null')
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction
@ -160,10 +144,8 @@ endfunction
" Function: #get_diff_accurev {{{1 " Function: #get_diff_accurev {{{1
function! sy#repo#get_diff_accurev(path) abort function! sy#repo#get_diff_accurev(path) abort
if executable('accurev') if executable('accurev')
if exists('g:signify_diffoptions["accurev"]') let diffoptions = has_key(s:diffoptions, 'accurev') ? s:diffoptions.accurev : ''
let s:diffoptions = g:signify_diffoptions['accurev'] let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && accurev diff '. sy#util#escape(fnamemodify(a:path, ':t')) . ' -- -U0 '. diffoptions)
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && accurev diff '. sy#util#escape(fnamemodify(a:path, ':t')) . ' -- -U0 '. s:diffoptions)
return (v:shell_error != 1) ? '' : diff return (v:shell_error != 1) ? '' : diff
endif endif
endfunction endfunction
@ -171,10 +153,8 @@ endfunction
" Function: #get_diff_perforce {{{1 " Function: #get_diff_perforce {{{1
function! sy#repo#get_diff_perforce(path) abort function! sy#repo#get_diff_perforce(path) abort
if executable('p4') if executable('p4')
if exists('g:signify_diffoptions["perforce"]') let diffoptions = has_key(s:diffoptions, 'perforce') ? s:diffoptions.perforce : ''
let s:diffoptions = g:signify_diffoptions['perforce'] let diff = system('env P4DIFF=diff p4 diff -dU0 '. diffoptions .' -- '. sy#util#escape(a:path))
endif
let diff = system('env P4DIFF=diff p4 diff -dU0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff return v:shell_error ? '' : diff
endif endif
endfunction endfunction

View File

@ -212,10 +212,10 @@ Default: Does not exist.
let g:signify_diffoptions = { 'git': '-w', 'hg': '-w' } let g:signify_diffoptions = { 'git': '-w', 'hg': '-w' }
Default: No additional options.
This will pass the given additional options to the selected VCS diff command. This will pass the given additional options to the selected VCS diff command.
Default: Does not exist.
============================================================================== ==============================================================================
4. Commands *signify-commands* 4. Commands *signify-commands*