Closed jtrv closed 2 years ago
I will need to investigate further on the viability of this.
The main issue being zoxide
is a standalone program and doesn't provide any integration with other rust applications.
So I'm thinking interacting with it will require a lot of spawning child processes and reading/writing from stdin/stdout.
@kamiyaa if it helps, there are a bunch of file managers that already provide zoxide functionality via the CLI itself, and it does not appear to impact user experience:
xplr and felix are both written in Rust, just like joshuto.
@ajeetdsouza Thanks! I think I have a good idea on how to implement this now :+1: Should be implemented soon everyone!
Sounds great! I'd be happy to feature joshuto on zoxide's README once this lands.
joshuto
now has initial integration with zoxide in dev branch (https://github.com/kamiyaa/joshuto/commit/7ad3eb1823556107cd412bb25d4f8e95931354e0).
Feel free to test it out and let me know how it is.
I haven't used zoxide
a lot myself so I'm not sure if I am covering everything xd.
You can find the commands for it here: https://github.com/kamiyaa/joshuto/blob/dev/docs/configuration/keymap.toml.md#integration
Hi! Side question: like in the CI, dev branch doesn’t build with latest nightly for me:
error[E0308]: mismatched types
--> src/ui/widgets/tui_file_preview.rs:43:46
|
43 | buf.set_spans(area.x, y, line, area.width);
| ^^^^ expected struct `Spans`, found struct `tui::text::Spans`
|
= note: expected reference `&Spans<'_>`
found reference `&tui::text::Spans<'_>`
= note: perhaps two different versions of crate `tui` are being used?
For more information about this error, try `rustc --explain E0308`.
error: could not compile `joshuto` due to previous error
I think that error is there since some time. Am I missing something?
Hi! Side question: like in the CI, dev branch doesn’t build with latest nightly for me:
error[E0308]: mismatched types --> src/ui/widgets/tui_file_preview.rs:43:46 | 43 | buf.set_spans(area.x, y, line, area.width); | ^^^^ expected struct `Spans`, found struct `tui::text::Spans` | = note: expected reference `&Spans<'_>` found reference `&tui::text::Spans<'_>` = note: perhaps two different versions of crate `tui` are being used? For more information about this error, try `rustc --explain E0308`. error: could not compile `joshuto` due to previous error
I think that error is there since some time. Am I missing something?
You might have ansi-to-tui as a dependency, which uses an older version of tui-rs. I removed ansi-to-tui as a default dependency for now because it's a bit buggy.
@kamiyaa it works great! I have a few suggestions/nitpicks:
zoxide: no match found
. Perhaps this can be captured and dispayed.zoxide add
if z
/zi
succeeds.trim()
, a more "correct" way to do it would be removing the last byte from the output of zoxide query
(trailing newline). trim
will fail on directories where the paths teminate in a space, for example.z {}
is displayed, it looks strange on directories with spaces in the name, because it's not quoted (eg, z /this/looks like/multiple arguments
). Instead, you could either just show the path without printing z
, or add quoting using z {:?}
/shell-words.@kamiyaa it works great! I have a few suggestions/nitpicks:
* Currently, zoxide fails silently. zoxide will give you errors over stderr, eg. `zoxide: no match found`. Perhaps this can be captured and dispayed. * You may want to call `zoxide add` if `z`/`zi` succeeds. * Instead of using `trim()`, a more "correct" way to do it would be removing the last byte from the output of `zoxide query` (trailing newline). `trim` will fail on directories where the paths teminate in a space, for example. * When `z {}` is displayed, it looks strange on directories with spaces in the name, because it's not quoted (eg, `z /this/looks like/multiple arguments`). Instead, you could either just show the path without printing `z`, or add quoting using `z {:?}`/[shell-words](https://crates.io/crates/shell-words).
Thanks @ajeetdsouza ! I've addressed all these issues now :+1:
https://github.com/kamiyaa/joshuto/commit/8e7005ac347d0ef06af83e87874c824aa432da42
Awesome, thanks!
I think it could be beneficial to replace
cd
functions with an implementation ofzoxide
since it is written in rust and works the same ascd
with some really great additional functionality