1

Is there any way to use VS Code key bindings in Vim?

I really like the VSCode linux key bindings, but would like to give a try to Vim without losing productivity.

2 Answers 2

2

With all due respect, this question reads like "I drive a truck, now I want to try out a sports car. How can I do so without losing cargo hauling capacity?"

And the short answer is: you can't.

Sure, you can remap all familiar key bindings to Vim but you will have to know them. This means you would have to learn Vim first.

Maybe there's a plugin that does that for you. I wouldn't know.

Anyhow, if you use Vim with VS Code key bindings you will never truly learn Vim so this defeats the purpose.

The strong points of Vim are a modal interface, a very expressive yet short language to modify text and its extensibility through plugins. You cannot reap the first two benefits with VS Code keybindings.

Which leads to the question: why do you want to try Vim? If you're happy and productive with VS Code, stick with it. There's nothing wrong with it (apart from the obvious issue that it isn't Vim). If there was one single best text editor in the world, we wouldn't have thousands of them.

If you're earnest about giving Vim a try, I would recommend you start out with a bare version of it. No plugins, no mappings, no nothing. Once you're comfortable with it, try to write a vimrc with your settings and give a single plugin a try. After that, you can go crazy with plugins and stuff.

You might consider doing your serious work with VS Code and do a hobby project with Vim.

If you haven't done so, run vimtutor (should be installed alongside Vim) to see what it's all about.

If you really, really must have them, there's mswin.vim which will create mappings for the most common Windows shortcuts. It will make Ctrl+C and the like work. See :help mswin.vim. I wouldn't use it, for the reasons mentioned above.

4
  • I had the same question in mind as OP. I do all my development in VSCode. Sometimes when running a docker image -it I want to make an edit to debug something, I’ve used remote development containers but it’s kinda clunky for quick debugging . It would be nice if I could mount my familiar key binds. Commented Apr 22, 2023 at 21:29
  • @JasonLeaver I can see how you would benefit. You can upvote the question, it will get more visibility and attract more and better answers. Depending on the docker image, there may also be less esoteric editors available. However - and what else would you expect on vi SE? - give Vim a try, it's actually a pretty good editor.
    – Friedrich
    Commented Apr 23, 2023 at 14:08
  • I have been trying to build some vim muscle memory this weekend, for example I typed vi;:q repetitively for 5 minutes. I often find myself wanting to highlight a section of code and performing some action, for example holding SHIFT + any combination of [up, down, left, right, pgup, pgdn, home, end] then commenting out that code with CTRL + /. Commented Apr 23, 2023 at 18:39
  • Regarding the images their unix based, where I often have a debug stage built with extra deps that aren't in final build. Commented Apr 23, 2023 at 18:42
-2

*** YES ***

Learn Vim

still learning, I have become more Fast and Furious inside of vscode with this extension. Unique Identifier: vintharas.learn-vim.

Although I just checked the developer tools, and it looks like it needs an Internet connection for the instructions that aren't written in markdown.

2
  • 3
    My understanding is the OP look for the opposite: using VsCode binding within Vim instead of using Vim binding within VsCode. Commented Jun 21, 2023 at 16:07
  • Welcome to Vi and Vim! As Vivian says, I don't think this is answering the actual question. Even if it were, we prefer markdown-formatted answers with explanatory detail in addition to useful links. See How to Answer
    – D. Ben Knoble
    Commented Jun 22, 2023 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.