mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-01-09 13:02:29 +08:00
@@ -93,6 +93,10 @@ pathogen#helptags()`. [↩](#a1))
|
|||||||
|
|
||||||
#### Global options
|
#### Global options
|
||||||
|
|
||||||
|
See [README-VIM.md][readme-vim] of the main fzf repository for details.
|
||||||
|
|
||||||
|
[readme-vim]: https://github.com/junegunn/fzf/blob/master/README-VIM.md#configuration
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" This is the default extra key bindings
|
" This is the default extra key bindings
|
||||||
let g:fzf_action = {
|
let g:fzf_action = {
|
||||||
@@ -107,6 +111,7 @@ let g:fzf_layout = { 'down': '~40%' }
|
|||||||
" In Neovim, you can set up fzf window using a Vim command
|
" In Neovim, you can set up fzf window using a Vim command
|
||||||
let g:fzf_layout = { 'window': 'enew' }
|
let g:fzf_layout = { 'window': 'enew' }
|
||||||
let g:fzf_layout = { 'window': '-tabnew' }
|
let g:fzf_layout = { 'window': '-tabnew' }
|
||||||
|
let g:fzf_layout = { 'window': '10split enew' }
|
||||||
|
|
||||||
" Customize fzf colors to match your color scheme
|
" Customize fzf colors to match your color scheme
|
||||||
let g:fzf_colors =
|
let g:fzf_colors =
|
||||||
@@ -117,6 +122,7 @@ let g:fzf_colors =
|
|||||||
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
||||||
\ 'hl+': ['fg', 'Statement'],
|
\ 'hl+': ['fg', 'Statement'],
|
||||||
\ 'info': ['fg', 'PreProc'],
|
\ 'info': ['fg', 'PreProc'],
|
||||||
|
\ 'border': ['fg', 'Ignore'],
|
||||||
\ 'prompt': ['fg', 'Conditional'],
|
\ 'prompt': ['fg', 'Conditional'],
|
||||||
\ 'pointer': ['fg', 'Exception'],
|
\ 'pointer': ['fg', 'Exception'],
|
||||||
\ 'marker': ['fg', 'Keyword'],
|
\ 'marker': ['fg', 'Keyword'],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
fzf-vim.txt fzf-vim Last change: September 20 2015
|
fzf-vim.txt fzf-vim Last change: October 17 2017
|
||||||
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
|
FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@@ -8,10 +8,14 @@ FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-to
|
|||||||
Installation
|
Installation
|
||||||
Commands
|
Commands
|
||||||
Customization
|
Customization
|
||||||
|
Global options
|
||||||
|
Command-local options
|
||||||
|
Advanced customization
|
||||||
Mappings
|
Mappings
|
||||||
Usage
|
Usage
|
||||||
Completion helper
|
Completion helper
|
||||||
Reducer example
|
Reducer example
|
||||||
|
Status line (neovim)
|
||||||
License
|
License
|
||||||
|
|
||||||
FZF :HEART: VIM *fzf-vim-fzf-heart-vim*
|
FZF :HEART: VIM *fzf-vim-fzf-heart-vim*
|
||||||
@@ -53,7 +57,7 @@ selector with fzf.
|
|||||||
|
|
||||||
fzf is an independent command-line program and thus requires an external
|
fzf is an independent command-line program and thus requires an external
|
||||||
terminal emulator when on GVim. You may or may not like the experience. Also
|
terminal emulator when on GVim. You may or may not like the experience. Also
|
||||||
note that fzf currently does not compile on Windows.
|
note that Windows support is experimental at the moment.
|
||||||
|
|
||||||
|
|
||||||
INSTALLATION *fzf-vim-installation*
|
INSTALLATION *fzf-vim-installation*
|
||||||
@@ -61,9 +65,15 @@ INSTALLATION *fzf-vim-installation*
|
|||||||
|
|
||||||
Using {vim-plug}{4}:
|
Using {vim-plug}{4}:
|
||||||
>
|
>
|
||||||
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' }
|
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
|
||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
<
|
<
|
||||||
|
- `dir` and `do` options are not mandatory
|
||||||
|
- Use `./install --bin` instead if you don't need fzf outside of Vim
|
||||||
|
- If you installed fzf using Homebrew, the following should suffice:
|
||||||
|
- `Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'`
|
||||||
|
- Make sure to use Vim 7.4 or above
|
||||||
|
|
||||||
{4} https://github.com/junegunn/vim-plug
|
{4} https://github.com/junegunn/vim-plug
|
||||||
|
|
||||||
|
|
||||||
@@ -71,17 +81,17 @@ COMMANDS *fzf-vim-commands*
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
|
||||||
-----------------+-------------------------------------------------------------------
|
-----------------+-----------------------------------------------------------------------
|
||||||
Command | List ~
|
Command | List ~
|
||||||
-----------------+-------------------------------------------------------------------
|
-----------------+-----------------------------------------------------------------------
|
||||||
`Files [PATH]` | Files (similar to `:FZF` )
|
`Files [PATH]` | Files (similar to `:FZF` )
|
||||||
`GFiles [OPTS]` | Git files (git ls-files)
|
`GFiles [OPTS]` | Git files ( `git ls-files` )
|
||||||
`GFiles?` | Git files (git status)
|
`GFiles?` | Git files ( `git status` )
|
||||||
`Buffers` | Open buffers
|
`Buffers` | Open buffers
|
||||||
`Colors` | Color schemes
|
`Colors` | Color schemes
|
||||||
`Ag [PATTERN]` | {ag}{5} search result (ALT-A to select all, ALT-D to deselect all)
|
`Ag [PATTERN]` | {ag}{5} search result ( `ALT-A` to select all, `ALT-D` to deselect all)
|
||||||
`Lines [QUERY]` | Lines in loaded buffers
|
`Lines [QUERY]` | Lines in loaded buffers
|
||||||
`BLines [QUERY]` | Lines in the current buffer
|
`BLines [QUERY]` | Lines in the current buffer
|
||||||
`Tags [QUERY]` | Tags in the project ( `ctags -R` )
|
`Tags [QUERY]` | Tags in the project ( `ctags -R` )
|
||||||
`BTags [QUERY]` | Tags in the current buffer
|
`BTags [QUERY]` | Tags in the current buffer
|
||||||
`Marks` | Marks
|
`Marks` | Marks
|
||||||
@@ -97,13 +107,15 @@ COMMANDS *fzf-vim-commands*
|
|||||||
`Maps` | Normal mode mappings
|
`Maps` | Normal mode mappings
|
||||||
`Helptags` | Help tags [1]
|
`Helptags` | Help tags [1]
|
||||||
`Filetypes` | File types
|
`Filetypes` | File types
|
||||||
-----------------+-------------------------------------------------------------------
|
-----------------+-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
*g:fzf_command_prefix*
|
||||||
|
|
||||||
- Most commands support CTRL-T / CTRL-X / CTRL-V key bindings to open in a new
|
- Most commands support CTRL-T / CTRL-X / CTRL-V key bindings to open in a new
|
||||||
tab, a new split, or in a new vertical split
|
tab, a new split, or in a new vertical split
|
||||||
- Bang-versions of the commands (e.g. `Ag!`) will open fzf in fullscreen
|
- Bang-versions of the commands (e.g. `Ag!`) will open fzf in fullscreen
|
||||||
- You can set `g:fzf_command_prefix` to give the same prefix to the commands
|
- You can set `g:fzf_command_prefix` to give the same prefix to the commands
|
||||||
- e.g. `let g:fzf_command_prefix = 'Fzf'` and you have `FzfFiles`, etc.
|
- e.g. `let g:fzf_command_prefix = 'Fzf'` and you have `FzfFiles`, etc.
|
||||||
|
|
||||||
(1: `Helptags` will shadow the command of the same name from {pathogen}{8}.
|
(1: `Helptags` will shadow the command of the same name from {pathogen}{8}.
|
||||||
But its functionality is still available via `call pathogen#helptags()`.)
|
But its functionality is still available via `call pathogen#helptags()`.)
|
||||||
@@ -117,9 +129,11 @@ But its functionality is still available via `call pathogen#helptags()`.)
|
|||||||
< Customization >_____________________________________________________________~
|
< Customization >_____________________________________________________________~
|
||||||
*fzf-vim-customization*
|
*fzf-vim-customization*
|
||||||
|
|
||||||
*g:fzf_action* *g:fzf_layout* *g:fzf_colors* *g:fzf_commits_log_options*
|
|
||||||
|
|
||||||
Global options~
|
Global options~
|
||||||
|
*fzf-vim-global-options*
|
||||||
|
|
||||||
|
See {README-VIM.md}{9} of the main fzf repository for details.
|
||||||
>
|
>
|
||||||
" This is the default extra key bindings
|
" This is the default extra key bindings
|
||||||
let g:fzf_action = {
|
let g:fzf_action = {
|
||||||
@@ -134,6 +148,7 @@ Global options~
|
|||||||
" In Neovim, you can set up fzf window using a Vim command
|
" In Neovim, you can set up fzf window using a Vim command
|
||||||
let g:fzf_layout = { 'window': 'enew' }
|
let g:fzf_layout = { 'window': 'enew' }
|
||||||
let g:fzf_layout = { 'window': '-tabnew' }
|
let g:fzf_layout = { 'window': '-tabnew' }
|
||||||
|
let g:fzf_layout = { 'window': '10split enew' }
|
||||||
|
|
||||||
" Customize fzf colors to match your color scheme
|
" Customize fzf colors to match your color scheme
|
||||||
let g:fzf_colors =
|
let g:fzf_colors =
|
||||||
@@ -144,6 +159,7 @@ Global options~
|
|||||||
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
||||||
\ 'hl+': ['fg', 'Statement'],
|
\ 'hl+': ['fg', 'Statement'],
|
||||||
\ 'info': ['fg', 'PreProc'],
|
\ 'info': ['fg', 'PreProc'],
|
||||||
|
\ 'border': ['fg', 'Ignore'],
|
||||||
\ 'prompt': ['fg', 'Conditional'],
|
\ 'prompt': ['fg', 'Conditional'],
|
||||||
\ 'pointer': ['fg', 'Exception'],
|
\ 'pointer': ['fg', 'Exception'],
|
||||||
\ 'marker': ['fg', 'Keyword'],
|
\ 'marker': ['fg', 'Keyword'],
|
||||||
@@ -156,16 +172,20 @@ Global options~
|
|||||||
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
|
" explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
|
||||||
let g:fzf_history_dir = '~/.local/share/fzf-history'
|
let g:fzf_history_dir = '~/.local/share/fzf-history'
|
||||||
<
|
<
|
||||||
|
{9} https://github.com/junegunn/fzf/blob/master/README-VIM.md#configuration
|
||||||
|
|
||||||
|
|
||||||
Command-local options~
|
Command-local options~
|
||||||
|
*fzf-vim-command-local-options*
|
||||||
|
|
||||||
|
*g:fzf_buffers_jump* *g:fzf_commits_log_options* *g:fzf_tags_command*
|
||||||
|
*g:fzf_commands_expect*
|
||||||
>
|
>
|
||||||
" [Buffers] Jump to the existing window if possible
|
" [Buffers] Jump to the existing window if possible
|
||||||
let g:fzf_buffers_jump = 1
|
let g:fzf_buffers_jump = 1
|
||||||
|
|
||||||
" [[B]Commits] Customize the options used by 'git log':
|
" [[B]Commits] Customize the options used by 'git log':
|
||||||
let g:fzf_commits_log_options = \
|
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
|
||||||
'--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
|
|
||||||
|
|
||||||
" [Tags] Command to generate tags file
|
" [Tags] Command to generate tags file
|
||||||
let g:fzf_tags_command = 'ctags -R'
|
let g:fzf_tags_command = 'ctags -R'
|
||||||
@@ -174,18 +194,20 @@ Command-local options~
|
|||||||
let g:fzf_commands_expect = 'alt-enter,ctrl-x'
|
let g:fzf_commands_expect = 'alt-enter,ctrl-x'
|
||||||
<
|
<
|
||||||
|
|
||||||
Advanced customization using autoload functions~
|
Advanced customization~
|
||||||
|
*fzf-vim-advanced-customization*
|
||||||
|
|
||||||
You can use autoload functions to define your own commands.
|
You can use autoload functions to define your own commands.
|
||||||
>
|
>
|
||||||
" git grep
|
" Command for git grep
|
||||||
|
" - fzf#vim#grep(command, with_column, [options], [fullscreen])
|
||||||
command! -bang -nargs=* GGrep
|
command! -bang -nargs=* GGrep
|
||||||
\ call fzf#vim#grep('git grep --line-number '.shellescape(<q-args>), 0, <bang>0)
|
\ call fzf#vim#grep('git grep --line-number '.shellescape(<q-args>), 0, <bang>0)
|
||||||
|
|
||||||
" Override Colors command. You can safely do this in your .vimrc as fzf.vim
|
" Override Colors command. You can safely do this in your .vimrc as fzf.vim
|
||||||
" will not override existing commands.
|
" will not override existing commands.
|
||||||
command! Colors
|
command! -bang Colors
|
||||||
\ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'})
|
\ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'}, <bang>0)
|
||||||
|
|
||||||
" Augmenting Ag command using fzf#vim#with_preview function
|
" Augmenting Ag command using fzf#vim#with_preview function
|
||||||
" * fzf#vim#with_preview([[options], preview window, [toggle keys...]])
|
" * fzf#vim#with_preview([[options], preview window, [toggle keys...]])
|
||||||
@@ -215,7 +237,6 @@ You can use autoload functions to define your own commands.
|
|||||||
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
|
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
|
||||||
<
|
<
|
||||||
|
|
||||||
|
|
||||||
MAPPINGS *fzf-vim-mappings*
|
MAPPINGS *fzf-vim-mappings*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
@@ -291,6 +312,20 @@ Reducer example~
|
|||||||
\ 'left': 20})
|
\ 'left': 20})
|
||||||
<
|
<
|
||||||
|
|
||||||
|
STATUS LINE (NEOVIM) *fzf-vim-status-lineneovim*
|
||||||
|
==============================================================================
|
||||||
|
>
|
||||||
|
function! s:fzf_statusline()
|
||||||
|
" Override statusline as you like
|
||||||
|
highlight fzf1 ctermfg=161 ctermbg=251
|
||||||
|
highlight fzf2 ctermfg=23 ctermbg=251
|
||||||
|
highlight fzf3 ctermfg=237 ctermbg=251
|
||||||
|
setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
autocmd! User FzfStatusLine call <SID>fzf_statusline()
|
||||||
|
<
|
||||||
|
|
||||||
LICENSE *fzf-vim-license*
|
LICENSE *fzf-vim-license*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user