Work around separator issues
Use split() instead of substitute(), since the latter simply parses strings and doesn't understand the notion of path separators. Backslashes would be interpreted as beginning escape sequences. Using split() works around this problem. Closes #163.
This commit is contained in:
parent
8c5ad74a7b
commit
021b801eb4
@ -135,9 +135,9 @@ endfunction
|
||||
|
||||
" Function: s:expand_cmd {{{1
|
||||
function! s:expand_cmd(cmd, path) abort
|
||||
let cmd = substitute(a:cmd, '%f', a:path, '')
|
||||
let cmd = substitute(cmd, '%d', s:difftool, '')
|
||||
let cmd = substitute(cmd, '%n', s:devnull, '')
|
||||
let cmd = s:replace(a:cmd, '%f', a:path)
|
||||
let cmd = s:replace(cmd, '%d', s:difftool)
|
||||
let cmd = s:replace(cmd, '%n', s:devnull)
|
||||
let b:sy_info.cmd = cmd
|
||||
return cmd
|
||||
endfunction
|
||||
@ -159,6 +159,16 @@ function! s:run(cmd, path, do_switch_dir)
|
||||
return system(cmd)
|
||||
endfunction
|
||||
|
||||
" Function: s:replace {{{1
|
||||
function! s:replace(cmd, pat, sub)
|
||||
let tmp = split(a:cmd, a:pat, 1)
|
||||
if len(tmp) > 1
|
||||
return tmp[0] . a:sub . tmp[1]
|
||||
else
|
||||
return a:cmd
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Variables {{{1
|
||||
let s:difftool = get(g:, 'signify_difftool', 'diff')
|
||||
if executable(s:difftool)
|
||||
|
Loading…
Reference in New Issue
Block a user