t9md / atom-vim-mode-plus-ex-mode

Experiment to implement ex-mode for vim-mode-plus
https://atom.io/packages/vim-mode-plus-ex-mode
MIT License
30 stars 11 forks source link

Fast typing :w results in q command. #8

Closed 5argon closed 8 years ago

5argon commented 8 years ago

Since it utilize some kind of auto complete list of commands, when I quickly type :w and hit enter before w entry can come up, it always results in q command.

If your file wasn't saved yet the dialog will come up, but if you already save the file (I believe many have the habit of over-saving the file) then it instantly close the document.

t9md commented 8 years ago

Sorry, I understand your explanation. This is limitation of this package. Won't fix.

trusktr commented 8 years ago

This just happened to me.

@t9md Just because you won't work on it doesn't mean you should close the issue. You should leave issues like this open in case someone else wants to contribute a fix...

I really like Atom's officially recommended ex-mode a lot more, but vim-mode-plus is much better than Atom's vim-mode, so I think the best solution will be to contribute to this package.

t9md commented 8 years ago

Why not use core:save command its more accessible tha :w. As I wrote in README I don't have much motivation to vmp-ex-mode, so start your own ex-mode or make PR to ex-mode to support vim-mode-plus.

floorish commented 8 years ago

The ex-mode modal is a SelectListView which automatically selects the first item. For ex-mode this happens to be q, because the list is sorted alphabetically.

I personally prefer a default of w, so I disabled the sorting in the ex-mode source. Without sorting w will be the default selection, since it's defined first in the normalCommands array (/lib/commands.coffee)

If you want the same behaviour (I can imagine this shouldn't be the default, so I won't open a pull-request), remove .sort on lib/view.coffee:37

commands = _.keys(@commands[kind])
t9md commented 8 years ago

@floorish thanks for great information. I thought it's good idea and experimented it, while I was experimenting your idea I found another idea.

The root cause is delay to select item after typing, this delay is introduced by throttling populateList in original selectListView. So disabling this throttling for the very first user input solved original issue(I confirmed). But I also thought sorting command by alphabetically is not necessary(why I did?). So I disabled sorting optionally.

will release in a few minutes.

t9md commented 8 years ago

release as v0.5.0

floorish commented 8 years ago

Awesome, thanks for all the hard work @t9md! I enjoy working with vim-mode-plus + ex-mode every day :)