kamiyaa / joshuto

ranger-like terminal file manager written in Rust
https://crates.io/crates/joshuto
GNU Lesser General Public License v3.0
3.41k stars 151 forks source link

Add a new feature: fzf bookmarks #306

Closed Jacky-Lzx closed 1 year ago

Jacky-Lzx commented 1 year ago

I'm implementing fzf bookmarks inspired from ranger-fzf-marks, which is a plugin I use everyday in ranger, and I'd like to have it as well in joshuto.

It acts as follows:

See it in the following video:

https://github.com/kamiyaa/joshuto/assets/49983642/e33f197c-74d9-4559-8663-c8972e54bfa3

Jacky-Lzx commented 1 year ago

I don't know if you like it. Maybe I'm the only one using it everyday. I'd like to make it as a plugin in the feature.

If you like it, please give me some comments about my codes and I'll adjust them. I'm new to rust. And I'll add documents before merging.

tracy0880550287 commented 1 year ago

It's inspiring to see such high-quality open-source projects.

Jacky-Lzx commented 1 year ago

Updated the document.

DLFW commented 1 year ago

Hi! Just some thoughts from my side:

IMHO, this is a pretty specific feature which would be more suited for a plugin or an external script. Joshuto has no plugin concept, but in context of #241, I proposed that we can “chain” commands for key-chords and that we can provide the output of the last spawn command as variables the following commands. If I understood this feature right, it should be doable with minimal external scripting then.

The keymap might have stuff like this then:

keymap = [
  {
    keys = [ "f ", "z", "a" ],    # fuzzy add
      command = [
        "shell add_current_dir_to_marks.sh {dir}",     # {dir} gets substituted by the current directory of the current tab
      ]
  },
  {
    keys = [ "f", "z", "c" ],    # fuzzy change
      command = [
        "shell fuzzy-pick-from-marks.sh",
        "cd {stdout}"      # {stdout} gets substituted with the stdout of the last `shell` command
      ]
  },
]

The only difference would be that one has to ask for the “mark name” from the script instead of giving it as parameter in Joshuto's command line.

What do you think?

Jacky-Lzx commented 1 year ago

Oh yes. Your solution makes more sense to me as well. I might think about it when I have spare time.