gelguy / Cmd2.vim

cmdline-mode enhancement for Vim
MIT License
94 stars 4 forks source link

Not able to use it in a input function? #2

Closed blindFS closed 9 years ago

blindFS commented 9 years ago

For example, :echo input(":") will ask for input in command mode. This plugins doesn't seem to work in such situations. I have mapped <C-R> using your method: https://github.com/junegunn/vim-peekaboo/issues/23#issuecomment-84500667 , and I'd like to have this feature for inputs also.

gelguy commented 9 years ago

I'm afraid this is not possible as the input() prompt is not in command mode, but its own special submode. I may be wrong here, feel free to correct.

Cmd2 does not have access to this submode.

One possible fix is to create a Cmd2 mode which is activated when an input() function is called in command mode, but this is complicated.

If there is a specific situation you wish to call this in then it should be much simpler, i.e. when this function is called from a mapping, you can instead remap the mapping to the new Cmd2 mode. With more context of the problem I may be able to come up with an alternative solution.

blindFS commented 9 years ago

Is is possible to distinguish c-mode and this submode using tests? Or I may want to add a mapping to just 1 of these modes, but cmap would affect both.

gelguy commented 9 years ago

You can create the new Cmd2 submode such that it does not accept cmaps, or has its own special maps.

blindFS commented 9 years ago

OK, I'll take a look at it.

gelguy commented 9 years ago

The creation of submodes is not documented yet as I expect to be changing how it works, but if u briefly explain the problem I can come up with a quick skeleton solution.