Comments (10)
I don't have $FZF_DEFAULT_OPTS env var in xonsh nor in bash. Maybe my fzf version 0.39.0 (20230402) has better defaults or the setting is somewhere else.
It must be somewhere else, because I can reproduce on master in a freshly installed virtual machine.
So we have a workaround for this problem.
Yes, we might want to document this.
Not sure if anybody wants to introduce some method of escaping dollars/colons - if not I can close this issue.
IMO, it is definitely an issue. I encountered this as soon as I started using navi, but with the semicolon character. I sometimes write this kind of multi-line command:
command 1 \
; command 2 \
; command 3
For me, with the fish shell, the solution was to indent the subsequent commands:
command 1 \
; command 2 \
; command 3
Not sure about xonsh.
A similar issue might affect the angle bracket characters.
from navi.
Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)
from navi.
I'm already on lastest version. Good bot :)
from navi.
Try to add a space in front of the command:
# envss
$DISPLAY = ':0'
^
Ignore the caret. It's just there to point to the space above.
How can I escape either dollar or colon sign?
I suppose you meant "semicolon" instead of "colon".
Anyway, I agree that using the semicolon as the comment leader can be problematic.
navi had a similar issue when it had to find a syntax to separate a shell command producing default values for an argument, from optional parameters. It chose ---
. I think the rationale is that it extends the --
syntax which is a widely used convention among a lof of Linux commands. FWIW, I would be in favor of doing the same with #
, which is often used as a comment leader (navi itself uses it for the command descriptions). navi could use ##
for meta-comments, and keep ;
as a legacy syntax.
from navi.
and keep ; as a legacy syntax.
Never mind. Keeping ;
as a legacy syntax would maintain the issue, unless it's hidden behind a configuration option. I guess it's too late to change that now without breaking people's cheats.
from navi.
I suppose you meant "semicolon" instead of "colon".
No, I meant escaping literal colon which is :
char (or dollar $
- either one should work), because it is used by navi to define snippet variables (eg: $ var: echo 'test'
) and it can also be used in shell variable as its value (eg for xonsh: $var = ':test'
). Navi misbehaves in this case, because it probably thinks it is snippet/navi variable definition (since the line contains both $
and :
) and doesn't let me insert my snippet into terminal :(
In other words, this snippet works:
# envss
$DISPLAY = '0'
but this one doesn't work:
# envss
$DISPLAY = ':0'
Anyway I just found a workaround: this snippet inserts what I want into the terminal:
# envss
$DISPLAY = '<colon>0'
$ colon: echo ':'
from navi.
Anyway I just found a workaround: this snippet inserts what I want into the terminal:
I still think that prefixing the command with a space is simpler to read and maintain. That said, if you want to bypass the fzf prompt, you might be interested in passing --select-1
to fzf(1)
:
# envss
$DISPLAY = '<colon>0'
$ colon: echo ':' --- --fzf-overrides --select-1
from navi.
I still think that prefixing the command with a space is simpler to read and maintain.
Yes, it would be simpler for other shells, but I if use multiline statements in xonsh and prefix them with space, it throws error:
$> $TEST=':0'
$TEST='a'
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
File "<stdin>", line 2
$TEST='a'
SyntaxError: ('code: ',)
Probably because it's python shell, so - like in python - every space prefix matters.
That said, if you want to bypass the fzf prompt, you might be interested in passing (...)
Fzf prompt is not invoked in $ colon: echo ':'
(for me at least), because variable has only one value. If I added more values (separated by eg new line), then I would see fzf prompt.
Thank you.
from navi.
I if use multiline statements in xonsh and prefix them with space, it throws error:
Understood. I'm not familiar with xonsh.
Fzf prompt is not invoked here (for me at least)
OK, I guess --select-1
is included in your FZF_DEFAULT_OPTS
, because by default fzf does give a prompt:
$ env --ignore-environment bash --noprofile --norc -c "echo ':' | $(type --path fzf)"
from navi.
I don't have $FZF_DEFAULT_OPTS env var in xonsh nor in bash. Maybe my fzf version 0.39.0 (20230402)
has better defaults or the setting is somewhere else.
So we have a workaround for this problem. Not sure if anybody wants to introduce some method of escaping dollars/colons - if not I can close this issue.
from navi.
Related Issues (20)
- stack overflow while executing "navi" HOT 6
- I've tried using this, and i can't understand how it works. HOT 1
- Please adapt to Chinese HOT 1
- installing on Ubuntu HOT 3
- Handle multiline snippets better HOT 1
- Support non-interactive mode HOT 1
- Allow multi line command description HOT 3
- Remove broken playground link from README.md HOT 1
- broken character HOT 3
- Implement command to `prune` the unavailable cheats HOT 1
- Unable to use NAVI with TMUX in SSH session HOT 1
- 2.22.1 fails to build due to fs_at crate HOT 9
- Unexpected argument '--print' found HOT 6
- Install script generates incorrect URL and fails, when downloading from github HOT 1
- Allow shell history with atuin shell history tool HOT 1
- Support zellij terminal workspace. HOT 1
- Cant use tldr. HOT 5
- FR: command to recursively lowercase a directory tree/file on the default cheats HOT 1
- How to modify the parameters already filled in HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from navi.