Vim mode 'hints'


#1

I have this idea that people would like to learn vim mode, and that if they did, they would find that it made them more productive. This idea comes from me wanting to learn vim mode, and hoping it will make me more productive.

But when I sit down to use vim/vim mode, I find myself having to look up commands and then basically spending all my time trying to find the best way to do something that would take me all of two seconds in nano/non-vim mode. This gets boring and unproductive fast, and so I mostly just finish up by spending all my time in insert mode and pretending I’m in nano.

So here’s my idea for a package I have no idea how to create, and even if I did I wouldn’t be able to:

###Whenever an operation(*) is done, a tiny panel at the bottom should show the commands that would perform that operation fastest(**).

So if my cursor is at the beginning of a line, and I mark that line with cmd-L or just with my mouse, and I press backspace, the little panel would say something like vim mode: dd or If you were smarter, you would know that that could be done by just pressing "dd", you idiot!

Is this even possible?

(*) operation: everything which doesn’t involve just typing. There would be no point in a hint tellling you that if you wanted to type that word in vim mode, you would just go “i” followed by that text. Also, there should be some sort of timeout. Say 3 seconds between operations.
(**) Not strictly necessary, but 4dd is faster than ddddd, so it would be nice to have some sort of “compression”.

Anyway, hopefully some very bright people with a heart full of love for visual mode


#2

I think this would be a great idea for a package. I would definitely give it a try. I suspect it would be pretty complex to implement but there are some really smart people out there :grinning:


#3

Thanks.

I think the key is avoiding having the suggestions be rules-based. If the package is just a huge if-tree it will never work. There has to be some sort of algorithm based on the diffs between the document (element). So basically the package has to reverse engineer VIM… Which is hard… I assume. I have never looked at VIM’s source.


#4

It is not VIM but spacemac have a bottom pannel to remind people of contextual command.
The user dvcrn ported this to atom.


#5

That’s more of a cheatsheet. I’m thinking more of a specific response to commands.

But yeah, same general thing.


#6

Interesting idea. I can tell you that Vim-mode, IMHO, is fantastic and truly does help you to be more productive with code. This may be taboo for the Atom discussion but I learned the very basics from vimtutor which is a CLI tutor to learn vim. Then after a while you just know there has to be better ways of handling things so you try. I find your idea very interesting and I hope someone better than me knows a way to do it because I haven’t an idea how this would be implemented. The problem I see is that vim doesn’t really know what you are trying to do. It would assume your code is fine and wouldn’t know that you are wanting to get rid of 4 lines.

(Also, when you really want to test your skills, check out vimgolf.)


#7

Vimgolf actually feels exactly like what I’m thinking about.
Except the “challenges” is whatever you’re working on. In fact, there should be a function which undoes the operation you just commited, and let you try to do it vim-style like the retry command in vimgolf.


#8

I think I understand what you’re looking for. Get the job done then have some implementation that specifies a better way/the least amount of keystrokes to do the same thing? The thing with Vim Golf is that those key stroke values are from other users with specified tasks. I like the idea of a Vim training system (since I fancy myself a vim-mode fiend) so I will continue to look around and will post if I find anything.


#9

Yes indeed.
As I said, the problem is the “engine” that goes through the diff between the file before and after the operation and tells you what you should have done.

And of course, this is exactly what vimgolf makes us become, which is a fun little paradox. Or something. Analogy? Something…