diff --git a/README.md b/README.md index a9c9d91..0f72fcf 100644 --- a/README.md +++ b/README.md @@ -289,12 +289,9 @@ Mappings | `(fzf-complete-word)` | `cat /usr/share/dict/words` | | `(fzf-complete-path)` | Path completion using `find` (file + dir) | | `(fzf-complete-file)` | File completion using `find` | -| `(fzf-complete-file-ag)` | File completion using `ag` | | `(fzf-complete-line)` | Line completion (all open buffers) | | `(fzf-complete-buffer-line)` | Line completion (current buffer only) | -### Usage - ```vim " Mapping selecting mappings nmap (fzf-maps-n) @@ -304,14 +301,30 @@ omap (fzf-maps-o) " Insert mode completion imap (fzf-complete-word) imap (fzf-complete-path) -imap (fzf-complete-file-ag) imap (fzf-complete-line) - -" Advanced customization using Vim function -inoremap fzf#vim#complete#word({'left': '15%'}) ``` -### Completion helper +Completion functions +-------------------- + +| Function | Description | +| --- | --- | +| `fzf#vim#complete#path(command, [spec])` | Path completion | +| `fzf#vim#complete#word([spec])` | Word completion | +| `fzf#vim#complete#line([spec])` | Line completion (all open buffers) | +| `fzf#vim#complete#buffer_line([spec])` | Line completion (current buffer only) | + +```vim +" Path completion with custom source command +inoremap fzf#vim#complete#path('fd') +inoremap fzf#vim#complete#path('rg --files') + +" Word completion with custom spec with popup layout option +inoremap fzf#vim#complete#word({'window': { 'width': 0.2, 'height': 0.9, 'xoffset': 1 }}) +``` + +Custom completion +----------------- `fzf#vim#complete` is a helper function for creating custom fuzzy completion using fzf. If the first parameter is a command string or a Vim list, it will @@ -344,7 +357,7 @@ inoremap fzf#vim#complete(fzf#wrap({ \ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }})) ``` -#### Reducer example +### Reducer example ```vim function! s:make_sentence(lines) diff --git a/doc/fzf-vim.txt b/doc/fzf-vim.txt index c5aa390..8334edb 100644 --- a/doc/fzf-vim.txt +++ b/doc/fzf-vim.txt @@ -1,4 +1,4 @@ -fzf-vim.txt fzf-vim Last change: March 17 2020 +fzf-vim.txt fzf-vim Last change: May 3 2020 FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-toc* ============================================================================== @@ -19,9 +19,9 @@ FZF-VIM - TABLE OF CONTENTS *fzf-vim* *fzf-vim-to Example: Rg command with preview window Example: Advanced ripgrep integration Mappings - Usage - Completion helper - Reducer example + Completion functions + Custom completion + Reducer example Status line of terminal buffer Hide statusline Custom statusline @@ -350,14 +350,9 @@ MAPPINGS *fzf-vim-mappings* (fzf-complete-word) | `cat /usr/share/dict/words` (fzf-complete-path) | Path completion using `find` (file + dir) (fzf-complete-file) | File completion using `find` - (fzf-complete-file-ag) | File completion using `ag` (fzf-complete-line) | Line completion (all open buffers) (fzf-complete-buffer-line) | Line completion (current buffer only) ---------------------------------+------------------------------------------ - - -< Usage >_____________________________________________________________________~ - *fzf-vim-usage* > " Mapping selecting mappings nmap (fzf-maps-n) @@ -367,15 +362,31 @@ MAPPINGS *fzf-vim-mappings* " Insert mode completion imap (fzf-complete-word) imap (fzf-complete-path) - imap (fzf-complete-file-ag) imap (fzf-complete-line) - - " Advanced customization using Vim function - inoremap fzf#vim#complete#word({'left': '15%'}) < -< Completion helper >_________________________________________________________~ - *fzf-vim-completion-helper* +COMPLETION FUNCTIONS *fzf-vim-completion-functions* +============================================================================== + + -----------------------------------------+-------------------------------------- + Function | Description ~ + -----------------------------------------+-------------------------------------- + `fzf#vim#complete#path(command, [spec])` | Path completion + `fzf#vim#complete#word([spec])` | Word completion + `fzf#vim#complete#line([spec])` | Line completion (all open buffers) + `fzf#vim#complete#buffer_line([spec])` | Line completion (current buffer only) + -----------------------------------------+-------------------------------------- +> + " Path completion with custom source command + inoremap fzf#vim#complete#path('fd') + inoremap fzf#vim#complete#path('rg --files') + + " Word completion with custom spec with popup layout option + inoremap fzf#vim#complete#word({'window': { 'width': 0.2, 'height': 0.9, 'xoffset': 1 }}) +< + +CUSTOM COMPLETION *fzf-vim-custom-completion* +============================================================================== `fzf#vim#complete` is a helper function for creating custom fuzzy completion using fzf. If the first parameter is a command string or a Vim list, it will @@ -405,7 +416,7 @@ following exceptions: \ 'reducer': { lines -> join(split(lines[0], ':\zs')[2:], '') }})) < -Reducer example~ +< Reducer example >___________________________________________________________~ *fzf-vim-reducer-example* > function! s:make_sentence(lines)