summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-04-23 12:51:08 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-04-23 12:51:08 +0900
commit27e26bd1ea90c54555aceecb644b390ced5d9761 (patch)
tree2ada4fd3fe9c8f18b4dfaba219c2d74afe29a8c8
parent305ec3b3ce16141ecac0b8657ad00b371fc7a133 (diff)
[vim] Add g:Fzf_launcher for funcrefs (#212)
-rw-r--r--README.md3
-rw-r--r--plugin/fzf.vim5
2 files changed, 5 insertions, 3 deletions
diff --git a/README.md b/README.md
index 7b54b3fa..e7288b13 100644
--- a/README.md
+++ b/README.md
@@ -294,7 +294,8 @@ of the selected items.
| `dir` | string | Working directory |
| `up`/`down`/`left`/`right` | number/string | Use tmux pane with the given size (e.g. `20`, `50%`) |
| `window` (*Neovim only*) | string | Command to open fzf window (e.g. `vertical aboveleft 30new`) |
-| `launcher` | string | External terminal emulator to start fzf with (Only used in GVim) |
+| `launcher` | string | External terminal emulator to start fzf with (GVim only) |
+| `launcher` | funcref | Function for generating `launcher` string (GVim only) |
_However on Neovim `fzf#run` is asynchronous and does not return values so you
should use `sink` or `sink*` to process the output from fzf._
diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index 28efe690..375d5ec9 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -206,8 +206,9 @@ function! s:execute(dict, command, temps)
call s:pushd(a:dict)
silent! !clear 2> /dev/null
if has('gui_running')
- let launcher = get(a:dict, 'launcher', get(g:, 'fzf_launcher', s:launcher))
- let command = printf(launcher, "'".substitute(a:command, "'", "'\"'\"'", 'g')."'")
+ let Launcher = get(a:dict, 'launcher', get(g:, 'Fzf_launcher', get(g:, 'fzf_launcher', s:launcher)))
+ let fmt = type(Launcher) == 2 ? call(Launcher, []) : Launcher
+ let command = printf(fmt, "'".substitute(a:command, "'", "'\"'\"'", 'g')."'")
else
let command = a:command
endif