From f269709f7ee68d2436dafda53a4c28a398cec5ed Mon Sep 17 00:00:00 2001 From: gleachkr Date: Sun, 6 Jul 2014 07:50:46 -0700 Subject: [PATCH] escaping spaces in filenames, adding multiple files to the arglist --- examples.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples.md b/examples.md index c861c6d..1b9fe3d 100644 --- a/examples.md +++ b/examples.md @@ -228,9 +228,16 @@ function! GetCompletions() \ (l:Prefix[0] == 'vs') || \ (l:Prefix[0] == 'sp') \) - return join(l:Prefix + fzf#run({ - \'options': '--select-1 --query='.l:cmdline_list[-1] - \})) + return join(l:Prefix + map(fzf#run({'options': '--select-1 --query='.l:cmdline_list[-1] }), + \'escape(v:val, " ")')) + elseif len(l:Prefix) > 0 && ( + \ (l:Prefix[0] == 'ar') || + \ (l:Prefix[0] == 'n') || + \ (l:Prefix[0] == 'sn') || + \ (l:Prefix[0] == 'arga') + \) + return join(l:Prefix + map(fzf#run({'options': '-m --select-1 --query='.l:cmdline_list[-1] }), + \'escape(v:val, " ")')) else return join(l:Prefix + fzf#run({ \'source':l:FZF_Cmd_Completion_List, @@ -240,4 +247,4 @@ function! GetCompletions() endfunction ``` -hit `` while in the ex commandline (i.e. after pressing `:`) to have fzf filter a list of vim's commandline auto-completions. Try `:colo␣` (be sure to include the space) or `:b␣`. There are special cases for handling file-searches, so that you can go deeper into the directory than just one layer. More special cases could be added. Some limitations: the auto-complete for `:help` and `:tag` are limited to 300 entries, so you may need to narrow it a bit. \ No newline at end of file +hit `` while in the ex commandline (i.e. after pressing `:`) to have fzf filter a list of vim's commandline auto-completions. Try `:colo␣` (be sure to include the space) or `:b␣`. There are special cases for handling file-searches, so that you can go deeper into the directory than just one layer, and so that you can add multiple files to the arglist at once. More special cases could be added. Some limitations: the auto-complete for `:help` and `:tag` are limited to 300 entries, so you may need to narrow it a bit. \ No newline at end of file