You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Counts
Already mentioned in Adding counts? #11, but I haven't been able to solve this yet.
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!
The text was updated successfully, but these errors were encountered:
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.
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:
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 therhs
of a mapping as insubmode#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 anaucmd
triggered by theInsertLeave
event which reenters the submode that has just been left. This reenter function clears the aforementionedaugroup
again, so that we aren't left with any deadweight afterwardsMy 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.To build really powerful submodes it would be nice to be able to register setup and teardown functions that get called
on_entering
andon_leaving
. I know that especially the setup part can be achieved with a workaround (defining arhs
command in theenter_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 offuncrefs
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.
Already mentioned in Adding counts? #11, but I haven't been able to solve this yet.
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!
The text was updated successfully, but these errors were encountered: