diff --git a/README.md b/README.md index a8e90da..23039e7 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,10 @@ pathogen#helptags()`. [↩](#a1)) #### 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 " This is the default extra key bindings 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 let g:fzf_layout = { 'window': 'enew' } let g:fzf_layout = { 'window': '-tabnew' } +let g:fzf_layout = { 'window': '10split enew' } " Customize fzf colors to match your color scheme let g:fzf_colors = @@ -117,6 +122,7 @@ let g:fzf_colors = \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], + \ 'border': ['fg', 'Ignore'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], diff --git a/doc/fzf-vim.txt b/doc/fzf-vim.txt index 0a99c49..7b74003 100644 --- a/doc/fzf-vim.txt +++ b/doc/fzf-vim.txt @@ -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* ============================================================================== @@ -8,10 +8,14 @@ FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-to Installation Commands Customization + Global options + Command-local options + Advanced customization Mappings Usage Completion helper Reducer example + Status line (neovim) License 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 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* @@ -61,9 +65,15 @@ INSTALLATION *fzf-vim-installation* Using {vim-plug}{4}: > - Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': 'yes \| ./install' } + Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } 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 @@ -71,17 +81,17 @@ COMMANDS *fzf-vim-commands* ============================================================================== - -----------------+------------------------------------------------------------------- - Command | List ~ - -----------------+------------------------------------------------------------------- + -----------------+----------------------------------------------------------------------- + Command | List ~ + -----------------+----------------------------------------------------------------------- `Files [PATH]` | Files (similar to `:FZF` ) - `GFiles [OPTS]` | Git files (git ls-files) - `GFiles?` | Git files (git status) + `GFiles [OPTS]` | Git files ( `git ls-files` ) + `GFiles?` | Git files ( `git status` ) `Buffers` | Open buffers `Colors` | Color schemes - `Ag [PATTERN]` | {ag}{5} search result (ALT-A to select all, ALT-D to deselect all) - `Lines [QUERY]` | Lines in loaded buffers - `BLines [QUERY]` | Lines in the current buffer + `Ag [PATTERN]` | {ag}{5} search result ( `ALT-A` to select all, `ALT-D` to deselect all) + `Lines [QUERY]` | Lines in loaded buffers + `BLines [QUERY]` | Lines in the current buffer `Tags [QUERY]` | Tags in the project ( `ctags -R` ) `BTags [QUERY]` | Tags in the current buffer `Marks` | Marks @@ -97,13 +107,15 @@ COMMANDS *fzf-vim-commands* `Maps` | Normal mode mappings `Helptags` | Help tags [1] `Filetypes` | File types - -----------------+------------------------------------------------------------------- + -----------------+----------------------------------------------------------------------- + + *g:fzf_command_prefix* - 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 - 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 - - 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}. 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 >_____________________________________________________________~ *fzf-vim-customization* - *g:fzf_action* *g:fzf_layout* *g:fzf_colors* *g:fzf_commits_log_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 let g:fzf_action = { @@ -134,6 +148,7 @@ Global options~ " In Neovim, you can set up fzf window using a Vim command let g:fzf_layout = { 'window': 'enew' } let g:fzf_layout = { 'window': '-tabnew' } + let g:fzf_layout = { 'window': '10split enew' } " Customize fzf colors to match your color scheme let g:fzf_colors = @@ -144,6 +159,7 @@ Global options~ \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'Statement'], \ 'info': ['fg', 'PreProc'], + \ 'border': ['fg', 'Ignore'], \ 'prompt': ['fg', 'Conditional'], \ 'pointer': ['fg', 'Exception'], \ 'marker': ['fg', 'Keyword'], @@ -156,16 +172,20 @@ Global options~ " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS. let g:fzf_history_dir = '~/.local/share/fzf-history' < + {9} https://github.com/junegunn/fzf/blob/master/README-VIM.md#configuration + 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 let g:fzf_buffers_jump = 1 " [[B]Commits] Customize the options used by 'git log': - let g:fzf_commits_log_options = \ - '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' + let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"' " [Tags] Command to generate tags file let g:fzf_tags_command = 'ctags -R' @@ -174,18 +194,20 @@ Command-local options~ 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. > - " git grep + " Command for git grep + " - fzf#vim#grep(command, with_column, [options], [fullscreen]) command! -bang -nargs=* GGrep \ call fzf#vim#grep('git grep --line-number '.shellescape(), 0, 0) " Override Colors command. You can safely do this in your .vimrc as fzf.vim " will not override existing commands. - command! Colors - \ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'}) + command! -bang Colors + \ call fzf#vim#colors({'left': '15%', 'options': '--reverse --margin 30%,0'}, 0) " Augmenting Ag command using fzf#vim#with_preview function " * 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(, fzf#vim#with_preview(), 0) < - MAPPINGS *fzf-vim-mappings* ============================================================================== @@ -291,6 +312,20 @@ Reducer example~ \ '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 fzf_statusline() +< + LICENSE *fzf-vim-license* ==============================================================================