microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.85k stars 29.5k forks source link

Vim Style Key binding #3600

Closed waderyan closed 7 years ago

waderyan commented 8 years ago

There are a few extensions in the marketplace for Vim, however Vim key bindings is still such a hot request in User Voice. Can VS Code / Vim users chime in on what is currently missing?

waderyan commented 8 years ago

ping @jasonyueyang

waderyan commented 8 years ago

Looking at this extension, there seems to be some solid work done and a good community around it. Commits going through today and a roadmap of work to be done.

kellyelton commented 8 years ago

The ones that exist are pretty poor at this point, not even usable. I use VIM and in Visual Studio VsVim, and I can't even use the extensions that exist for VsCode.

waderyan commented 8 years ago

@kellyelton have you opened bugs on their extension? They seem to be pretty responsive and have closed a number of issues.

NickClark commented 8 years ago

There are some severe limitations with that extension's implementation that make it difficult to operate. I have been fumbling around without Vim bindings to avoid the quirks for now, but I won't be able to stay with VSCode for long this way. As I recall, auto-closing of brackets, auto-complete, and snippet completion (including emmet), all fail in some way. Also, some essential motions are missing.

I'll try to get around to actually producing a complete list if someone else doesn't get to it first. For reference, Atom's current Vim plugin is spot on.

Beatusvir commented 8 years ago

I've used that one and this and sadly they are not even close to completion, some mention issues with whats available in the API in regards to keybindings. I use VsVim daily and its not even close.

Another issue IMO is there are at least 3 implementations, would be much better if it becomes one so everyone can work together. Maybe you guys can make this happen.

kellyelton commented 8 years ago

Well I don't even use VsCode, this one is kind of a blocker for me. Also, it's just not far enough along to address any work that I currently do either. So no, I haven't opened any tickets, I figured I'd just throw in my two cents that what exists is not even good enough to install.

This is actually an issue for lots of editors I've tried recently. The only good vim experience outside of vim is VsVim.

waderyan commented 8 years ago

@NickClark that list would be excellent. @Beatusvir good suggestion and I hope to help this happen.

NickClark commented 8 years ago

And in case you were not already aware :grimacing: , this is a critical issue for adoption. I'm the only one at my company that uses it right now, others opt for Atom based purely on the Vim support.

paralin commented 8 years ago

I don't use VSCode either (yet) as it has no benefits to me over my current Vim setup. The only thing I am very interested in using it with is reliable cross-platform C# and ASP.Net development. The current C# integration with Vim sucks.

To everyone here using Atom - I wonder what features it has that rival the "real" vim with an appropriate set of plugins?

Beatusvir commented 8 years ago

@paralin I don't use atom but comapiring to VsCode, is for sure ease of configuration, Ctrl-P install x-addon and I'm done. We all know for vim after downloading (using a manager or not) is usually followed by some configuration. For now I'm using WebStorm (@home) with its Vim plugin which works just fine although you get prone to spam scape a couple more times than whats healthy (it has some issues with menus and vim insert mode).

paralin commented 8 years ago

@Beatusvir It might be better to try to go the other direction and develop a plugin manager for Vim that doesn't require the long configuration phase you mention.

http://github.com/paralin/PersonalJanus

There's one manager I use called Janus that's very nice, it doesn't use a long list of plugins to install things but rather opts to just use git submodules. I think it could be cool to develop a CLI tool to pick what features you want, and also make it portable via git (as I've done).

Either way this seems a bit out of scope for this repository. But I would like to see proper Vim support in VsCode that doesn't rely on a gimped plugin API.

andradei commented 8 years ago

Like others said before, the current Vim plugins for VSCode aren't usable yet, though they are great projects. VSCodeVim/Vim is particularly interesting because it's very active and the contributors worked on Vim plugins for Sublime and other editors.

I guess one thing that would be great is for VSCode to provide more APIs that could facilitate those projects develop a plugin with better Vim keybinding feel and behavior.

The alternative would be to bake in Vim keybindings as a built-in option into VSCode.

mpseidel commented 8 years ago

@waderyan awesome that you guys are actively looking into this - I am pretty happy with vim-support in VsVim, WebStorm and Atom and I would love to give vscode another look as soon as the vim-story is decent. Maybe @jaredpar could give some hints on what to look out for.

mswift42 commented 8 years ago

Missing essentials:

Nice to have:

For Editors with good VIM support look at Emacs with Evil or IntelliJ's IdeaVim.

mpseidel commented 8 years ago

+1 for

support for combining commands (ci[, cW, ggVG, ...) visual commands

luolong commented 8 years ago

Maybe if a plugin would take advantage of the Neovim api to bring in full power of Vim instead of trying to merely emulate vim key bindings. It could be possibly game changing, allowing to tap full potential of vim ecosystem and configuration.

giggio commented 8 years ago

None of the plugins yet support the "dot" . command, which repeats the last action. That is really important. VsVim is excelent, it works as expected. That should be the goal.

mpseidel commented 8 years ago

yeah . and ; are important to me too

steinso commented 8 years ago

This is great news! This is the only feature stopping me from switching to VSCode. For me a critical feature is the ability to remap the ESC key (exit input mode). It would also be great if macros were considered at this stage, few implementations of vim mode in other editors support this due to the limited API accessible, and looking into it now could make it possible in VSCode, together with . and ;

pinoyyid commented 8 years ago

I echo the above comments. A single, high fidelity vim mode is key to adoption. I've briefly tried the available plugins, but they are both too far short of usable for me to put any time into them, so back to Atom for now.

Specificaly I rely on full mode support (https://en.wikibooks.org/wiki/Learning_the_vi_Editor/Vim/Modes) including ex-mode, so imho, vim support is more than just a bunch of key bindings.

ichpuchtli commented 8 years ago

pinging @74th

edthedev commented 8 years ago

+1 for VsVim as the initial goal.

I use Visual Studio with VsVim full time and am very satisfied.

I use the various numbered repeat commands, yank and paste buffers, s/find/replace, dot (repeat last whatever), and q record/replay macros. Also J to merge lines, and the various keys that jump to positions within the current line or file.

I would like to start writing C# apps on my personal Macbook Pro for deployment to Linux webservers, and VS Code looks like a great tool for it, but I really need something very close to the feature set in VsVim before I switch away from command line Vim.

lyyourc commented 8 years ago

:+1:

sharpoverride commented 8 years ago

+1 with @mswift42 on essentials. You should provide something that helps VsCode-Vim integrate better.

Atom has a good enough Vim implementation. For me IdeaVim and VsVim work fine, so the feature sets that they support should be what VsCode offers as well.

nicolaiarocci commented 8 years ago

I would look at VsVim (Vim extension for Visual Studio) as an ideal initial goal.

74th commented 8 years ago

I'm making this plugin and use VSCode with it everyday.

https://github.com/74th/vscode-vim/

It supports numeric arguments and visual mode. I like VsVim too. But I think there is no need for command line mode, like VsVim.

dbeecham commented 8 years ago

I agree with mswift42, but I would like to add:

The ability to bind keys in a fairly flexible manner is (in my opinion) critical for usable vim support. Many users designate a key called leader, often ','-key, and then bind gt or a to whatever.

I' ve personally grown attached to ,gt for "go to (c)tag at cursor" (go to definition) and ,gf for "go to file whose name is at cursor".

aioutecism commented 8 years ago

I'm the maintainer of https://github.com/aioutecism/amVim-for-VSCode. The biggest problem I and other vim plugin developers are encountering is support for custom keybinding context (as I asked here: #1432). All the other vim behavior can be implement pretty simple and quick with the framework we Vim plugin developers built. I'm seeing support VIM extension authors on roadmap https://github.com/Microsoft/vscode/wiki/Roadmap . And I hope the keybinding support for plugins would be added by the end of March.

jon49 commented 8 years ago

Something like this is the holy grail of vim binding:

https://github.com/carlosdcastillo/vim-mode

It's pretty buggy though. But that would be a nice direction. Let neovim do all the work but still have intellisense, etc with the editor.

waderyan commented 8 years ago

This feedback is excellent. Vim support is gaining momentum on the feature request list and with some of the essentials near completion (accessibility, localization), we can spend more time here. We're looking at rolling out a holistic strategy to improve Vim support and involve the community. Keep the feedback coming!

@aioutecism I'll talk to the team to get #1432 higher on the priority list. Specific requests like this are excellent to feed into the backlog.

waderyan commented 8 years ago

@aioutecism there other other issues labeled vim in our backlog. What ones of these are critical to your development?

@jpoon, @guillermooo, @74th, @mattn you are also developing a vim extension. Can you address the question above?

What other issues are you facing with working with the current extension api?

aioutecism commented 8 years ago

Thank you very much @waderyan. I'm looking forward to the new API.

Another problem I'm encountering is the need to deal with different keyboard layout. I opened an issue #3671.

In my extension's case, other issues labeled vim are not critical or can be solved perfectly if #1432 is done.

jpoon commented 8 years ago

Wow, this is awesome -- validates our work over at https://github.com/VSCodeVim/Vim :fireworks:

VsVim for Visual Studio as an initial goal

That is a lofty initial goal -- I view it more as the gold standard. I met up with @jaredpar (awesome dude btw!) when I had just started the VsCodeVim project, and there's definitely a lot of work involved with getting any of these VSCode VIM extensions to that state. It's unfortunate that there's no way to port all the good work VsVim or any of these other IDE extensions have done.

As for VIM on VSCode, addressing these issues would be a start: https://github.com/Microsoft/vscode/labels/VIM. In developing the VsCodeVim extension, there's been a couple of other major difficulties:

@waderyan: are you on the VSCode team? Looks like you are in Redmond, I'd be happy to meet in person to discuss.

jaredpar commented 8 years ago

I really do appreciate all the good will VsVim has gotten on this thread. It's what makes OSS projects worth doing. :smile:

VsVim for Visual Studio as an initial goal

But I think that is probably unrealistic for an initial goal. VsVim's been in active development for about five years now. Can't expect a new vim emulator to get to that level for an initial release.

Instead I'd focus on hitting the core scenarios for an initial release. For example: motions, key mapping, ., and a few normal mode commands. Once that is in place it's easier to branch out and do other features in parallel because the basic pipeline has been established.

waderyan commented 8 years ago

@jpoon yes I am and that would be great. I'll reach out when I'm back in town to set something up.

jpoon commented 8 years ago

Since this thread is generating a lot of traffic -- here's another VIM related issue I just filed: https://github.com/Microsoft/vscode/issues/3695

74th commented 8 years ago

My plugin has belong poricy.

I'm offering non-vim users to use VSCode. My goal is not VsVim. VsVim lesses stresses vim users has, but I cannot answer which keys you press to format code and replase strings with regular expressions in VisualStudio.

An additional function of plugin system I want is, _a switch of contribution point_. Contribution points of my plugin is "when": "editorHasSelection" to divide Insert mode and normal mode. I do not want to catch keys in insert mode. On the other hand, VSCodeVim/Vim calls editor.action.triggerSuggest in anytime. Users having mode concept are not only vim users, they want it too.

giggio commented 8 years ago

For me, you could completely replace VsCode default keybings. Or offer an options file that I could edit. Not having :w or u sucks. You are not addressing VsCode users with a Vim pluggin, you are addressing Vim users that are interested in VsCode. I simply will not use VsCode until it has a decent Vim plugin.

Also, I love that VsVim is able to load .vimrc from my profile. That would be an extended goal. I love that my jj mapping to ESC from .vimrc are automatically picked up by VsVim, for example.

nicolaiarocci commented 8 years ago

Also, I love that VsVim is able to load .vimrc from my profile. That would be an extended goal. I love that my jj mapping to ESC from .vimrc are automatically picked up by VsVim, for example.

This.

alexdima commented 8 years ago

For those interested, I think the API on the vscode side is good enough now (on master) to support a good vim emulation extension.

Please see https://github.com/alexandrudima/vscode-vim if you are authoring a vim emulation extension for a sample using the new API.

Beatusvir commented 8 years ago

Gonna check it, but from the readme, the basic commands are all implemented in every extension because as you said, it's supported with the api and easily implemented.

However, for us long time vim users we've created a lot of customization to our vimrc (first issue, read the vimrc config) which include a lot of key mappings (almost nobody use Esc key, instead jj or Caps or whatever), leader key (usually ,) and that's when the trouble begin. Mixing commands is another problem if I recall.

codelogicws commented 8 years ago

There is a hefty chunk of VIM functionality here good job :). Can't wait to use this when its all fleshed out.

segmentationfaulter commented 8 years ago

I started using vscode because of the extension mentioned by OP, upon finding that extension being very poor with plenty of bugs, I had to switch back to vim.

TrailHacker commented 8 years ago

I tried installing a vim plugin for vs code and found it unusable as well; simple bindings didn't work (ie. yyp). I understand it's a work in progress. Therefore, I'd like to provide some feedback on what I'd expect out of a vim plugin. :)

