[Helptags] Windows support (#423)
This commit is contained in:
parent
7e868c49ac
commit
914355df94
1 changed files with 10 additions and 5 deletions
|
@ -942,17 +942,22 @@ function! s:helptag_sink(line)
|
|||
endfunction
|
||||
|
||||
function! fzf#vim#helptags(...)
|
||||
if !executable('perl')
|
||||
return s:warn('Helptags command requires perl')
|
||||
if !executable('grep') || !executable('perl')
|
||||
return s:warn('Helptags command requires grep and perl')
|
||||
endif
|
||||
let sorted = sort(split(globpath(&runtimepath, 'doc/tags'), '\n'))
|
||||
let tags = exists('*uniq') ? uniq(sorted) : fzf#vim#_uniq(sorted)
|
||||
|
||||
if exists('s:helptags_script')
|
||||
silent! call delete(s:helptags_script)
|
||||
endif
|
||||
let s:helptags_script = tempname()
|
||||
call writefile(['/('.(s:is_win ? '^[A-Z]:\/.*?[^:]' : '.*?').'):(.*?)\t(.*?)\t/; printf(qq('.s:green('%-40s', 'Label').'\t%s\t%s\n), $2, $3, $1)'], s:helptags_script)
|
||||
return s:fzf('helptags', {
|
||||
\ 'source': "grep -H '.*' ".join(map(tags, 'shellescape(v:val)')).
|
||||
\ "| perl -ne '/(.*?):(.*?)\t(.*?)\t/; printf(qq(".s:green('%-40s', 'Label')."\t%s\t%s\n), $2, $3, $1)' | sort",
|
||||
\ 'source': 'grep -H ".*" '.join(map(tags, 'fzf#shellescape(v:val)')).
|
||||
\ ' | perl -n '.fzf#shellescape(s:helptags_script).' | sort',
|
||||
\ 'sink': s:function('s:helptag_sink'),
|
||||
\ 'options': '--ansi +m --tiebreak=begin --with-nth ..-2'}, a:000)
|
||||
\ 'options': ['--ansi', '+m', '--tiebreak=begin', '--with-nth', '..-2']}, a:000)
|
||||
endfunction
|
||||
|
||||
" ------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue