74th / vscode-vim

vim emulator for Visual Studio Code
MIT License
215 stars 25 forks source link

Remove key-to-action coupling. #5

Closed DennyScott closed 8 years ago

DennyScott commented 8 years ago

Extracted all references to "keys" for features, instead calling the keybindings.ts to find the appropriate action. This will hopefully allow us not tie specific keys to actions. With this extracted, I think a nice way to clean this up is to create a VimState. Right now we are using the VimStyle, but just using an enum and switch.

Further, I cleaned up a couple incorrect keybindings. All of the previous functionality still works. Granted my f and t keys don't currently work, and I'm unsure if they worked previously. I'm attempting to use atoms vim mode as a good guide. https://github.com/atom/vim-mode/blob/master/lib/vim-state.coffee

I'm looking at creating the state machine next, now that I got the flow of your application. The hope is that by making a central state machine, we can pass some of these actions to their own classes, which can interact with the machine. We'll see if the idea works. :P

I can also take a look at the f and t commands. Don't hesitate to break down some features in the issues, and allow me to take them on :).

74th commented 8 years ago

Thanks a lot. I will work for using Enum and switch.