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

Feature discussion #13

Closed
LFDM opened this issue Feb 15, 2014 · 2 comments
Closed

Feature discussion #13

LFDM opened this issue Feb 15, 2014 · 2 comments

Comments

@LFDM
Copy link
Contributor

LFDM commented Feb 15, 2014

I recently started to build a little plugin that is basically a wrapper around your awesome submode functionality. While working on it, I made a couple of observations, that probably could be implemented as additional features of your plugin:

  • Temporarily go to insert mode

This has been talked about in #1 already (btw, hi again @suy) and is relatively easy to implement. I'd say this makes only sense when you invoke it from a normal mode submode anyway, so I didn't try it for any other modes. I implemented a submode#temporary_insert_mode function, meant to be the rhs of a mapping as in submode#map('submode', 'n, '', 'i', ':call submode#temporary_insert_mode()<cr>'
The function leaves the current submode, enters insert mode and defines an augroup that holds an aucmd triggered by the InsertLeave event which reenters the submode that has just been left. This reenter function clears the aforementioned augroup again, so that we aren't left with any deadweight afterwards

  • Quickly reenter the last submode

My plugin resolves around the idea of having a submode <prefix> key which allows to enter several different submodes with one additional key.

The temporary insert mode didn't satisfy me, becaue sometimes jumping around in a submode left me close to where I wanted to go but not precisely (the use case is equivalent to what @suy described in #1, jumping around with [c for example). So it would be great to be able to leave the submode regularily, but enter it faster afterwards - I had in mind to be able to reenter the last submode with <prefix><prefix>. A reference to the last submode would be all that is needed for it and implementing this would also clean up any code needed to build a temporary insert mode.

  • Distinct setup and teardown functions

To build really powerful submodes it would be nice to be able to register setup and teardown functions that get called on_entering and on_leaving. I know that especially the setup part can be achieved with a workaround (defining a rhs command in the enter_with function), but that's a little hacky, as I am pretty sure you didn't intend this feature to work this way. I assume it would be enough to implement two dictionaries where the submode's name is the key and the value is an array of funcrefs to be called in the respective parts.
Possible use cases would be to activate/deactivate different highlightings or opening/closing a split window that holds additional information you could use during your submode's activity and many more.

I can workaround most of these things in my plugin, however it would be much cleaner if such things would be directly build inside of vim-submode - and other's could benefit from it too.

Would love to hear your opinion on this!

@kana
Copy link
Owner

kana commented Feb 15, 2014

Thank you for the feedback. But, would you mind creating an issue for each topic? It's hard for others (including you and me in the future) to know what topics were already discussed and to grasp the progress of proposed features from the list of issues.

@LFDM
Copy link
Contributor Author

LFDM commented Feb 15, 2014

Sure, no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants