Skip to content
Myr

[vim] Throw error if g:fzf_layout is incorrectly used

Before adoption: this commit came in with the history the project adopted, so no landing records it.

https://github.com/junegunn/fzf.vim/issues/327 https://github.com/junegunn/fzf.vim/issues/317

authored by Junegunn Choi · committed by Junegunn Choi · parent 972fb1a · Browse files · 1 file+11 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • https: //github.com/junegunn/fzf.vim/issues/327
  • https: //github.com/junegunn/fzf.vim/issues/317

Diff stats

1 file+11 added−1 removed

  • other:+11 added−1 removed

1 file+11 added−1 removed

modified:plugin/fzf.vim+11 added-1 removed
190 unmodified lines
191 let colors = join(map(items(filter(map(rules, 'call("s:get_color", v:val)'), '!empty(v:val)')), 'join(v:val, ":")'), ',')192 return empty(colors) ? '' : ('--color='.colors)193endfunction194195function! s:validate_layout(layout)196 for key in keys(a:layout)197 if index(s:layout_keys, key) < 0198 throw printf('invalid entry in g:fzf_layout: %s (allowed: %s)%s',199 \ key, join(s:layout_keys, ', '), key == 'options' ? '. Use $FZF_DEFAULT_OPTS.' : '')200 endif201 endfor202 return a:layout203endfunction204205" [name string,] [opts dict,] [fullscreen boolean]206function! fzf#wrap(...)207 let args = ['', {}, 0]208 let expects = map(copy(args), 'type(v:val)')
23 unmodified lines
232 elseif !s:has_any(opts, s:layout_keys)233 if !exists('g:fzf_layout') && exists('g:fzf_height')234 let opts.down = g:fzf_height235 else226 let opts = extend(opts, get(g:, 'fzf_layout', s:default_layout))236 let opts = extend(opts, s:validate_layout(get(g:, 'fzf_layout', s:default_layout)))237 endif238 endif239240 " Colors: g:fzf_colors
454 unmodified lines