File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 1+ local c
12--- @class fle.config.Cmd : fzf-lua.config.Base
23local __DEFAULT__ = {
34 allow = {
45 journalctl = true ,
6+ curl = true ,
57 },
68 fzf_opts = {
79 [' --raw' ] = true ,
810 },
11+ preview = {
12+ fn = function (...) return c (... ) end ,
13+ type = ' cmd' ,
14+ field_index = ' {q}' ,
15+ },
916}
17+
18+ c = function (s , opts )
19+ -- TODO: callback should have way to access cmd
20+ opts = type (opts ) == ' table' and opts or __DEFAULT__
21+ local q = s [1 ]
22+ local cmd = q :match (' ^%s*(%S+)' )
23+ if not cmd or not opts .allow [cmd ] then return vim .tbl_keys (opts .allow ) end
24+ return q
25+ end
1026return function (opts )
1127 assert (__DEFAULT__ )
12- FzfLua .fzf_live (function (s )
13- local q = s [1 ]
14- local cmd = q :match (' ^%s*(%S+)' )
15- if not cmd or not opts .allow [cmd ] then return vim .tbl_keys (opts .allow ) end
16- return q
17- end , opts )
28+ FzfLua .fzf_live (c , opts )
1829end
You can’t perform that action at this time.
0 commit comments