[vim] Make :FZF command configurable with g:fzf_layout

To make it consistent with the other commands in fzf.vim
This commit is contained in:
Junegunn Choi 2016-07-21 01:46:45 +09:00
parent fccc93176b
commit a7c9c08371
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -21,7 +21,7 @@
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
let s:default_height = '40%'
let s:default_layout = { 'down': '~40%' }
let s:fzf_go = expand('<sfile>:h:h').'/bin/fzf'
let s:install = expand('<sfile>:h:h').'/install'
let s:installed = 0
@ -481,7 +481,12 @@ function! s:cmd(bang, ...) abort
let opts.dir = substitute(remove(args, -1), '\\\(["'']\)', '\1', 'g')
endif
if !a:bang
let opts.down = get(g:, 'fzf_height', get(g:, 'fzf_tmux_height', s:default_height))
" For backward compatibility
if !exists('g:fzf_layout') && exists('g:fzf_height')
let opts.down = g:fzf_height
else
let opts = extend(opts, get(g:, 'fzf_layout', s:default_layout))
endif
endif
call fzf#run(extend({'options': join(args), 'sink*': function('<sid>cmd_callback')}, opts))
endfunction