Here are the important key bindings for me:

Everything I've listed above are very important bindings for me, and I'm assuming most Vim users. I personally use them everyday. They are considered "standard vim functions" in my eyes. I develop in MS Windows 90% of the time and use ViEmu in Visual Studio 2015 and SQL Server 2014 all day. it's an absolutely stellar product, and I can't live without it! I did use VsVim for a while and it was great as well. If I remember correctly, it lacked in command line mode for me and had some other small issues with recording macros. I'm sure many of my ailments have since been fixed. Regardless, I currently use ViEmu and have very few complaints.

The biggest problem I've had with all Vim plugins is the way vim bindings work against standard windows shortcuts. For example, <c-v> is typically paste, but in vim it's for visual block mode. There are other bindings as well that I always butt heads with like <c-o> for traversing jump lists and not "File Open", <c-n> for word completion and not "File New", <c-y> for scrolling.. It's a tricky puzzle for sure.

Thanks for creating this case and requesting feedback from all the Vim users. I sure hope to see a solid vim solution for VSCode. In the meantime, I'll continue to use Visual Studio 2015 with ViEmu.

aioutecism commented 8 years ago

For those interested, I think the API on the vscode side is good enough now (on master) to support a good vim emulation extension.

Please see https://github.com/alexandrudima/vscode-vim if you are authoring a vim emulation extension for a sample using the new API.

Just updated my vim extension to use these new APIs. Works amazing!!! https://github.com/aioutecism/amVim-for-VSCode The new API is only available from VSCode 0.10.12. If anyone is interested, download the insider build and install amVim to give it a try.

alexdima commented 8 years ago

@aioutecism Awesome!!!

Beatusvir commented 8 years ago

@aioutecism please don't play with my feelings gonna try it now

aioutecism commented 8 years ago

@Beatusvir It doesn't support custom keybindings now. So you might be a little disappointed. The most wanted features are issued here. I'm trying my best to make them happen as fast as possible. And I really need your help!

elgrego commented 8 years ago

To add to what others have said. I really miss :reg to view the registers. Also, though not part of the core Vim I think surround with should be core when there is so much html now a days. but perhaps a pluginsystem that would allow vundle or patogen directly? dreaming...