-
Notifications
You must be signed in to change notification settings - Fork 65
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
Which strategy to open several (non-contiguous) files at once? #76
Comments
Do you really mean open several files at once? Why "batch" that? Just mash For deleting or renaming multiple non-contiguous buffers, I'd probably just select the entire dirvish buffer, Alternatively, the readme suggests
That obviously would need some mappings to make it nicer. I'd like to have that built-in but haven't thought about it much. I am wondering how others use the location list and whether anyone has a workflow for this already. |
Maybe “edit” would be more accurate, i.e., add to the buffer list. I've played a bit with your idea. This works nicely for me: :set errorformat=%f
:lexpr []
:.laddb
:lfdo edit It's sufficiently simple to define some mappings to streamline this workflow. One problem to make something like this into Dirvish is that the user may be using the location list for something else in the current window, so to make it robust one should probably use Using the argument list may be a more natural choice for this task, since its purpose is to work with paths. You may also have window-local arglists (with |
here is what i came up with for a similar idea (opening all files in qf list). it works around a few things and is a ~fast method. it actually visits each file and makes a buffer (though it is deleted/hidden in my script https://gist.github.com/bounceme/72aa91b4f2a473818d93384b7fff3bd4 i could imagine the filter concept to work with 'marking' files for actions |
As @lifepillar noted, doesn't the args list make the most sense? |
i guess someone could just |
e3c9a2c adds experimental support for the arglist.
Not totally happy with the mappings, I might swap arglist is pretty awkward, managing "global" vs "local", dealing with window inheritance, etc.... |
In my limited testing, it works beautifully! Just a minor remark: when a file is added to the arglist, it is highlighted (nice!). It seems, however, that only the file name is used, not the path. As a consequence, if you move into a different directory which contains a file with the same name, it is also highlighted. For instance, move into As for the mappings, why not use |
@lifepillar Thanks for the feedback.
This is a known issue. Including the path "head" would fix it, but I couldn't get it to work with the existing "conceal". I gave up since I wanted to see if anyone actually uses this feature first. Help welcome if anyone is a Vim syntax adept.
Visual mode is used to operate on multiple files, |
Have you considered using |
Yes, but matchadd() is a big pain in the ass for other reasons. It must be carefully managed when buffers are switched, etc. That was actually the first thing I tried.
|
Ok. I have just noted that you use |
Btw, how about using an invisible character, like a leading or trailing space, to distinguish marked paths? Then, matching them becomes a breeze and you do not need to dynamically update the syntax items. |
Thanks, that explains a few things.
That would break the dirvish concept of "the buffer is just a list of paths". And, paths may contain spaces... :/ |
Matching a full path is also a PITA. How about using signs ( The drawback is that modifying a Dirvish buffer might invalidate the (visual) correspondence between signs and paths. But that is easily solved by enforcing a simple rule: make the buffer unmodifiable when there are marked paths, and make the buffer modifiable again when the user clears all the signs. With some more work, one might also redraw the signs when the buffer changes. |
are dirvish buffers reused (so going to different folders just updates the buffer)? and i guess matching a full path is possible, i actually think i was trying stuff like this before but with |
I don't have the patience to deal with the signs API, I'd rather fix the syntax approach.
No. Each dirvish buffer maps one-to-one with a directory, just like any other file. |
This is addressed by
|
This commit addresses justinmk#76 and more specifically, this comment: justinmk#76 (comment). It likely needs some cleanup, but it basically works. A few notes: - Syntax rules for DirvishFullPath and DirvishArg must follow the other rules, otherwise they may be overriden (see :h syn-priority). - I am not sure whether \v has any effect in syntax rule, as the manual says that syntax patterns are always magic (:h syn-pattern). - map() has been replaced by a for loop: this way the code is cleaner (IMO) and the resulting syntax rules shorter. - I am not sure what the place for the condition testing for b:current_syntax is. That might need to be changed.
Define DirvishArgFullPath syntax group which "contains" DirvishPathHead, DirvishArg. ref #76 ref #76 (comment) close #123 - Also escape() the "@" symbol. - map() has been replaced by a for loop: the code is cleaner (IMO) and the resulting syntax rules shorter. - I am not sure what the place for the condition testing for b:current_syntax is. That might need to be changed.
The main reason (I believe) why netrw uses
mf
/me
to open several files at once is that it allows you to act on non-contiguous files (even in different directories if I remember well). This is something that from time to time I miss in Dirvish.What do you think is the best way to achieve that? Using the location list, arglist, or something else? Any plan to include a similar feature in Dirvish?
The text was updated successfully, but these errors were encountered: