Open lacygoill opened 2 years ago
Also, the final value of the files
argument as displayed in the preview window looks wrong.
Expected:
files = "./c.txt" "./b.txt" "./a.txt"
Actual (with --map
):
files = ./c.txt' './b.txt' './a.txt
Actual (without --map
):
files = "./c.txt' './b.txt' './a.txt"
I guess that under the hood, navi itself uses --map
to implement --expand
; which would explain why the latter fails when we use --map
. We're probably overriding whatever navi intended to do with it.
If that's the case, maybe it should be allowed to specify several --map
parameters, and make sure that --expand
is executed last (i.e. after all the other --map
s).
Your hypothesis is correct: https://github.com/denisidoro/navi/blob/3b1038c8849d5b9d4a15452646f74dc10a435b50/src/parser.rs#L37
The solution would be to make map and expand independent of each other
Describe the bug
The
--expand
parameter doesn't work when specifying the default values of an argument, if the--map
parameter is also used.To Reproduce
In the file
/tmp/cheats/cheat.cheat
, write this snippet:Next, in an interactive shell, execute these commands:
In the fzf window, select all of the 3 matches:
a.txt
,b.txt
andc.txt
. To do so, pressCTRL-p
twice, thenTab
three times. Finally, pressEnter
.This is echo'ed:
Expected behavior
This is echo'ed:
Because that's how
--expand
is documented indocs/cheatsheet_syntax.md
:source
source
Versions:
Additional context
The issue disappears once we remove the
--map
parameter when specifying the default values of thefiles
argument:However, note that in this example,
--map
executes ased(1)
command which doesn't even alter the results. It executes a substitution command replacingz
withZ
; but there is noz
ina.txt
,b.txt
,c.txt
.