Move variables to the bottom
This commit is contained in:
parent
1469ecb05f
commit
ae38ddc7f6
@ -2,55 +2,6 @@
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
" Init: values {{{1
|
||||
let s:difftool = get(g:, 'signify_difftool', 'diff')
|
||||
if executable(s:difftool)
|
||||
let s:vcs_dict = {
|
||||
\ 'git': 'git',
|
||||
\ 'hg': 'hg',
|
||||
\ 'svn': 'svn',
|
||||
\ 'darcs': 'darcs',
|
||||
\ 'bzr': 'bzr',
|
||||
\ 'fossil': 'fossil',
|
||||
\ 'cvs': 'cvs',
|
||||
\ 'rcs': 'rcsdiff',
|
||||
\ 'accurev': 'accurev',
|
||||
\ 'perforce': 'p4'
|
||||
\ }
|
||||
else
|
||||
echomsg 'signify: No diff tool found -> no support for svn, darcs, bzr, fossil.'
|
||||
let s:vcs_dict = {
|
||||
\ 'git': 'git',
|
||||
\ 'hg': 'hg',
|
||||
\ 'cvs': 'cvs',
|
||||
\ 'rcs': 'rcsdiff',
|
||||
\ 'accurev': 'accurev',
|
||||
\ 'perforce': 'p4'
|
||||
\ }
|
||||
endif
|
||||
|
||||
let s:vcs_list = get(g:, 'signify_vcs_list', [])
|
||||
if empty(s:vcs_list)
|
||||
let s:vcs_list = keys(filter(s:vcs_dict, 'executable(v:val)'))
|
||||
endif
|
||||
|
||||
let s:diffcmds = {
|
||||
\ 'git': 'git diff --no-color --no-ext-diff -U0 -- %f',
|
||||
\ 'hg': 'hg diff --config extensions.color=! --config defaults.diff= --nodates -U0 -- %f',
|
||||
\ 'svn': 'svn diff --diff-cmd %d -x -U0 -- %f',
|
||||
\ 'bzr': 'bzr diff --using %d --diff-options=-U0 -- %f',
|
||||
\ 'darcs': 'darcs diff --no-pause-for-gui --diff-command="%d -U0 %1 %2" -- %f',
|
||||
\ 'fossil': 'fossil set diff-command "%d -U 0" && fossil diff --unified -c 0 -- %f',
|
||||
\ 'cvs': 'cvs diff -U0 -- %f',
|
||||
\ 'rcs': 'rcsdiff -U0 %f 2>/dev/null',
|
||||
\ 'accurev': 'accurev diff %f -- -U0',
|
||||
\ 'perforce': 'p4 info 2>&1 >%n && env P4DIFF=diff p4 diff -dU0 %f',
|
||||
\ }
|
||||
|
||||
if exists('g:signify_vcs_cmds')
|
||||
call extend(s:diffcmds, g:signify_vcs_cmds)
|
||||
endif
|
||||
|
||||
" Function: #detect {{{1
|
||||
function! sy#repo#detect() abort
|
||||
let s:info = {
|
||||
@ -59,8 +10,6 @@ function! sy#repo#detect() abort
|
||||
\ 'dir': fnamemodify(b:sy.path, ':p:h'),
|
||||
\ 'path': s:escape(b:sy.path),
|
||||
\ 'file': s:escape(fnamemodify(b:sy.path, ':t')),
|
||||
\ 'difftool': s:escape(s:difftool),
|
||||
\ 'devnull': s:devnull(),
|
||||
\ }
|
||||
|
||||
let vcs_list = s:vcs_list
|
||||
@ -152,11 +101,6 @@ function! sy#repo#get_stats() abort
|
||||
return b:sy.stats
|
||||
endfunction
|
||||
|
||||
" Function: s:devnull {{{1
|
||||
function! s:devnull() abort
|
||||
return has('win32') || has ('win64') ? 'NUL' : '/dev/null'
|
||||
endfunction
|
||||
|
||||
" Function: s:escape {{{1
|
||||
function! s:escape(path) abort
|
||||
if exists('+shellslash')
|
||||
@ -179,9 +123,9 @@ endfunction
|
||||
|
||||
" Function: s:run {{{1
|
||||
function! s:run(cmd, path, do_switch_dir) abort
|
||||
let cmd = substitute(a:cmd, '%f', a:path, '')
|
||||
let cmd = substitute(cmd, '%d', s:info.difftool, '')
|
||||
let cmd = substitute(cmd, '%n', s:info.devnull, '')
|
||||
let cmd = substitute(a:cmd, '%f', a:path, '')
|
||||
let cmd = substitute(cmd, '%d', s:difftool, '')
|
||||
let cmd = substitute(cmd, '%n', s:devnull, '')
|
||||
|
||||
if a:do_switch_dir
|
||||
try
|
||||
@ -196,3 +140,54 @@ function! s:run(cmd, path, do_switch_dir) abort
|
||||
return system(cmd)
|
||||
endfunction
|
||||
|
||||
" s:vars {{{1
|
||||
let s:difftool = get(g:, 'signify_difftool', 'diff')
|
||||
if executable(s:difftool)
|
||||
let s:vcs_dict = {
|
||||
\ 'git': 'git',
|
||||
\ 'hg': 'hg',
|
||||
\ 'svn': 'svn',
|
||||
\ 'darcs': 'darcs',
|
||||
\ 'bzr': 'bzr',
|
||||
\ 'fossil': 'fossil',
|
||||
\ 'cvs': 'cvs',
|
||||
\ 'rcs': 'rcsdiff',
|
||||
\ 'accurev': 'accurev',
|
||||
\ 'perforce': 'p4'
|
||||
\ }
|
||||
else
|
||||
echomsg 'signify: No diff tool found -> no support for svn, darcs, bzr, fossil.'
|
||||
let s:vcs_dict = {
|
||||
\ 'git': 'git',
|
||||
\ 'hg': 'hg',
|
||||
\ 'cvs': 'cvs',
|
||||
\ 'rcs': 'rcsdiff',
|
||||
\ 'accurev': 'accurev',
|
||||
\ 'perforce': 'p4'
|
||||
\ }
|
||||
endif
|
||||
|
||||
let s:vcs_list = get(g:, 'signify_vcs_list', [])
|
||||
if empty(s:vcs_list)
|
||||
let s:vcs_list = keys(filter(s:vcs_dict, 'executable(v:val)'))
|
||||
endif
|
||||
|
||||
let s:diffcmds = {
|
||||
\ 'git': 'git diff --no-color --no-ext-diff -U0 -- %f',
|
||||
\ 'hg': 'hg diff --config extensions.color=! --config defaults.diff= --nodates -U0 -- %f',
|
||||
\ 'svn': 'svn diff --diff-cmd %d -x -U0 -- %f',
|
||||
\ 'bzr': 'bzr diff --using %d --diff-options=-U0 -- %f',
|
||||
\ 'darcs': 'darcs diff --no-pause-for-gui --diff-command="%d -U0 %1 %2" -- %f',
|
||||
\ 'fossil': 'fossil set diff-command "%d -U 0" && fossil diff --unified -c 0 -- %f',
|
||||
\ 'cvs': 'cvs diff -U0 -- %f',
|
||||
\ 'rcs': 'rcsdiff -U0 %f 2>/dev/null',
|
||||
\ 'accurev': 'accurev diff %f -- -U0',
|
||||
\ 'perforce': 'p4 info 2>&1 >%n && env P4DIFF=diff p4 diff -dU0 %f',
|
||||
\ }
|
||||
|
||||
if exists('g:signify_vcs_cmds')
|
||||
call extend(s:diffcmds, g:signify_vcs_cmds)
|
||||
endif
|
||||
|
||||
let s:difftool = s:escape(s:difftool)
|
||||
let s:devnull = has('win32') || has ('win64') ? 'NUL' : '/dev/null'
|
||||
|
Loading…
Reference in New Issue
Block a user