Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim Style Key binding #3600

Closed
waderyan opened this issue Mar 1, 2016 · 108 comments
Closed

Vim Style Key binding #3600

waderyan opened this issue Mar 1, 2016 · 108 comments
Assignees
Labels
feature-request Request for new features or functionality VIM VIM issue

Comments

@waderyan
Copy link

waderyan commented Mar 1, 2016

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 waderyan added the feature-request Request for new features or functionality label Mar 1, 2016
@waderyan
Copy link
Author

waderyan commented Mar 1, 2016

ping @jasonyueyang

@waderyan
Copy link
Author

waderyan commented Mar 1, 2016

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
Copy link

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
Copy link
Author

waderyan commented Mar 1, 2016

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

@NickClark
Copy link

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
Copy link

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
Copy link

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
Copy link
Author

waderyan commented Mar 1, 2016

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

@NickClark
Copy link

And in case you were not already aware 😬 , 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
Copy link

paralin commented Mar 1, 2016

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
Copy link

@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
Copy link

paralin commented Mar 1, 2016

@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
Copy link

andradei commented Mar 1, 2016

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
Copy link

mpseidel commented Mar 1, 2016

@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
Copy link

mswift42 commented Mar 1, 2016

Missing essentials:

  • Numeric arguments (3dd, 2x, ...)
  • support for combining commands (ci[, cW, ggVG, ...)
  • visual commands
  • window interaction support, split windows, close windows, switch windows, ...

Nice to have:

  • Cursor customization: Give me the possibility to customize the form (block or line) and color of the cursor, e.g. for Normal Mode, I'd like to have a green Block cursor, in insert mode a red line cursor.
  • vim leader support.

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

@mpseidel
Copy link

mpseidel commented Mar 1, 2016

+1 for

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

@luolong
Copy link

luolong commented Mar 1, 2016

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
Copy link

giggio commented Mar 1, 2016

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
Copy link

mpseidel commented Mar 1, 2016

yeah . and ; are important to me too

@steinso
Copy link

steinso commented Mar 1, 2016

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
Copy link

pinoyyid commented Mar 2, 2016

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
Copy link

pinging @74th

@edthedev
Copy link

edthedev commented Mar 2, 2016

+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
Copy link

lyyourc commented Mar 2, 2016

👍

@sharpoverride
Copy link

+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
Copy link

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

@74th
Copy link

74th commented Mar 2, 2016

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
Copy link

dbeecham commented Mar 2, 2016

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
Copy link
Contributor

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.

@rebornix
Copy link
Member

@giggio and anyone might be interested: I happen to be a developer of both VS Code and VSCodeVim. Feel free to file feature requests or issues on vscodevim, let's see what we can do to make it better from both sides (Code and extension), together.

thanks @jaredpar you just made my day.

@monkoose
Copy link

monkoose commented Dec 7, 2016

In vscodevim i still miss surround-plugin for vim and possibility to control all sidebar tools properly with the homerow(or may be i miss something how to do it)(or atleast some plugin compareble to advanced create file in Atom so i can work without the mouse most of my time), and i_CTRL-W that deletes all tabs and a "word" on previous line. It needs just delete all tabs first.
Other than that it is already have a lot of features, even good ex mode. Thanks for your work guys.

@mswift42
Copy link

mswift42 commented Dec 7, 2016

I just tried vscodevim, but alas, no support for tags (which is marked as low priority).

For me this is unfortunately essential, not only to navigate through my code, but often Source Code is the best documentation.

@rebornix
Copy link
Member

rebornix commented Dec 7, 2016

@monkoose @mswift42 feel free to file issues and add reactions to existing one in https://github.com/VSCodeVim/Vim :) We do have a lot of passionate contributors there and they are willing to help, just lack of feedback sometimes :)

@johnfn
Copy link
Contributor

johnfn commented Dec 7, 2016

@mswift42, the reason that tags are low priority is because VSCode already has excellent support for tags. Try cmd-t or ctrl-shift-t. If that's not good enough, you should let us know what specifically is lacking.

@mswift42
Copy link

mswift42 commented Dec 7, 2016

@johnfn On my box pressing ctrl-shift-t does nothing. (This is using Linux). The working Key Combo here is F12, which is far far away from my Homerow. Also, how do I get back ? Under Vim, or Editors with good Vim Support, I'd use Ctrl+] to go to definition and Ctrl+O to get back where I was.

@monkoose
Copy link

monkoose commented Dec 7, 2016

@mswift42 You just need to learn more about how to rebind keys in vscode. And then just rebind showallsymbols command to a map that you want. Because by default vscodevim override ctrl-T behaviour.

@mswift42
Copy link

mswift42 commented Dec 7, 2016

@monkoose Thanks for that. Of course I'm not interested in showallsymbols, but in navigating quickly between methods / files.

@monkoose
Copy link

monkoose commented Dec 7, 2016

@mswift42 You can rebind Go To Definition command then. Its easy to do in vscode.
Add this to your keybindings.json

{ "key": "ctrl+]",                   "command": "editor.action.goToDeclaration",
                                     "when": "editorHasDefinitionProvider && editorTextFocus && vim.mode != 'Insert'"},

@hastebrot
Copy link

@monkoose Isn't Go To Definition in VsCodeVim already bound to the gd command?

@mswift42
Copy link

mswift42 commented Dec 7, 2016

@monkoose: And now we are nearly half way there. I press Ctrl+] and am transported to its Definition.
But how do I get back ?

