doing 2.0.20 → 2.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/doing.rdoc +1 -1
- data/lib/doing/log_adapter.rb +3 -1
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +19 -8
- data/lib/helpers/fzf/.goreleaser.yml +119 -0
- data/lib/helpers/fzf/.rubocop.yml +28 -0
- data/lib/helpers/fzf/ADVANCED.md +565 -0
- data/lib/helpers/fzf/BUILD.md +49 -0
- data/lib/helpers/fzf/CHANGELOG.md +1193 -0
- data/lib/helpers/fzf/Dockerfile +11 -0
- data/lib/helpers/fzf/LICENSE +21 -0
- data/lib/helpers/fzf/Makefile +166 -0
- data/lib/helpers/fzf/README-VIM.md +486 -0
- data/lib/helpers/fzf/README.md +712 -0
- data/lib/helpers/fzf/bin/fzf-tmux +233 -0
- data/lib/helpers/fzf/doc/fzf.txt +512 -0
- data/lib/helpers/fzf/go.mod +17 -0
- data/lib/helpers/fzf/go.sum +31 -0
- data/lib/helpers/fzf/install +382 -0
- data/lib/helpers/fzf/install.ps1 +65 -0
- data/lib/helpers/fzf/main.go +14 -0
- data/lib/helpers/fzf/man/man1/fzf-tmux.1 +68 -0
- data/lib/helpers/fzf/man/man1/fzf.1 +1001 -0
- data/lib/helpers/fzf/plugin/fzf.vim +1048 -0
- data/lib/helpers/fzf/shell/completion.bash +381 -0
- data/lib/helpers/fzf/shell/completion.zsh +329 -0
- data/lib/helpers/fzf/shell/key-bindings.bash +96 -0
- data/lib/helpers/fzf/shell/key-bindings.fish +172 -0
- data/lib/helpers/fzf/shell/key-bindings.zsh +114 -0
- data/lib/helpers/fzf/src/LICENSE +21 -0
- data/lib/helpers/fzf/src/algo/algo.go +884 -0
- data/lib/helpers/fzf/src/algo/algo_test.go +197 -0
- data/lib/helpers/fzf/src/algo/normalize.go +492 -0
- data/lib/helpers/fzf/src/ansi.go +409 -0
- data/lib/helpers/fzf/src/ansi_test.go +427 -0
- data/lib/helpers/fzf/src/cache.go +81 -0
- data/lib/helpers/fzf/src/cache_test.go +39 -0
- data/lib/helpers/fzf/src/chunklist.go +89 -0
- data/lib/helpers/fzf/src/chunklist_test.go +80 -0
- data/lib/helpers/fzf/src/constants.go +85 -0
- data/lib/helpers/fzf/src/core.go +351 -0
- data/lib/helpers/fzf/src/history.go +96 -0
- data/lib/helpers/fzf/src/history_test.go +68 -0
- data/lib/helpers/fzf/src/item.go +44 -0
- data/lib/helpers/fzf/src/item_test.go +23 -0
- data/lib/helpers/fzf/src/matcher.go +235 -0
- data/lib/helpers/fzf/src/merger.go +120 -0
- data/lib/helpers/fzf/src/merger_test.go +88 -0
- data/lib/helpers/fzf/src/options.go +1691 -0
- data/lib/helpers/fzf/src/options_test.go +457 -0
- data/lib/helpers/fzf/src/pattern.go +425 -0
- data/lib/helpers/fzf/src/pattern_test.go +209 -0
- data/lib/helpers/fzf/src/protector/protector.go +8 -0
- data/lib/helpers/fzf/src/protector/protector_openbsd.go +10 -0
- data/lib/helpers/fzf/src/reader.go +201 -0
- data/lib/helpers/fzf/src/reader_test.go +63 -0
- data/lib/helpers/fzf/src/result.go +243 -0
- data/lib/helpers/fzf/src/result_others.go +16 -0
- data/lib/helpers/fzf/src/result_test.go +159 -0
- data/lib/helpers/fzf/src/result_x86.go +16 -0
- data/lib/helpers/fzf/src/terminal.go +2832 -0
- data/lib/helpers/fzf/src/terminal_test.go +638 -0
- data/lib/helpers/fzf/src/terminal_unix.go +26 -0
- data/lib/helpers/fzf/src/terminal_windows.go +45 -0
- data/lib/helpers/fzf/src/tokenizer.go +253 -0
- data/lib/helpers/fzf/src/tokenizer_test.go +112 -0
- data/lib/helpers/fzf/src/tui/dummy.go +46 -0
- data/lib/helpers/fzf/src/tui/light.go +987 -0
- data/lib/helpers/fzf/src/tui/light_unix.go +110 -0
- data/lib/helpers/fzf/src/tui/light_windows.go +145 -0
- data/lib/helpers/fzf/src/tui/tcell.go +721 -0
- data/lib/helpers/fzf/src/tui/tcell_test.go +392 -0
- data/lib/helpers/fzf/src/tui/ttyname_unix.go +47 -0
- data/lib/helpers/fzf/src/tui/ttyname_windows.go +14 -0
- data/lib/helpers/fzf/src/tui/tui.go +625 -0
- data/lib/helpers/fzf/src/tui/tui_test.go +20 -0
- data/lib/helpers/fzf/src/util/atomicbool.go +34 -0
- data/lib/helpers/fzf/src/util/atomicbool_test.go +17 -0
- data/lib/helpers/fzf/src/util/chars.go +198 -0
- data/lib/helpers/fzf/src/util/chars_test.go +46 -0
- data/lib/helpers/fzf/src/util/eventbox.go +96 -0
- data/lib/helpers/fzf/src/util/eventbox_test.go +61 -0
- data/lib/helpers/fzf/src/util/slab.go +12 -0
- data/lib/helpers/fzf/src/util/util.go +138 -0
- data/lib/helpers/fzf/src/util/util_test.go +40 -0
- data/lib/helpers/fzf/src/util/util_unix.go +47 -0
- data/lib/helpers/fzf/src/util/util_windows.go +83 -0
- data/lib/helpers/fzf/test/fzf.vader +175 -0
- data/lib/helpers/fzf/test/test_go.rb +2626 -0
- data/lib/helpers/fzf/uninstall +117 -0
- metadata +88 -2
@@ -0,0 +1,512 @@
|
|
1
|
+
fzf.txt fzf Last change: May 19 2021
|
2
|
+
FZF - TABLE OF CONTENTS *fzf* *fzf-toc*
|
3
|
+
==============================================================================
|
4
|
+
|
5
|
+
FZF Vim integration |fzf-vim-integration|
|
6
|
+
Installation |fzf-installation|
|
7
|
+
Summary |fzf-summary|
|
8
|
+
:FZF[!] |:FZF|
|
9
|
+
Configuration |fzf-configuration|
|
10
|
+
Examples |fzf-examples|
|
11
|
+
Explanation of g:fzf_colors |fzf-explanation-of-gfzfcolors|
|
12
|
+
fzf#run |fzf#run|
|
13
|
+
fzf#wrap |fzf#wrap|
|
14
|
+
Global options supported by fzf#wrap |fzf-global-options-supported-by-fzf#wrap|
|
15
|
+
Tips |fzf-tips|
|
16
|
+
fzf inside terminal buffer |fzf-inside-terminal-buffer|
|
17
|
+
Starting fzf in a popup window |fzf-starting-fzf-in-a-popup-window|
|
18
|
+
Hide statusline |fzf-hide-statusline|
|
19
|
+
License |fzf-license|
|
20
|
+
|
21
|
+
FZF VIM INTEGRATION *fzf-vim-integration*
|
22
|
+
==============================================================================
|
23
|
+
|
24
|
+
|
25
|
+
INSTALLATION *fzf-installation*
|
26
|
+
==============================================================================
|
27
|
+
|
28
|
+
Once you have fzf installed, you can enable it inside Vim simply by adding the
|
29
|
+
directory to 'runtimepath' in your Vim configuration file. The path may differ
|
30
|
+
depending on the package manager.
|
31
|
+
>
|
32
|
+
" If installed using Homebrew
|
33
|
+
set rtp+=/usr/local/opt/fzf
|
34
|
+
|
35
|
+
" If installed using git
|
36
|
+
set rtp+=~/.fzf
|
37
|
+
<
|
38
|
+
If you use {vim-plug}{1}, the same can be written as:
|
39
|
+
>
|
40
|
+
" If installed using Homebrew
|
41
|
+
Plug '/usr/local/opt/fzf'
|
42
|
+
|
43
|
+
" If installed using git
|
44
|
+
Plug '~/.fzf'
|
45
|
+
<
|
46
|
+
But if you want the latest Vim plugin file from GitHub rather than the one
|
47
|
+
included in the package, write:
|
48
|
+
>
|
49
|
+
Plug 'junegunn/fzf'
|
50
|
+
<
|
51
|
+
The Vim plugin will pick up fzf binary available on the system. If fzf is not
|
52
|
+
found on `$PATH`, it will ask you if it should download the latest binary for
|
53
|
+
you.
|
54
|
+
|
55
|
+
To make sure that you have the latest version of the binary, set up
|
56
|
+
post-update hook like so:
|
57
|
+
|
58
|
+
*fzf#install*
|
59
|
+
>
|
60
|
+
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
61
|
+
<
|
62
|
+
{1} https://github.com/junegunn/vim-plug
|
63
|
+
|
64
|
+
|
65
|
+
SUMMARY *fzf-summary*
|
66
|
+
==============================================================================
|
67
|
+
|
68
|
+
The Vim plugin of fzf provides two core functions, and `:FZF` command which is
|
69
|
+
the basic file selector command built on top of them.
|
70
|
+
|
71
|
+
1. `fzf#run([spec dict])`
|
72
|
+
- Starts fzf inside Vim with the given spec
|
73
|
+
- `:call fzf#run({'source': 'ls'})`
|
74
|
+
2. `fzf#wrap([spec dict]) -> (dict)`
|
75
|
+
- Takes a spec for `fzf#run` and returns an extended version of it with
|
76
|
+
additional options for addressing global preferences (`g:fzf_xxx`)
|
77
|
+
- `:echo fzf#wrap({'source': 'ls'})`
|
78
|
+
- We usually wrap a spec with `fzf#wrap` before passing it to `fzf#run`
|
79
|
+
- `:call fzf#run(fzf#wrap({'source': 'ls'}))`
|
80
|
+
3. `:FZF [fzf_options string] [path string]`
|
81
|
+
- Basic fuzzy file selector
|
82
|
+
- A reference implementation for those who don't want to write VimScript to
|
83
|
+
implement custom commands
|
84
|
+
- If you're looking for more such commands, check out {fzf.vim}{2} project.
|
85
|
+
|
86
|
+
The most important of all is `fzf#run`, but it would be easier to understand
|
87
|
+
the whole if we start off with `:FZF` command.
|
88
|
+
|
89
|
+
{2} https://github.com/junegunn/fzf.vim
|
90
|
+
|
91
|
+
|
92
|
+
:FZF[!]
|
93
|
+
==============================================================================
|
94
|
+
|
95
|
+
*:FZF*
|
96
|
+
>
|
97
|
+
" Look for files under current directory
|
98
|
+
:FZF
|
99
|
+
|
100
|
+
" Look for files under your home directory
|
101
|
+
:FZF ~
|
102
|
+
|
103
|
+
" With fzf command-line options
|
104
|
+
:FZF --reverse --info=inline /tmp
|
105
|
+
|
106
|
+
" Bang version starts fzf in fullscreen mode
|
107
|
+
:FZF!
|
108
|
+
<
|
109
|
+
Similarly to {ctrlp.vim}{3}, use enter key, CTRL-T, CTRL-X or CTRL-V to open
|
110
|
+
selected files in the current window, in new tabs, in horizontal splits, or in
|
111
|
+
vertical splits respectively.
|
112
|
+
|
113
|
+
Note that the environment variables `FZF_DEFAULT_COMMAND` and
|
114
|
+
`FZF_DEFAULT_OPTS` also apply here.
|
115
|
+
|
116
|
+
{3} https://github.com/kien/ctrlp.vim
|
117
|
+
|
118
|
+
|
119
|
+
< Configuration >_____________________________________________________________~
|
120
|
+
*fzf-configuration*
|
121
|
+
|
122
|
+
*g:fzf_action* *g:fzf_layout* *g:fzf_colors* *g:fzf_history_dir*
|
123
|
+
|
124
|
+
- `g:fzf_action`
|
125
|
+
- Customizable extra key bindings for opening selected files in different
|
126
|
+
ways
|
127
|
+
- `g:fzf_layout`
|
128
|
+
- Determines the size and position of fzf window
|
129
|
+
- `g:fzf_colors`
|
130
|
+
- Customizes fzf colors to match the current color scheme
|
131
|
+
- `g:fzf_history_dir`
|
132
|
+
- Enables history feature
|
133
|
+
|
134
|
+
|
135
|
+
Examples~
|
136
|
+
*fzf-examples*
|
137
|
+
>
|
138
|
+
" This is the default extra key bindings
|
139
|
+
let g:fzf_action = {
|
140
|
+
\ 'ctrl-t': 'tab split',
|
141
|
+
\ 'ctrl-x': 'split',
|
142
|
+
\ 'ctrl-v': 'vsplit' }
|
143
|
+
|
144
|
+
" An action can be a reference to a function that processes selected lines
|
145
|
+
function! s:build_quickfix_list(lines)
|
146
|
+
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
|
147
|
+
copen
|
148
|
+
cc
|
149
|
+
endfunction
|
150
|
+
|
151
|
+
let g:fzf_action = {
|
152
|
+
\ 'ctrl-q': function('s:build_quickfix_list'),
|
153
|
+
\ 'ctrl-t': 'tab split',
|
154
|
+
\ 'ctrl-x': 'split',
|
155
|
+
\ 'ctrl-v': 'vsplit' }
|
156
|
+
|
157
|
+
" Default fzf layout
|
158
|
+
" - Popup window (center of the screen)
|
159
|
+
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
|
160
|
+
|
161
|
+
" - Popup window (center of the current window)
|
162
|
+
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'relative': v:true } }
|
163
|
+
|
164
|
+
" - Popup window (anchored to the bottom of the current window)
|
165
|
+
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6, 'relative': v:true, 'yoffset': 1.0 } }
|
166
|
+
|
167
|
+
" - down / up / left / right
|
168
|
+
let g:fzf_layout = { 'down': '40%' }
|
169
|
+
|
170
|
+
" - Window using a Vim command
|
171
|
+
let g:fzf_layout = { 'window': 'enew' }
|
172
|
+
let g:fzf_layout = { 'window': '-tabnew' }
|
173
|
+
let g:fzf_layout = { 'window': '10new' }
|
174
|
+
|
175
|
+
" Customize fzf colors to match your color scheme
|
176
|
+
" - fzf#wrap translates this to a set of `--color` options
|
177
|
+
let g:fzf_colors =
|
178
|
+
\ { 'fg': ['fg', 'Normal'],
|
179
|
+
\ 'bg': ['bg', 'Normal'],
|
180
|
+
\ 'hl': ['fg', 'Comment'],
|
181
|
+
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
182
|
+
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
183
|
+
\ 'hl+': ['fg', 'Statement'],
|
184
|
+
\ 'info': ['fg', 'PreProc'],
|
185
|
+
\ 'border': ['fg', 'Ignore'],
|
186
|
+
\ 'prompt': ['fg', 'Conditional'],
|
187
|
+
\ 'pointer': ['fg', 'Exception'],
|
188
|
+
\ 'marker': ['fg', 'Keyword'],
|
189
|
+
\ 'spinner': ['fg', 'Label'],
|
190
|
+
\ 'header': ['fg', 'Comment'] }
|
191
|
+
|
192
|
+
" Enable per-command history
|
193
|
+
" - History files will be stored in the specified directory
|
194
|
+
" - When set, CTRL-N and CTRL-P will be bound to 'next-history' and
|
195
|
+
" 'previous-history' instead of 'down' and 'up'.
|
196
|
+
let g:fzf_history_dir = '~/.local/share/fzf-history'
|
197
|
+
<
|
198
|
+
|
199
|
+
Explanation of g:fzf_colors~
|
200
|
+
*fzf-explanation-of-gfzfcolors*
|
201
|
+
|
202
|
+
`g:fzf_colors` is a dictionary mapping fzf elements to a color specification
|
203
|
+
list:
|
204
|
+
>
|
205
|
+
element: [ component, group1 [, group2, ...] ]
|
206
|
+
<
|
207
|
+
- `element` is an fzf element to apply a color to:
|
208
|
+
|
209
|
+
----------------------------+------------------------------------------------------
|
210
|
+
Element | Description ~
|
211
|
+
----------------------------+------------------------------------------------------
|
212
|
+
`fg` / `bg` / `hl` | Item (foreground / background / highlight)
|
213
|
+
`fg+` / `bg+` / `hl+` | Current item (foreground / background / highlight)
|
214
|
+
`preview-fg` / `preview-bg` | Preview window text and background
|
215
|
+
`hl` / `hl+` | Highlighted substrings (normal / current)
|
216
|
+
`gutter` | Background of the gutter on the left
|
217
|
+
`pointer` | Pointer to the current line ( `>` )
|
218
|
+
`marker` | Multi-select marker ( `>` )
|
219
|
+
`border` | Border around the window ( `--border` and `--preview` )
|
220
|
+
`header` | Header ( `--header` or `--header-lines` )
|
221
|
+
`info` | Info line (match counters)
|
222
|
+
`spinner` | Streaming input indicator
|
223
|
+
`query` | Query string
|
224
|
+
`disabled` | Query string when search is disabled
|
225
|
+
`prompt` | Prompt before query ( `> ` )
|
226
|
+
`pointer` | Pointer to the current line ( `>` )
|
227
|
+
----------------------------+------------------------------------------------------
|
228
|
+
- `component` specifies the component (`fg` / `bg`) from which to extract the
|
229
|
+
color when considering each of the following highlight groups
|
230
|
+
- `group1 [, group2, ...]` is a list of highlight groups that are searched (in
|
231
|
+
order) for a matching color definition
|
232
|
+
|
233
|
+
For example, consider the following specification:
|
234
|
+
>
|
235
|
+
'prompt': ['fg', 'Conditional', 'Comment'],
|
236
|
+
<
|
237
|
+
This means we color the prompt - using the `fg` attribute of the `Conditional`
|
238
|
+
if it exists, - otherwise use the `fg` attribute of the `Comment` highlight
|
239
|
+
group if it exists, - otherwise fall back to the default color settings for
|
240
|
+
the prompt.
|
241
|
+
|
242
|
+
You can examine the color option generated according the setting by printing
|
243
|
+
the result of `fzf#wrap()` function like so:
|
244
|
+
>
|
245
|
+
:echo fzf#wrap()
|
246
|
+
<
|
247
|
+
|
248
|
+
FZF#RUN
|
249
|
+
==============================================================================
|
250
|
+
|
251
|
+
*fzf#run*
|
252
|
+
|
253
|
+
`fzf#run()` function is the core of Vim integration. It takes a single
|
254
|
+
dictionary argument, a spec, and starts fzf process accordingly. At the very
|
255
|
+
least, specify `sink` option to tell what it should do with the selected
|
256
|
+
entry.
|
257
|
+
>
|
258
|
+
call fzf#run({'sink': 'e'})
|
259
|
+
<
|
260
|
+
We haven't specified the `source`, so this is equivalent to starting fzf on
|
261
|
+
command line without standard input pipe; fzf will use find command (or
|
262
|
+
`$FZF_DEFAULT_COMMAND` if defined) to list the files under the current
|
263
|
+
directory. When you select one, it will open it with the sink, `:e` command.
|
264
|
+
If you want to open it in a new tab, you can pass `:tabedit` command instead
|
265
|
+
as the sink.
|
266
|
+
>
|
267
|
+
call fzf#run({'sink': 'tabedit'})
|
268
|
+
<
|
269
|
+
Instead of using the default find command, you can use any shell command as
|
270
|
+
the source. The following example will list the files managed by git. It's
|
271
|
+
equivalent to running `git ls-files | fzf` on shell.
|
272
|
+
>
|
273
|
+
call fzf#run({'source': 'git ls-files', 'sink': 'e'})
|
274
|
+
<
|
275
|
+
fzf options can be specified as `options` entry in spec dictionary.
|
276
|
+
>
|
277
|
+
call fzf#run({'sink': 'tabedit', 'options': '--multi --reverse'})
|
278
|
+
<
|
279
|
+
You can also pass a layout option if you don't want fzf window to take up the
|
280
|
+
entire screen.
|
281
|
+
>
|
282
|
+
" up / down / left / right / window are allowed
|
283
|
+
call fzf#run({'source': 'git ls-files', 'sink': 'e', 'left': '40%'})
|
284
|
+
call fzf#run({'source': 'git ls-files', 'sink': 'e', 'window': '30vnew'})
|
285
|
+
<
|
286
|
+
`source` doesn't have to be an external shell command, you can pass a Vim
|
287
|
+
array as the source. In the next example, we pass the names of color schemes
|
288
|
+
as the source to implement a color scheme selector.
|
289
|
+
>
|
290
|
+
call fzf#run({'source': map(split(globpath(&rtp, 'colors/*.vim')),
|
291
|
+
\ 'fnamemodify(v:val, ":t:r")'),
|
292
|
+
\ 'sink': 'colo', 'left': '25%'})
|
293
|
+
<
|
294
|
+
The following table summarizes the available options.
|
295
|
+
|
296
|
+
---------------------------+---------------+----------------------------------------------------------------------
|
297
|
+
Option name | Type | Description ~
|
298
|
+
---------------------------+---------------+----------------------------------------------------------------------
|
299
|
+
`source` | string | External command to generate input to fzf (e.g. `find .` )
|
300
|
+
`source` | list | Vim list as input to fzf
|
301
|
+
`sink` | string | Vim command to handle the selected item (e.g. `e` , `tabe` )
|
302
|
+
`sink` | funcref | Reference to function to process each selected item
|
303
|
+
`sinklist` (or `sink*` ) | funcref | Similar to `sink` , but takes the list of output lines at once
|
304
|
+
`options` | string/list | Options to fzf
|
305
|
+
`dir` | string | Working directory
|
306
|
+
`up` / `down` / `left` / `right` | number/string | (Layout) Window position and size (e.g. `20` , `50%` )
|
307
|
+
`tmux` | string | (Layout) fzf-tmux options (e.g. `-p90%,60%` )
|
308
|
+
`window` (Vim 8 / Neovim) | string | (Layout) Command to open fzf window (e.g. `vertical aboveleft 30new` )
|
309
|
+
`window` (Vim 8 / Neovim) | dict | (Layout) Popup window settings (e.g. `{'width': 0.9, 'height': 0.6}` )
|
310
|
+
---------------------------+---------------+----------------------------------------------------------------------
|
311
|
+
|
312
|
+
`options` entry can be either a string or a list. For simple cases, string
|
313
|
+
should suffice, but prefer to use list type to avoid escaping issues.
|
314
|
+
>
|
315
|
+
call fzf#run({'options': '--reverse --prompt "C:\\Program Files\\"'})
|
316
|
+
call fzf#run({'options': ['--reverse', '--prompt', 'C:\Program Files\']})
|
317
|
+
<
|
318
|
+
When `window` entry is a dictionary, fzf will start in a popup window. The
|
319
|
+
following options are allowed:
|
320
|
+
|
321
|
+
- Required:
|
322
|
+
- `width` [float range [0 ~ 1]] or [integer range [8 ~ ]]
|
323
|
+
- `height` [float range [0 ~ 1]] or [integer range [4 ~ ]]
|
324
|
+
- Optional:
|
325
|
+
- `yoffset` [float default 0.5 range [0 ~ 1]]
|
326
|
+
- `xoffset` [float default 0.5 range [0 ~ 1]]
|
327
|
+
- `relative` [boolean default v:false]
|
328
|
+
- `border` [string default `rounded`]: Border style
|
329
|
+
- `rounded` / `sharp` / `horizontal` / `vertical` / `top` / `bottom` / `left` / `right` / `no[ne]`
|
330
|
+
|
331
|
+
|
332
|
+
FZF#WRAP
|
333
|
+
==============================================================================
|
334
|
+
|
335
|
+
*fzf#wrap*
|
336
|
+
|
337
|
+
We have seen that several aspects of `:FZF` command can be configured with a
|
338
|
+
set of global option variables; different ways to open files (`g:fzf_action`),
|
339
|
+
window position and size (`g:fzf_layout`), color palette (`g:fzf_colors`),
|
340
|
+
etc.
|
341
|
+
|
342
|
+
So how can we make our custom `fzf#run` calls also respect those variables?
|
343
|
+
Simply by "wrapping" the spec dictionary with `fzf#wrap` before passing it to
|
344
|
+
`fzf#run`.
|
345
|
+
|
346
|
+
- `fzf#wrap([name string], [spec dict], [fullscreen bool]) -> (dict)`
|
347
|
+
- All arguments are optional. Usually we only need to pass a spec
|
348
|
+
dictionary.
|
349
|
+
- `name` is for managing history files. It is ignored if `g:fzf_history_dir`
|
350
|
+
is not defined.
|
351
|
+
- `fullscreen` can be either `0` or `1` (default: 0).
|
352
|
+
|
353
|
+
`fzf#wrap` takes a spec and returns an extended version of it (also a
|
354
|
+
dictionary) with additional options for addressing global preferences. You can
|
355
|
+
examine the return value of it like so:
|
356
|
+
>
|
357
|
+
echo fzf#wrap({'source': 'ls'})
|
358
|
+
<
|
359
|
+
After we "wrap" our spec, we pass it to `fzf#run`.
|
360
|
+
>
|
361
|
+
call fzf#run(fzf#wrap({'source': 'ls'}))
|
362
|
+
<
|
363
|
+
Now it supports CTRL-T, CTRL-V, and CTRL-X key bindings (configurable via
|
364
|
+
`g:fzf_action`) and it opens fzf window according to `g:fzf_layout` setting.
|
365
|
+
|
366
|
+
To make it easier to use, let's define `LS` command.
|
367
|
+
>
|
368
|
+
command! LS call fzf#run(fzf#wrap({'source': 'ls'}))
|
369
|
+
<
|
370
|
+
Type `:LS` and see how it works.
|
371
|
+
|
372
|
+
We would like to make `:LS!` (bang version) open fzf in fullscreen, just like
|
373
|
+
`:FZF!`. Add `-bang` to command definition, and use <bang> value to set the
|
374
|
+
last `fullscreen` argument of `fzf#wrap` (see :help <bang>).
|
375
|
+
>
|
376
|
+
" On :LS!, <bang> evaluates to '!', and '!0' becomes 1
|
377
|
+
command! -bang LS call fzf#run(fzf#wrap({'source': 'ls'}, <bang>0))
|
378
|
+
<
|
379
|
+
Our `:LS` command will be much more useful if we can pass a directory argument
|
380
|
+
to it, so that something like `:LS /tmp` is possible.
|
381
|
+
>
|
382
|
+
command! -bang -complete=dir -nargs=? LS
|
383
|
+
\ call fzf#run(fzf#wrap({'source': 'ls', 'dir': <q-args>}, <bang>0))
|
384
|
+
<
|
385
|
+
Lastly, if you have enabled `g:fzf_history_dir`, you might want to assign a
|
386
|
+
unique name to our command and pass it as the first argument to `fzf#wrap`.
|
387
|
+
>
|
388
|
+
" The query history for this command will be stored as 'ls' inside g:fzf_history_dir.
|
389
|
+
" The name is ignored if g:fzf_history_dir is not defined.
|
390
|
+
command! -bang -complete=dir -nargs=? LS
|
391
|
+
\ call fzf#run(fzf#wrap('ls', {'source': 'ls', 'dir': <q-args>}, <bang>0))
|
392
|
+
<
|
393
|
+
|
394
|
+
< Global options supported by fzf#wrap >______________________________________~
|
395
|
+
*fzf-global-options-supported-by-fzf#wrap*
|
396
|
+
|
397
|
+
- `g:fzf_layout`
|
398
|
+
- `g:fzf_action`
|
399
|
+
- Works only when no custom `sink` (or `sink*`) is provided
|
400
|
+
- Having custom sink usually means that each entry is not an ordinary
|
401
|
+
file path (e.g. name of color scheme), so we can't blindly apply the
|
402
|
+
same strategy (i.e. `tabedit some-color-scheme` doesn't make sense)
|
403
|
+
- `g:fzf_colors`
|
404
|
+
- `g:fzf_history_dir`
|
405
|
+
|
406
|
+
|
407
|
+
TIPS *fzf-tips*
|
408
|
+
==============================================================================
|
409
|
+
|
410
|
+
|
411
|
+
< fzf inside terminal buffer >________________________________________________~
|
412
|
+
*fzf-inside-terminal-buffer*
|
413
|
+
|
414
|
+
The latest versions of Vim and Neovim include builtin terminal emulator
|
415
|
+
(`:terminal`) and fzf will start in a terminal buffer in the following cases:
|
416
|
+
|
417
|
+
- On Neovim
|
418
|
+
- On GVim
|
419
|
+
- On Terminal Vim with a non-default layout
|
420
|
+
- `call fzf#run({'left': '30%'})` or `let g:fzf_layout = {'left': '30%'}`
|
421
|
+
|
422
|
+
On the latest versions of Vim and Neovim, fzf will start in a terminal buffer.
|
423
|
+
If you find the default ANSI colors to be different, consider configuring the
|
424
|
+
colors using `g:terminal_ansi_colors` in regular Vim or `g:terminal_color_x`
|
425
|
+
in Neovim.
|
426
|
+
|
427
|
+
*g:terminal_color_15* *g:terminal_color_14* *g:terminal_color_13*
|
428
|
+
*g:terminal_color_12* *g:terminal_color_11* *g:terminal_color_10* *g:terminal_color_9*
|
429
|
+
*g:terminal_color_8* *g:terminal_color_7* *g:terminal_color_6* *g:terminal_color_5*
|
430
|
+
*g:terminal_color_4* *g:terminal_color_3* *g:terminal_color_2* *g:terminal_color_1*
|
431
|
+
*g:terminal_color_0*
|
432
|
+
>
|
433
|
+
" Terminal colors for seoul256 color scheme
|
434
|
+
if has('nvim')
|
435
|
+
let g:terminal_color_0 = '#4e4e4e'
|
436
|
+
let g:terminal_color_1 = '#d68787'
|
437
|
+
let g:terminal_color_2 = '#5f865f'
|
438
|
+
let g:terminal_color_3 = '#d8af5f'
|
439
|
+
let g:terminal_color_4 = '#85add4'
|
440
|
+
let g:terminal_color_5 = '#d7afaf'
|
441
|
+
let g:terminal_color_6 = '#87afaf'
|
442
|
+
let g:terminal_color_7 = '#d0d0d0'
|
443
|
+
let g:terminal_color_8 = '#626262'
|
444
|
+
let g:terminal_color_9 = '#d75f87'
|
445
|
+
let g:terminal_color_10 = '#87af87'
|
446
|
+
let g:terminal_color_11 = '#ffd787'
|
447
|
+
let g:terminal_color_12 = '#add4fb'
|
448
|
+
let g:terminal_color_13 = '#ffafaf'
|
449
|
+
let g:terminal_color_14 = '#87d7d7'
|
450
|
+
let g:terminal_color_15 = '#e4e4e4'
|
451
|
+
else
|
452
|
+
let g:terminal_ansi_colors = [
|
453
|
+
\ '#4e4e4e', '#d68787', '#5f865f', '#d8af5f',
|
454
|
+
\ '#85add4', '#d7afaf', '#87afaf', '#d0d0d0',
|
455
|
+
\ '#626262', '#d75f87', '#87af87', '#ffd787',
|
456
|
+
\ '#add4fb', '#ffafaf', '#87d7d7', '#e4e4e4'
|
457
|
+
\ ]
|
458
|
+
endif
|
459
|
+
<
|
460
|
+
|
461
|
+
< Starting fzf in a popup window >____________________________________________~
|
462
|
+
*fzf-starting-fzf-in-a-popup-window*
|
463
|
+
>
|
464
|
+
" Required:
|
465
|
+
" - width [float range [0 ~ 1]] or [integer range [8 ~ ]]
|
466
|
+
" - height [float range [0 ~ 1]] or [integer range [4 ~ ]]
|
467
|
+
"
|
468
|
+
" Optional:
|
469
|
+
" - xoffset [float default 0.5 range [0 ~ 1]]
|
470
|
+
" - yoffset [float default 0.5 range [0 ~ 1]]
|
471
|
+
" - relative [boolean default v:false]
|
472
|
+
" - border [string default 'rounded']: Border style
|
473
|
+
" - 'rounded' / 'sharp' / 'horizontal' / 'vertical' / 'top' / 'bottom' / 'left' / 'right'
|
474
|
+
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
|
475
|
+
<
|
476
|
+
Alternatively, you can make fzf open in a tmux popup window (requires tmux 3.2
|
477
|
+
or above) by putting fzf-tmux options in `tmux` key.
|
478
|
+
>
|
479
|
+
" See `man fzf-tmux` for available options
|
480
|
+
if exists('$TMUX')
|
481
|
+
let g:fzf_layout = { 'tmux': '-p90%,60%' }
|
482
|
+
else
|
483
|
+
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
|
484
|
+
endif
|
485
|
+
<
|
486
|
+
|
487
|
+
< Hide statusline >___________________________________________________________~
|
488
|
+
*fzf-hide-statusline*
|
489
|
+
|
490
|
+
When fzf starts in a terminal buffer, the file type of the buffer is set to
|
491
|
+
`fzf`. So you can set up `FileType fzf` autocmd to customize the settings of
|
492
|
+
the window.
|
493
|
+
|
494
|
+
For example, if you open fzf on the bottom on the screen (e.g. `{'down':
|
495
|
+
'40%'}`), you might want to temporarily disable the statusline for a cleaner
|
496
|
+
look.
|
497
|
+
>
|
498
|
+
let g:fzf_layout = { 'down': '30%' }
|
499
|
+
autocmd! FileType fzf
|
500
|
+
autocmd FileType fzf set laststatus=0 noshowmode noruler
|
501
|
+
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
|
502
|
+
<
|
503
|
+
|
504
|
+
LICENSE *fzf-license*
|
505
|
+
==============================================================================
|
506
|
+
|
507
|
+
The MIT License (MIT)
|
508
|
+
|
509
|
+
Copyright (c) 2013-2021 Junegunn Choi
|
510
|
+
|
511
|
+
==============================================================================
|
512
|
+
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module github.com/junegunn/fzf
|
2
|
+
|
3
|
+
require (
|
4
|
+
github.com/gdamore/tcell v1.4.0
|
5
|
+
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
6
|
+
github.com/mattn/go-isatty v0.0.14
|
7
|
+
github.com/mattn/go-runewidth v0.0.13
|
8
|
+
github.com/mattn/go-shellwords v1.0.12
|
9
|
+
github.com/rivo/uniseg v0.2.0
|
10
|
+
github.com/saracen/walker v0.1.2
|
11
|
+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
12
|
+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
|
13
|
+
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6
|
14
|
+
golang.org/x/text v0.3.6 // indirect
|
15
|
+
)
|
16
|
+
|
17
|
+
go 1.13
|
@@ -0,0 +1,31 @@
|
|
1
|
+
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
2
|
+
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
3
|
+
github.com/gdamore/tcell v1.4.0 h1:vUnHwJRvcPQa3tzi+0QI4U9JINXYJlOz9yiaiPQ2wMU=
|
4
|
+
github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404ZVSMo0=
|
5
|
+
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
6
|
+
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
7
|
+
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
8
|
+
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
9
|
+
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
10
|
+
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
11
|
+
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
12
|
+
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
13
|
+
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
|
14
|
+
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
15
|
+
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
16
|
+
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
17
|
+
github.com/saracen/walker v0.1.2 h1:/o1TxP82n8thLvmL4GpJXduYaRmJ7qXp8u9dSlV0zmo=
|
18
|
+
github.com/saracen/walker v0.1.2/go.mod h1:0oKYMsKVhSJ+ful4p/XbjvXbMgLEkLITZaxozsl4CGE=
|
19
|
+
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
20
|
+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
21
|
+
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
22
|
+
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
23
|
+
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
24
|
+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
|
25
|
+
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
26
|
+
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 h1:EC6+IGYTjPpRfv9a2b/6Puw0W+hLtAhkV1tPsXhutqs=
|
27
|
+
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
28
|
+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
29
|
+
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
30
|
+
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
31
|
+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|