parent
94e499b131
commit
6b62cb418a
2 changed files with 19 additions and 6 deletions
|
@ -121,15 +121,20 @@ let g:fzf_colors =
|
||||||
|
|
||||||
#### Command-local options
|
#### Command-local options
|
||||||
|
|
||||||
|
The right-hand-side values are the default values for the options.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" [Buffers] Jump to the existing window if possible
|
" [Buffers] Jump to the existing window if possible
|
||||||
let g:fzf_buffers_jump = 1
|
let g:fzf_buffers_jump = 0
|
||||||
|
|
||||||
" [[B]Commits] Customize the options used by 'git log':
|
" [[B]Commits] Customize the options used by 'git log':
|
||||||
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
|
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
|
||||||
|
|
||||||
" [Tags] Command to generate tags file
|
" [Tags] Command to generate tags file
|
||||||
let g:fzf_tags_command = 'ctags -R'
|
let g:fzf_tags_command = 'ctags -R'
|
||||||
|
|
||||||
|
" [Commands] --expect expression for directly executing the command
|
||||||
|
let g:fzf_commands_expect = 'ctrl-x'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Advanced customization using autoload functions
|
#### Advanced customization using autoload functions
|
||||||
|
|
|
@ -709,9 +709,16 @@ function! s:format_cmd(line)
|
||||||
\ '\=s:nbs.s:yellow(submatch(1), "Function").s:nbs', '')
|
\ '\=s:nbs.s:yellow(submatch(1), "Function").s:nbs', '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:command_sink(cmd)
|
function! s:command_sink(lines)
|
||||||
let cmd = matchstr(a:cmd, s:nbs.'\zs\S*\ze'.s:nbs)
|
if len(a:lines) < 2
|
||||||
call feedkeys(':'.cmd.(a:cmd[0] == '!' ? '' : ' '))
|
return
|
||||||
|
endif
|
||||||
|
let cmd = matchstr(a:lines[1], s:nbs.'\zs\S*\ze'.s:nbs)
|
||||||
|
if empty(a:lines[0])
|
||||||
|
call feedkeys(':'.cmd.(a:lines[1][0] == '!' ? '' : ' '))
|
||||||
|
else
|
||||||
|
execute cmd
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:format_excmd(ex)
|
function! s:format_excmd(ex)
|
||||||
|
@ -752,8 +759,9 @@ function! fzf#vim#commands(...)
|
||||||
let list = split(cout, "\n")
|
let list = split(cout, "\n")
|
||||||
return s:fzf({
|
return s:fzf({
|
||||||
\ 'source': extend(extend(list[0:0], map(list[1:], 's:format_cmd(v:val)')), s:excmds()),
|
\ 'source': extend(extend(list[0:0], map(list[1:], 's:format_cmd(v:val)')), s:excmds()),
|
||||||
\ 'sink': s:function('s:command_sink'),
|
\ 'sink*': s:function('s:command_sink'),
|
||||||
\ 'options': '--ansi --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000)
|
\ 'options': '--ansi --expect '.get(g:, 'fzf_commands_expect', 'ctrl-x').
|
||||||
|
\ ' --tiebreak=index --header-lines 1 -x --prompt "Commands> " -n2,3,2..3 -d'.s:nbs}, a:000)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" ------------------------------------------------------------------
|
" ------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Reference in a new issue