@monkoose
Copy link

monkoose commented Dec 7, 2016

@hastebrot Yes, seems so forget about it. Thanks.

@mswift42 I do not use vscode so much(really miss surround plugin). I think the guys behind vscodevim still do not implement cursor jumps with CTRL-i and CTRL-o. Just checking it sometimes to see how far they go.

@hastebrot
Copy link

@mswift42 If we're still speaking about vim/VsCodeVim this should be ctrl+o (previous location) and ctrl+i (next location).

@monkoose
Copy link

monkoose commented Dec 7, 2016

@hastebrot Do not work for me.

@hastebrot
Copy link

I think the guys vehind vscodevim still do not implement cursor jumps with CTRL-i and CTRL-o

Tested it with vim.useCtrlKeys enabled. Indeed this is not implemeted.

@mswift42
Copy link

mswift42 commented Dec 7, 2016

That's what I was trying to say. To support jumping between tags, gotoDefinition has to save the current Cursor position, jump to the definition, and when Ctrl+O is invoked, going back to stored position.

@hastebrot
Copy link

hastebrot commented Dec 7, 2016

Seems VSCode doesn't support this history next/prev functionality. I find nothing in the keybindings.json.

Update: However there are Go > Back and Go > Forward menu entries.

The default (on my system) is:

{ "key": "ctrl+alt+-",            "command": "workbench.action.navigateBack" },
{ "key": "ctrl+shift+-",          "command": "workbench.action.navigateForward" },

A vim-like binding would be:

{ "key": "ctrl+o",         "command": "workbench.action.navigateBack" },
{ "key": "ctrl+i",         "command": "workbench.action.navigateForward" },

But beware this seems a bit sloppy. Maybe this is also mentioned in the VsCodeVim documentation.

@monkoose
Copy link

monkoose commented Dec 7, 2016

@mswift42 I trully believe that you can implement something what you need with the marks(they are supported in the vscodevim). Not the full ctrl-o functionality, just jump back to the line where you were. Do not tested myself but vscodevim support .vimrc configs so you can do some mark before jump(autoadd it when you press ctrl+]) and then add another keybindig to jump to that mark. At least for now. Or stick with an editor that you work for now and check this feature later.
I'm too for now can't work in vscode. But i really like it besides some missing vim features.

@hastebrot Seems like working. At least for first glance(may be has some bugs though do not sure). So my comment is useless.

@hastebrot
Copy link

hastebrot commented Dec 7, 2016

@monkoose I observed some problems with gd, then multiple ctrl-o, then ctrl-i inserts some strange history items inbetween. Or gd, then ctrl-o, then j jumps somewhere multiple rows below.

Update: I could not reproduce the first issue after an update to the newest insiders build. Could be fixed in the update, could also be me trying to reproduce this issue in the wrong files.

@Xaeroxe
Copy link

Xaeroxe commented Mar 21, 2017

It's been a while since this issue was last looked at, but I did download VSCodeVim today and I am rather pleased with it. It's also offered through the welcome page of VSCode. Therefore I don't see any reason to keep this issue open. Any further enhancement requests should probably go to the VSCodeVim repository.

@daveisfera
Copy link

This maybe should be a separate issue, but I just tried it and clicking the Vim link didn't do anything. I had to click others link before the menu on the left opened and I saw how to install Vim.

@Xaeroxe
Copy link

Xaeroxe commented Mar 21, 2017

@daveisfera Curious, the link worked for me. That's actually how I discovered the extension. I wish we had more info on why it might not be working for you.

@h-cow
Copy link

h-cow commented Mar 21, 2017

Yes Vim support is good now I would say this should be closed.

@andradei
Copy link

It is just a matter of improving the existing APIs and contributing to the existing Vim plugins at this point. The plugins, though not perfect, are useful right now.

I agree that this should be closed.

@ghost
Copy link

ghost commented Mar 31, 2017

Is there any Vim plugin that has textobj support implemented? The atom vim plugin supports commands like dif (delete inner function) ci' (change inner ') and so on.

Textobj and the Jumpy extension working with the Vim extension are the 2 main reasons I am staying with Atom. The plugins are way more matured and usable in Atom and simply just work as expected.

@johnfn
Copy link
Contributor

johnfn commented Mar 31, 2017

@FASA123 VSCodeVim supports text objects. Things like daw, ci', ci(, yap etc. all work. dif is not a text object in Vim as far as I know, so it's not supported, but you can feel free to add it if you'd like! I actually added a custom text object af which selects ever-increasing blocks of text, so it probably works in a similar way to the dif you're used to.

@ghost
Copy link

ghost commented Mar 31, 2017

You are right. They in fact do work I don't know whats wrong with me wow.

Also the af command surprisingly works really well thanks for pointing this out.

Also I assume there wasn't any further developement on that whole "multiple-extensions registring hotkeys for the same scope" (Jumpy&Vim) dilemma? In Atom I could register the f hotkey for normal mode to call the Jumpy extension. This combination is really one of the only things missing to me personally anymore.

One other question though. Is there a way I can use daf instead of first having to vaf then d?

@kieferrm
Copy link
Member

Thanks everyone for the contributions in this issue. As some have observed, the remaining work is in the extensions. Therefore, I'll close the issue.

@FASA123 @johnfn pls take your conversation to an issue in https://github.com/VSCodeVim/Vim/issues.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality VIM VIM issue
Projects
None yet
Development

No branches or pull requests