diff --git a/README.md b/README.md index 72e4e86..1b1fc6f 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,19 @@ let g:fzf_vim.tags_command = 'ctags -R' let g:fzf_vim.commands_expect = 'alt-enter,ctrl-x' ``` +#### Command-level fzf options + +You can set fzf options for each command by setting +`g:fzf_vim.{command}_options`. + +```vim +" In string +let g:fzf_vim.buffers_options = '--style full --border-label " Open Buffers "' + +" In list (No need to quote or escape values) +let g:fzf_vim.buffers_options = ['--style', 'full', '--border-label', ' Open Buffers '] +``` + #### List type to handle multiple selections The following commands will fill the quickfix list when multiple entries are diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 9ebbf47..99be80f 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -340,6 +340,10 @@ function! s:fzf(name, opts, extra) let eopts = has_key(extra, 'options') ? remove(extra, 'options') : '' let merged = extend(copy(a:opts), extra) call s:merge_opts(merged, eopts) + + " Command-level fzf options + call s:merge_opts(merged, s:conf(a:name.'_options', [])) + return fzf#run(s:wrap(a:name, merged, bang)) endfunction diff --git a/doc/fzf-vim.txt b/doc/fzf-vim.txt index 9e03a44..040a6e1 100644 --- a/doc/fzf-vim.txt +++ b/doc/fzf-vim.txt @@ -1,4 +1,4 @@ -fzf-vim.txt fzf-vim Last change: October 29 2024 +fzf-vim.txt fzf-vim Last change: March 3 2025 FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc* ============================================================================== @@ -14,6 +14,7 @@ FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-to Configuration options for fzf.vim |fzf-vim-configuration-options-for-fzf-vim| Preview window |fzf-vim-preview-window| Command-level options |fzf-vim-command-level-options| + Command-level fzf options |fzf-vim-command-level-fzf-options| List type to handle multiple selections |fzf-vim-list-type-to-handle-multiple-selections| Advanced customization |fzf-vim-advanced-customization| Vim functions |fzf-vim-vim-functions| @@ -228,7 +229,7 @@ Command-level options~ *g:fzf_vim.commands_expect* *g:fzf_vim.tags_command* *g:fzf_vim.commits_log_options* *g:fzf_vim.buffers_jump* > - " [Buffers] Jump to the existing window if possible + " [Buffers] Jump to the existing window if possible (default: 0) let g:fzf_vim.buffers_jump = 1 " [Ag|Rg|RG] Display path on a separate line for narrow screens (default: 0) @@ -253,6 +254,19 @@ Command-level options~ let g:fzf_vim.commands_expect = 'alt-enter,ctrl-x' < +Command-level fzf options~ + *fzf-vim-command-level-fzf-options* + +You can set fzf options for each command by setting +`g:fzf_vim.{command}_options`. +> + " In string + let g:fzf_vim.buffers_options = '--style full --border-label " Open Buffers "' + + " In list (No need to quote or escape values) + let g:fzf_vim.buffers_options = ['--style', 'full', '--border-label', ' Open Buffers '] +< + List type to handle multiple selections~ *fzf-vim-list-type-to-handle-multiple-selections* @@ -383,8 +397,6 @@ Example: git grep wrapper~ The following example implements `GGrep` command that works similarly to predefined `Ag` or `Rg` using `fzf#vim#grep`. - *:LINE* - - We set the base directory to git root by setting `dir` attribute in spec dictionary. - {The preview script}{12} supports `grep` format (`FILE_PATH:LINE_NO:...`), so