Move variables to the bottom

This commit is contained in:
Marco Hinz 2015-05-20 13:11:26 +02:00
parent 1469ecb05f
commit ae38ddc7f6

View File

@ -2,55 +2,6 @@
scriptencoding utf-8 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: #detect {{{1
function! sy#repo#detect() abort function! sy#repo#detect() abort
let s:info = { let s:info = {
@ -59,8 +10,6 @@ function! sy#repo#detect() abort
\ 'dir': fnamemodify(b:sy.path, ':p:h'), \ 'dir': fnamemodify(b:sy.path, ':p:h'),
\ 'path': s:escape(b:sy.path), \ 'path': s:escape(b:sy.path),
\ 'file': s:escape(fnamemodify(b:sy.path, ':t')), \ 'file': s:escape(fnamemodify(b:sy.path, ':t')),
\ 'difftool': s:escape(s:difftool),
\ 'devnull': s:devnull(),
\ } \ }
let vcs_list = s:vcs_list let vcs_list = s:vcs_list
@ -152,11 +101,6 @@ function! sy#repo#get_stats() abort
return b:sy.stats return b:sy.stats
endfunction 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 {{{1
function! s:escape(path) abort function! s:escape(path) abort
if exists('+shellslash') if exists('+shellslash')
@ -180,8 +124,8 @@ endfunction
" Function: s:run {{{1 " Function: s:run {{{1
function! s:run(cmd, path, do_switch_dir) abort function! s:run(cmd, path, do_switch_dir) abort
let cmd = substitute(a:cmd, '%f', a:path, '') let cmd = substitute(a:cmd, '%f', a:path, '')
let cmd = substitute(cmd, '%d', s:info.difftool, '') let cmd = substitute(cmd, '%d', s:difftool, '')
let cmd = substitute(cmd, '%n', s:info.devnull, '') let cmd = substitute(cmd, '%n', s:devnull, '')
if a:do_switch_dir if a:do_switch_dir
try try
@ -196,3 +140,54 @@ function! s:run(cmd, path, do_switch_dir) abort
return system(cmd) return system(cmd)
endfunction 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'