mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 12:44:24 +08:00
[fzf#vim#grep[2]] Deprecate has_column argument
The boolean value tells the function if the output of the command contains column numbers, but we can just see the selected lines if they contain column numbers. The argument is now removed from the documentation, and will be silently ignored for backward compatibility. Close #1480
This commit is contained in:
@@ -2,30 +2,29 @@ fzf-vim.txt fzf-vim Last change: June 4 2023
|
||||
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
|
||||
==============================================================================
|
||||
|
||||
fzf :heart: vim |fzf-vim-fzfheart-vim|
|
||||
Rationale |fzf-vim-rationale|
|
||||
Why you should use fzf on Vim |fzf-vim-why-you-should-use-fzf-on-vim|
|
||||
Installation |fzf-vim-installation|
|
||||
Using vim-plug |fzf-vim-using-vim-plug|
|
||||
Dependencies |fzf-vim-dependencies|
|
||||
Commands |fzf-vim-commands|
|
||||
Customization |fzf-vim-customization|
|
||||
Global options |fzf-vim-global-options|
|
||||
Preview window |fzf-vim-preview-window|
|
||||
Command-local options |fzf-vim-command-local-options|
|
||||
Advanced customization |fzf-vim-advanced-customization|
|
||||
Vim functions |fzf-vim-vim-functions|
|
||||
Example: Customizing Files command |fzf-vim-example-customizing-files-command|
|
||||
Example: git grep wrapper |fzf-vim-example-git-grep-wrapper|
|
||||
Example: Advanced ripgrep integration |fzf-vim-example-advanced-ripgrep-integration|
|
||||
Mappings |fzf-vim-mappings|
|
||||
Completion functions |fzf-vim-completion-functions|
|
||||
Custom completion |fzf-vim-custom-completion|
|
||||
Reducer example |fzf-vim-reducer-example|
|
||||
Status line of terminal buffer |fzf-vim-status-line-of-terminal-buffer|
|
||||
Hide statusline |fzf-vim-hide-statusline|
|
||||
Custom statusline |fzf-vim-custom-statusline|
|
||||
License |fzf-vim-license|
|
||||
fzf :heart: vim |fzf-vim-fzfheart-vim|
|
||||
Rationale |fzf-vim-rationale|
|
||||
Why you should use fzf on Vim |fzf-vim-why-you-should-use-fzf-on-vim|
|
||||
Installation |fzf-vim-installation|
|
||||
Using vim-plug |fzf-vim-using-vim-plug|
|
||||
Dependencies |fzf-vim-dependencies|
|
||||
Commands |fzf-vim-commands|
|
||||
Customization |fzf-vim-customization|
|
||||
Global options |fzf-vim-global-options|
|
||||
Preview window |fzf-vim-preview-window|
|
||||
Command-local options |fzf-vim-command-local-options|
|
||||
Advanced customization |fzf-vim-advanced-customization|
|
||||
Vim functions |fzf-vim-vim-functions|
|
||||
Example: Customizing Files command |fzf-vim-example-customizing-files-command|
|
||||
Example: git grep wrapper |fzf-vim-example-git-grep-wrapper|
|
||||
Mappings |fzf-vim-mappings|
|
||||
Completion functions |fzf-vim-completion-functions|
|
||||
Custom completion |fzf-vim-custom-completion|
|
||||
Reducer example |fzf-vim-reducer-example|
|
||||
Status line of terminal buffer |fzf-vim-status-line-of-terminal-buffer|
|
||||
Hide statusline |fzf-vim-hide-statusline|
|
||||
Custom statusline |fzf-vim-custom-statusline|
|
||||
License |fzf-vim-license|
|
||||
|
||||
FZF :HEART: VIM *fzf-vim-fzfheart-vim*
|
||||
==============================================================================
|
||||
@@ -237,18 +236,18 @@ Vim functions~
|
||||
Each command in fzf.vim is backed by a Vim function. You can override a
|
||||
command or define a variation of it by calling its corresponding function.
|
||||
|
||||
----------+------------------------------------------------------------------------------------------
|
||||
Command | Vim function ~
|
||||
----------+------------------------------------------------------------------------------------------
|
||||
----------+-----------------------------------------------------------------------
|
||||
Command | Vim function ~
|
||||
----------+-----------------------------------------------------------------------
|
||||
`Files` | `fzf#vim#files(dir, [spec dict], [fullscreen bool])`
|
||||
`GFiles` | `fzf#vim#gitfiles(git_options, [spec dict], [fullscreen bool])`
|
||||
`GFiles?` | `fzf#vim#gitfiles('?', [spec dict], [fullscreen bool])`
|
||||
`Buffers` | `fzf#vim#buffers([spec dict], [fullscreen bool])`
|
||||
`Colors` | `fzf#vim#colors([spec dict], [fullscreen bool])`
|
||||
`Rg` | `fzf#vim#grep(command, [has_column bool], [spec dict], [fullscreen bool])`
|
||||
`RG` | `fzf#vim#grep2(command_prefix, query, [has_column bool], [spec dict], [fullscreen bool])`
|
||||
`Rg` | `fzf#vim#grep(command, [spec dict], [fullscreen bool])`
|
||||
`RG` | `fzf#vim#grep2(command_prefix, query, [spec dict], [fullscreen bool])`
|
||||
... | ...
|
||||
----------+------------------------------------------------------------------------------------------
|
||||
----------+-----------------------------------------------------------------------
|
||||
|
||||
(We can see that the last two optional arguments of each function are
|
||||
identical. They are directly passed to `fzf#wrap` function. If you haven't
|
||||
@@ -322,49 +321,12 @@ predefined `Ag` or `Rg` using `fzf#vim#grep`.
|
||||
>
|
||||
command! -bang -nargs=* GGrep
|
||||
\ call fzf#vim#grep(
|
||||
\ 'git grep --line-number -- '.shellescape(<q-args>), 0,
|
||||
\ 'git grep --line-number -- '.shellescape(<q-args>),
|
||||
\ fzf#vim#with_preview({'dir': systemlist('git rev-parse --show-toplevel')[0]}), <bang>0)
|
||||
<
|
||||
{12} bin/preview.sh
|
||||
|
||||
|
||||
Example: Advanced ripgrep integration~
|
||||
*fzf-vim-example-advanced-ripgrep-integration*
|
||||
|
||||
The example shown here is now available as the `RG` (all uppercase) command
|
||||
that uses `fzf#vim#grep2(command_prefix, query, has_column, ...)` function.
|
||||
You no longer need to define it in your Vim configuration file.
|
||||
|
||||
In the default implementation of `Rg`, ripgrep process starts only once with
|
||||
the initial query (e.g. `:Rg foo`) and fzf filters the output of the process.
|
||||
|
||||
This is okay in most cases because fzf is quite performant even with millions
|
||||
of lines, but we can make fzf completely delegate its search responsibliity to
|
||||
ripgrep process by making it restart ripgrep whenever the query string is
|
||||
updated. In this scenario, fzf becomes a simple selector interface rather than
|
||||
a "fuzzy finder".
|
||||
|
||||
- We will name the new command all-uppercase `RG` so we can still access the
|
||||
default version.
|
||||
- `--bind 'change:reload:rg ... {q}'` will make fzf restart ripgrep process
|
||||
whenever the query string, denoted by `{q}`, is changed.
|
||||
- With `--disabled` option, fzf will no longer perform search. The query string
|
||||
you type on fzf prompt is only used for restarting ripgrep process.
|
||||
- Also note that we enabled previewer with `fzf#vim#with_preview`. The last
|
||||
argument to the function, `ctrl-/`, is the key to toggle the preview window.
|
||||
>
|
||||
function! RipgrepFzf(query, fullscreen)
|
||||
let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
|
||||
let initial_command = printf(command_fmt, shellescape(a:query))
|
||||
let reload_command = printf(command_fmt, '{q}')
|
||||
let spec = {'options': ['--disabled', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
|
||||
let spec = fzf#vim#with_preview(spec, 'right', 'ctrl-/')
|
||||
call fzf#vim#grep(initial_command, 1, spec, a:fullscreen)
|
||||
endfunction
|
||||
|
||||
command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)
|
||||
<
|
||||
|
||||
MAPPINGS *fzf-vim-mappings*
|
||||
==============================================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user