-
Notifications
You must be signed in to change notification settings - Fork 60
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
Open all sections in indirect buffers #48
Comments
I really like this idea. I don't think edit-indirect has the ability to save a buffer without closing it, but modifying it to do so should be pretty easy. Combined with something like golden-ratio-mode, it could make editing vue files a lot more ergonomic for people who don't care about full-buffer continuity (I'm thinking about grepping for classes or something whlie in the templates). Perhaps narrowing the overarching vue-mode buffer and using it as a navigation TUI or overview of sorts would also be helpful in this case. I'll have to investigate that. I'll definitely look into it soon; probably some time this weekend. Having that feature would probably make my work more productive as well. |
Do these changes actually mean, that we could start using |
This particular feature, which would be an extension of what has already been implemented in #47 , basically lets you create a buffer from a .vue section. So, since it's its own entirely separate buffer, you can set whatever mode you like, including js2-mode, just as you could with any other buffer, and "saving" any changes you make are automatically reflected in the overall .vue file's corresponding section. mmm-mode is mainly (AFAIK) for fontifying (syntax highlighting) a region of a buffer with the fontification rules of another mode. In my experience when I have tried using js2-mode for this purpose it doesn't work very well. I think js2-mode is much more complex and does require its own buffer in order to be fully operational. This is something I found when trying to use js2-mode for highlighting regions within a markdown buffer, so I reverted to using js-mode. So the best of both worlds, @AdamNiederer , would be to allow the user to specify the mode to use to highlight (fontify) sections in the .vue file (e.g. plain This is also something that concerns markdown-mode, so look at this issue for more information. |
mmm-mode provides a little more than just fontification; it also gives you indentation and lets you use the keybindings of the underlying mode, which I wouldn't like to give up in the overview. I've been editing vue files with the "overview mode" for a while, and it's definitely much better than what only fontification would offer. markdown-mode and org-mode don't let you use syntactic indentation and the submode's keybindings without opening an indirect buffer. If/when I do implement this method of editing vue files, I'll look into the costs/benefits of disabling mmm-mode in the overview buffer while this is active. |
Fair enough, that's good to know. Even so, I think it would be very very useful, arguably necessary, to be able to specify one mode to use in the overview mode and another to use in the indirect buffer. I haven't tried js2-mode in the overview mode, but it seems like @mimischi is hinting that it doesn't work very well, which is why I would (and do, in markdown-mode) use js-mode in the overview mode, but I definitely would want to use js2-mode in the indirect buffer. Maybe if you allowed an optional |
I definitely think having a seperate mode mapping for indirect modes is a good idea; we could also use |
Oh yeah, with respect to js2-mode I was speaking for me personally. |
Following up with #47, it might be cool if there were a command which would automatically open each and every section in its own indirect buffer + window, by-default laid out vertically in the order in which they appear in the .vue file. So it would behave something like this:
This would more or less resemble the way a .vue file itself looks, but with the added benefit of using a more appropriate major mode for each.
Some unanswered questions and possible difficulties:
save-buffer
to commit the changes, without closing the buffer. It seems like closing the buffer and window is done inedit-indirect--clean-up
and seems to be mostly superficial, meaning if we omit that call everything might work fine, but it'll require some more investigating.So depending on those two questions, it may require some changes to edit-indirect. The functionality behind edit-indirect appears to be pretty simple, from a cursory skim. It seems like the bulk of the code is mainly for making it generalized, i.e. to work in a variety of situations. It may be possible and even desirable to extract the core functionality in order to customize it to vue-mode's liking, if the way it exists now is not flexible to vue-mode's needs, or perhaps it can be worked out with edit-indirect to adapt any changes required.
The text was updated successfully, but these errors were encountered: