lf icon indicating copy to clipboard operation
lf copied to clipboard

[FR] make bookmark accept more than one char

Open superiums opened this issue 1 year ago • 4 comments

one char is convienent, but not meaningfull and limited to only 26 chars. could you allow more chars to mark a path ?

superiums avatar Dec 14 '23 03:12 superiums

Marks are better suited for temporary bookmarks. If you have a location that you need to visit often, why not create a mapping for it? For example gh is provided by default for going to the home directory.

With this in mind, do you have a use case where you would need to have multiple character bookmarks? I'm sort of uninclined to introducing this kind of complexity, or diverging from how Vim behaves.

joelim-work avatar Dec 14 '23 07:12 joelim-work

key map

creating a key mapping for cd is a a method which was fixed via the config, so i use it

  • as 'system dir jump', because these dirs always exist.
  • and it's good for share to others, because every pc has these dirs.

this is my config

map g<space> push :cd<space>
map gr cd /
map go cd /opt
map gu cd /usr
map gm cd /mnt
map gp cd /tmp
map gE cd /etc
map gv cd /var
map gs cd /dev/shm
map gc cd ~/.config
map gd cd ~/Documents
map gl cd ~/Downloads
map g. cd ~/.config/lf
map gi &lf -remote "send $id cd /run/media/$USER"
map ga cd /usr/share/applications
map ge bottom

bookmark

it's flexable, changable, so i use it as personal data dir jump, because these dirs not always exists, and i need to change it more offen. also it's not suit for share to others, because they don't have these dirs. if i config it into config keybinding, they always found errors. e.g. my docs for tech, my docs for node, even one workspace for some project, my audios, etc.

so still , i think bookmark is more suit for these situations.

superiums avatar Dec 15 '23 05:12 superiums

Thank you for explaining your use case. I will in turn explain the reasons for what I said earlier:

  1. Currently lf is designed to just read the next key pressed and use that as the mark label. While it's possible to change the design, there has to be a justification to do so, for instance if many users request it and if there are no alternative solutions available.
  2. If the user types a string as a mark label instead of a single letter, then there has to be some way to submit the final string (e.g. by pressing <enter>). This means that now there will be a breaking UI change - if the user wants to create a mark x, they will now have to type x<enter> instead of just x. It would be possible to toggle the behavior by introducing an option, but again this leads back to point 1 (does lf need to have two systems for naming bookmarks?).

To reiterate, nothing about what you have suggested is impossible, it is more about whether it is worth doing so. Every feature that gets added in means more maintenance burden for contributors, and also more learning effort for new users. I am happy to leave this issue open if other people want to add to the discussion.

Some other points I would like to make:

  • I don't think sharing your config with others is a concern just because it might contain directories that don't exist for them. It is generally a bad idea to blindly use someone else's config file without understanding what it does.
  • If you need to maintain shortcuts for different systems, one idea might be to put all the common configuration in your main lfrc file, and use the source command to include a specific file.
  • You could also try implementing your own bookmark system outside of lf, and integrate fzf to select a directory and cd to it.

joelim-work avatar Dec 15 '23 06:12 joelim-work

thanks to explain the designing detail, i understand it's not so easy to go ahead without break sth.

so let's sit down and relax, and hear wheather more voice in the conmunity.

For my personal opion:

to implement a user bookmark is a good choice, except the popup menu, if there's a custom menu, which not break the ui thread, it will be very great!

another choice maybe leave the bookmark function as it is, and i'll use it as you described as 'tempoary use', and also, i could move all data config ($LF_DATA_HOME) to /tmp without manually have a soft link to /tmp, and also without the need to create blank files while lf start (). formally, i have to:

&[ -d "/tmp/lf" ] || mkdir /tmp/lf
&[ -f "/tmp/lf/files" ] || (touch /tmp/lf/files /tmp/lf/tags /tmp/lf/history && echo 'copy'>/tmp/lf/files)

as discussed in https://github.com/gokcehan/lf/issues/1512#event-11134133432

maybe leave the bookmark function as it is, and is there a possibility to add other bookmark function with another name (such as favors or whatever ) to accept more args ?

so for my opion, it will be great if:

  1. add support for custom popup menu, the best but also maybe a hard work.
  2. add favors function or sth like that. maybe more easy.

superiums avatar Dec 16 '23 05:12 superiums