From a88311b222eb9f90fa9fa72292e61d15c6767866 Mon Sep 17 00:00:00 2001 From: Stefan Kanev Date: Sun, 9 May 2021 07:45:33 +0300 Subject: [PATCH] Don't mutate args to fzf#vim#files() (#1282) As the code was written before, if we do this: let s:opts = { \ 'window': {'width': 0.6, 'height': 0.6, 'relative': v:false}, \ 'options': ['--layout=reverse', '--info=inline'], \} call fzf#vim#files('', s:opts, 0) ...then s:opts will get mutated by the call to fzf#vim#files, cloberring any persistent configuration established this way. Making a defensive copy solves the problem. --- autoload/fzf/vim.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 6f0344c..d8bd57e 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -302,6 +302,7 @@ function! s:fzf(name, opts, extra) throw 'invalid number of arguments' endif + let extra = copy(extra) let eopts = has_key(extra, 'options') ? remove(extra, 'options') : '' let merged = extend(copy(a:opts), extra) call s:merge_opts(merged, eopts)