Update fzf#complete example
This commit is contained in:
parent
8855227506
commit
b26dc157b9
1 changed files with 7 additions and 5 deletions
12
README.md
12
README.md
|
@ -85,15 +85,17 @@ following exceptions:
|
||||||
completion prefix as the argument and return the final value
|
completion prefix as the argument and return the final value
|
||||||
- `sink` or `sink*` are not allowed
|
- `sink` or `sink*` are not allowed
|
||||||
|
|
||||||
|
#### Reducer example
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
function! s:first_line_in_uppercase(lines)
|
function! s:make_sentence(lines)
|
||||||
return toupper(a:lines[0])
|
return substitute(join(a:lines), '^.', '\=toupper(submatch(0))', '').'.'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
inoremap <expr> <c-x><c-k> fzf#complete({
|
inoremap <expr> <c-x><c-s> fzf#complete({
|
||||||
\ 'source': 'cat /usr/share/dict/words',
|
\ 'source': 'cat /usr/share/dict/words',
|
||||||
\ 'reducer': function('<sid>first_line_in_uppercase'),
|
\ 'reducer': function('<sid>make_sentence'),
|
||||||
\ 'options': '--no-multi --reverse --margin 15%,0',
|
\ 'options': '--multi --reverse --margin 15%,0',
|
||||||
\ 'left': 20})
|
\ 'left': 20})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue