mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-03-07 07:32:02 +08:00
[Helptags] Windows support (#423)
This commit is contained in:
committed by
Junegunn Choi
parent
7e868c49ac
commit
914355df94
@@ -942,17 +942,22 @@ function! s:helptag_sink(line)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! fzf#vim#helptags(...)
|
function! fzf#vim#helptags(...)
|
||||||
if !executable('perl')
|
if !executable('grep') || !executable('perl')
|
||||||
return s:warn('Helptags command requires perl')
|
return s:warn('Helptags command requires grep and perl')
|
||||||
endif
|
endif
|
||||||
let sorted = sort(split(globpath(&runtimepath, 'doc/tags'), '\n'))
|
let sorted = sort(split(globpath(&runtimepath, 'doc/tags'), '\n'))
|
||||||
let tags = exists('*uniq') ? uniq(sorted) : fzf#vim#_uniq(sorted)
|
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', {
|
return s:fzf('helptags', {
|
||||||
\ 'source': "grep -H '.*' ".join(map(tags, 'shellescape(v:val)')).
|
\ 'source': 'grep -H ".*" '.join(map(tags, 'fzf#shellescape(v:val)')).
|
||||||
\ "| perl -ne '/(.*?):(.*?)\t(.*?)\t/; printf(qq(".s:green('%-40s', 'Label')."\t%s\t%s\n), $2, $3, $1)' | sort",
|
\ ' | perl -n '.fzf#shellescape(s:helptags_script).' | sort',
|
||||||
\ 'sink': s:function('s:helptag_sink'),
|
\ '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
|
endfunction
|
||||||
|
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user