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

location bookmarks #30

Open
EastAPOLO opened this issue Nov 22, 2019 · 11 comments
Open

location bookmarks #30

EastAPOLO opened this issue Nov 22, 2019 · 11 comments
Assignees
Labels
dont care enough not a bad idea but dont care enough to implement it feature to be implemented feature minor something simple or unimportant

Comments

@EastAPOLO
Copy link

EastAPOLO commented Nov 22, 2019

I think it would be great if fuf had bookmarks so you can go to any directory specified in a bookmarks file assuming it exists. The user should be responsible to create this instead of it being automatically generated, unless you think it should be otherwise? I already have it working but its hardcoded, I think changing it to read a file with absolute paths makes sense. A goto should start with 'g' so you could have "gd" with the absolute path after that as goto documents for instance. I'm not planning on adding any fancy file edit operations as you state in the README, this isn't a goal of fuf, but I'm curious about your opinions on this feature.

@Ckath Ckath changed the title [feature] Bookmarks location bookmarks Nov 22, 2019
@Ckath Ckath added feature to be implemented feature minor something simple or unimportant labels Nov 22, 2019
@Ckath
Copy link
Owner

Ckath commented Nov 22, 2019

I'd be fine with there being bookmarks but under a few conditions, as I dont really use these myself:

  • read any bookmarks from a file (bookmarks in ~/.config/fuf maybe?) on startup
  • suggest bookmarks in the 'goto' prompt of g
  • do not populate anything on missing or empty bookmarks file

really only thing that has to be worked out, unless you have better ideas against what I just listed, is the format of the file and representation of the list containing this info. personally I'd go with something simple like this:

home /home/cat
wallpapers /home/cat/img/wp

where home and wallpapers would be the names shown in the 'goto' prompt and the part after it being the location fuf would chdir to on select. as for how these would be represented for fuf, nothing super amazing comes to mind, possible a 2d array with names and location entries, or a simple structure containing these in an array.

exact implementation aside the core point is just reading in some bookmark file during init() and referring to the obtained information how to populate the 'goto' prompt and where to go on select.

@EastAPOLO
Copy link
Author

EastAPOLO commented Nov 23, 2019

I was thinking of making the format of the file something like this:

gd /home/eastapolo/documents
gp /home/eastapolo/pictures

However, I think what you suggested makes more sense because I was just gonna put a letter in the goto prompt, for instance 'd' for documents but that is really vague. I'll work on using custom labels instead in the goto prompt. Maybe this format is better:

gd docs /home/eastapolo/documents

I'm experimenting with ideas atm, but another option is just putting the folder name in the goto prompt if I were to use my first format that doesn't have a label. I think I'll end up going with what you mentioned unless you have any other suggestions.

@Ckath
Copy link
Owner

Ckath commented Nov 23, 2019

gd /home/eastapolo/documents
gp /home/eastapolo/pictures

ah yeah the keybinds themselves too, forgot about that part. would make sense with just that format as well, aside from lack of easily readable thing to put in prompt (paths can get quite long and the prompt only goes horizontally)

gd docs /home/eastapolo/documents

this makes the most sense imo, though for ease of implementation it might be more straight forward like this:

d docs /home/eastapolo/documents

as a side note, the ch_prompt thats used is only made for single char keybinds anyways, defining them as gd might make it unclear only one char is ever going to work with the curent codebase.

if you'd read these into a struct with a char key, char[256] name and char[PATH_MAX] path, or something along those lines. and then construct an aray of all these bookmark items during init, that'd work out decently I think.

@Ckath
Copy link
Owner

Ckath commented Nov 23, 2019

sticking with the keybind label path format of the bookmark file would also allow you to easily stick with the existing ch_prompt format of the key and short explanation, which could be the key and label, as illustrated in this professional mockup
image

@N-R-K
Copy link

N-R-K commented Jul 29, 2022

Here's a better suggestion, don't read any files or config. Just have a "bookmark" directory ( can be configured via env var or whatever). And inside the bookmark directory, "bookmarks" will be added via symlinks.

And then pressing b or something would open up the bookmark dir and you can follow any of the symlinks in there. This is a much superior system than rolling some incompatible config file because this way bookmarks can be synced across applications quite easily.

@Ckath
Copy link
Owner

Ckath commented Jul 29, 2022

that'd work, and would just be a simple listing all links in that dir if configured and showing them there. then changing to those on select.
where would a 'sane' ish default be for this if not set? ~/.bookmarks or something like ~/.config/fuf/bookmarks?

@N-R-K
Copy link

N-R-K commented Jul 29, 2022

Probably ~/.config/fuf/bookmarks, ~/.bookmarks might be used by something else.

Adding bookmarks should also be very simple, B or something would just create a symlink of what's currently hovered under $bookmark_dir/$name.

would just be a simple listing all links in that dir if configured and showing them there. then changing to those on select

Don't think even that's needed. Just changing the cwd (of fuf) to $bookmark_dir should also work.

@N-R-K
Copy link

N-R-K commented Jul 29, 2022

Btw nnn uses a similar bookmark system (was suggested by me) if you want to take a look on how it'd work in practice.

@Ckath
Copy link
Owner

Ckath commented Jul 29, 2022

Don't think even that's needed. Just changing the cwd (of fuf) to $bookmark_dir should also work.

I guess, but I'd personally prefer it into the goto menu as its more vim.. ish. or maybe do it through m and '. more than just going to the bookmarks dir at any rate. nnn seems to use its completion capabilities on prompts, which I cannot be dicked to add as I only ever open fuf where I need to be anyway.

going of what I feel like at the moment it'd probably be implemented as follows:

  • store symlinks of these 'bookmarks' in ~/.config/fuf/marks
  • created by m plus any other key, similar to vim. eg. m+a
  • stored as a symlink named key. eg ~/.config/fuf/marks/a from last time
  • ' would list all these in a similar way to the shoddy picture on the goto: prompt
  • pressing any of the keys would goto the mark location in question
  • add special non existant mark - to goto previous location before going to mark now that absolute path changing is a thing

@Ckath
Copy link
Owner

Ckath commented Jul 29, 2022

almost started working on this but then realized once again this doesnt overlap with any of my personal usecases. all I do is type fuf /where/I/want/to/be and browser around a bit. this coupled with history in my shell solves all my 'bookmark' needs.

sure its an alright feature but I just dont care enough personally to be motivated to implement this as I never keep it open. I rather use it as a quick tool similar to less or tree or something while doing all main things in my shell

@Ckath Ckath added the dont care enough not a bad idea but dont care enough to implement it label Jul 29, 2022
@EastAPOLO
Copy link
Author

I probably won't implement this because I've moved on to something else, but the suggestion similar to nnn sounds good to me and better than what I was thinking of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dont care enough not a bad idea but dont care enough to implement it feature to be implemented feature minor something simple or unimportant
Projects
None yet
Development

No branches or pull requests

3 participants