Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quitcd not working in fish if path contains backslash #1957

Open
Ordoviz opened this issue Nov 14, 2024 · 2 comments
Open

quitcd not working in fish if path contains backslash #1957

Ordoviz opened this issue Nov 14, 2024 · 2 comments
Labels

Comments

@Ordoviz
Copy link

Ordoviz commented Nov 14, 2024

If you press ^G to exit nnn or have configured quitcd, nnn writes a cd command in POSIX-shell syntax into ~/.config/nnn/.lastd. While fish syntax is similar to POSIX, they differ on their handling of backslashes in single-quoted strings. In particular, if nnn writes a path ending in a backslash into .lastd, and you source .lastd in fish you get Unexpected end of string, quotes are not balanced.

To fix this, nnn should write the raw (unescaped) path to ~/.config/nnn/.lastd_raw or stdout so that you don't need to parse the escaped path in fish. This would probably also be helpful for nushell, where you currently need to do some horrible string parsing to extract the path from .lastd.

@Ordoviz Ordoviz added the bug label Nov 14, 2024
@N-R-K
Copy link
Collaborator

N-R-K commented Nov 15, 2024

ping: @BeyondMagic

@BeyondMagic
Copy link
Contributor

This would probably also be helpful for nushell, where you currently need to do some horrible string parsing to extract the path from .lastd.

Hey, it's not terrible! It's just... tricky!

But yep, it'd be better for Nushell as well the raw path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants