-
Notifications
You must be signed in to change notification settings - Fork 329
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
Bookmarks for directories #76
Comments
Considering how unelegant a shell implementation would be (major UI flashes when spawning processes, unability to read only a single character from As for the cross compatibility with |
I've written a crude temporary implementation, while I wait for it being added as a feature. Feel free to use and modify. |
Alternatively if menu drawing command gets exposed, we could implement bookmars quite cleanly, but for full ranger-like implementation, we'd still need to hook into a builtin cd command. |
@mibli Thanks for the example. I haven't tried it but it looks like it assumes |
I have finally found an acceptable way to implement bookmarks in the code. Two commands have been added Marks file is read once at startup and written on quit. When multiple clients add their own marks, both should be added to the file. Feel free to report any issues regarding this behavior. Note that there is an unhandled case in which an existing mark is changed in one client and it quits before another client in which case the change would be lost. It is not very obvious how to handle this case, though this should not happen often. Closing this issue for now. |
This is a bit of a nit, but is there anyway to define marks in the |
@wpcarro I still mostly use the previous workaround for bookmarks, that is assigning keybindings with
If you want to use
And then you can use this key for your mappings:
You can also consider using a symbolic link for your marks file if you want to keep it in
Hope this helps. |
I added a simple searchable bookmark list in windows using the following scripts:
|
Hello, Is there a way or command to save marks as Thanks |
So this was first discussed in #62. Some of the things discussed there are duplicated here.
If bookmarks can be implemented properly as custom commands then there is not much to discuss here anyway. If we can come up with a brief/simple example and it implements a generally acceptable/expected behaviour we can add the sample to our example config file. If not, we can leave it here.
In general following are some of the thing which should be possible in bookmarks:
Currently we're using regular maps as bookmarks (e.g.
map gh cd ~
). This is good enough for some but not for others. So ideally, there should be a way to manage bookmarks dynamically rather than statically in the config file.As for example, I like ranger's implementation. Basically they use the concept of marks in vim as bookmarks (e.g.
m
for marking a directory, and'
for jumping to a mark). When jumping to a mark, they list all available bookmarks to the user to choose from, which is not possible in vim without calling:marks
explicitly.So I was thinking we could implement a similar behavior in lf using custom commands as follows. Bookmarked directories can be saved within a file similar to ranger (we can also be compatible so they can be shared). A
mark-save
command (e.g. possibly bound tom
key) can list all available bookmarks and ask the user for a key to save the current directory as a bookmark. Similarly anothermark-load
ormark-jump
command (e.g. possibly bound to'
key) displays available bookmarks and ask the user for a key.read
builtin inbash
allows reading a single character at a time without the enter key. It is a little tricky in posix shell but it is still possible (as in our code for the "press any key" implementation). Therefore, we can accomplish almost all point I have mentioned above.The text was updated successfully, but these errors were encountered: