joshuto
joshuto copied to clipboard
Add a new feature: fzf bookmarks
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:
-
fzf_add_mark [markname]
creates a new line in file$HOME/.fzf-marks
, with the formatmarkname : current_directory
. -
fzf_cd_mark
opens afzf
selection window to select a bookmark, and thencd
to that directory in joshuto.
See it in the following video:
https://github.com/kamiyaa/joshuto/assets/49983642/e33f197c-74d9-4559-8663-c8972e54bfa3
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.
It's inspiring to see such high-quality open-source projects.
Updated the document.
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?
Oh yes. Your solution makes more sense to me as well. I might think about it when I have spare time.