VSCodeVim/Vim

.vimrc support

Opened this issue ยท 41 comments

  • Click thumbs-up ๐Ÿ‘ on this issue if you want it!
  • Click confused ๐Ÿ˜• on this issue if not having it makes VSCodeVim unusable.

The VSCodeVim team prioritizes issues based on reaction count.


Support an actual .vimrc file alongside our current settings.json.

Allow users to specify a location for the .vimrc insite the settings.json file.

Support basic .vimrc commands.

Yup, assign this to me as I'm working on a prototype.

sick!

jpoon commented

Re-opening this -- we don't have .vimrc support.

I'm gonna close this as although it's true that we don't support .vimrc, I believe our settings.json support is a solid equivalent, except better because it has autocomplete and documentation popups.

If anyone disagrees, feel free to open a conversation on this issue.

Well, I have a shared vimrc file for vim and vsvim. I would have loved to include that from here as well.

wfxr commented

I also expect vimrc support feature. Almost everyone using vscodevim knows how to config vimrc. So documentation popups feature is not that important as far as I see.

I agree setting.json is good, but I think reuse and DRY means much. We can use vimrc in vsvim, ideavim, neovim, etc, but we cant't use vscode setting.json anywhere else. That's the problem.

Maybe support both setting.json and vimrc is a better way?

I see your argument. Reopening this issue.

+1 for this feature. Is there any update?

It's certainly on my radar, however it is currently deprioritized because:

  • There are a lot of other issues with more thumbs up that we need to get to first.
  • No functionality is actually lacking. It's just annoying not to have.

If a bunch of people thumbs up the original issue, I'll certainly reconsider :)

+1 for this feature. Is there any update?

@polunzh The update is the post I made 9 days ago right above you. :P

If you're curious, we pretty much tackle issues in this order: https://github.com/VSCodeVim/Vim/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc

Just discovered Visual Studio Code, and immediately installed this plugin only to discover my .vimrc isn't being recognized ๐Ÿ˜ข I can't use vim mode without my vimrc, too many keybindings that I have developed over the years and too lazy to port them over to this plugin.

@atedja Luckily, very good progress is being made on that front. Through neovim integration, we'll be able to support your entire .vimrc (including plugins)!

#1897 is the PR you want to track.

@johnfn any status updates on this issue? I think it's currently the third highest prioritised task. Thanks!

For a temporary quick-hack, does anyone have a tool for converting keybindings from a .vimrc (or an .init.vim) into settings.json?

Looks like this is now the #1 requested issue, hopefully we can see this supported soon? This is the only thing preventing me from using VSCode.

I also would really like the ability to switch between vscode and vim when needed. This is a must for me!

not having to manually re-create my entire 375 line .vimrc in a json file would be ideal... either a one-time converter or first-party support would be awesome

I would be super keen to have this. It's not practical to duplicate key bindings in both vscode's settings and .vimrc.

@rebornix any updates on this issue?

Unlike our other highly upvoted issues which are difficult due to VSCode API limitations, this one is completely doable. Even without much experience in the codebase, someone could take a whack at this, since all you have to do is basically regex match a bunch of lines of a file. And getting even small sections of vimrc parsing up and running would probably be useful to lots of folks.

Working on a third-party script to port .vimrc to settings.json right now. I'll update this with a link to the repo soon.

Any update on this issue? I'd love to share my .vimrc with all of the IDEs on my machine , especially as I've a huge customize configurations/mappings

I wrote a simple parser for this in Python.

Download

Example

.vim

nmap nt gg
nnoremap + <C-a>
vnoremap Y :w<CR>

settings.json

{
	"vim.normalModeKeyBindings": [
		{
			"before": ["n", "t"],
			"after": ["g", "g"]
		}
	],
	"vim.normalModeKeyBindingsNonRecursive": [
		{
			"before": ["+"],
			"after": ["<C-a>"]
		}
	],
	"vim.visualModeKeyBindingsNonRecursive": [
		{
			"before": ["Y"],
			"commands": [":w"]
		}
	]
}

Is there any word on the progress of this? I think it's a highly desirable feature and it's looks like that's been the case for 3+ years.

+1 To this feature, I was just able to import my .vimrc into Visual Studio 2015's Vim plugin, and now I'm surprised VSCodeVim doesn't support this.

nykc commented

Why is this not a thing yet? As an avid vim user I am trying to pickup VSCode fulltime for development, and keep my vim for my DevOps work. While the vim bindings offer a familiar interface I cannot leverage any of the real benefits of my .vimrc which I spent over 10 years developing...

In the meantime this is an excellent solution: https://github.com/neoclide/coc.nvim

I think what we need right now is not implementing the .vimrc support in vscodevim right out of the box.

Instead, we should build a .vimrc to vscode-compatible json coverter to leverage the current vscode capability.

I have created a JSON converter to address this issue. Feel free to check out and contribute to this repository: vsc2vim

I have expect this feature for a very long time.

Is there any new updates on feature progress? I am relatively new to working on plugins for vscode and working on larger community projects but if no one has figured out how to tackle this yet I could try to take a swing at it. I just need to know where to start.

@isaiahfisher #3908 is the current state of things. That PR could use some love, if you're interested in contributing.

Hey all! With the release of 1.12, I'm excited to announce that VSCodeVim now supports remappings from a .vimrc file! Special thanks go to @rdnlsmith and @Sheepolution for their great work on this.

To get started, set vim.vimrc.enable and vim.vimrc.path appropriately. You can then run the new Edit .vimrc command from the command palette.

Please note that other settings, plugins, etc. are still not supported via .vimrc. In addition, this feature shouldn't be considered 100% stable, so please test it out and submit issues with any feedback you have!

@J-Fields Do we have some examples of what we currently support?

filyp commented

It looks that inoremap doesn't work, while imap and nnoremap are fine.

Does this support <leader> mappings? I haven't been able to get any of my bindings to work at all, whether with leader or localleader.

EDIT: It turns out that you must set the leader key in VSCode's settings, not just in your .vimrc

Does this support <leader> mappings? I haven't been able to get any of my bindings to work at all, whether with leader or localleader.

EDIT: It turns out that you must set the leader key in VSCode's settings, not just in your .vimrc

Currently only the remaps are read from the .vimrc. Everything else needs to be set in vscode settings.

Just my 2 cents, but as a long time vim user often with intellij this not being figured out is my number one reason why I haven't more seriously considered switching to vscode for a while now. Don't really want to learn vscodes unique syntax for how to set up settings.json for my vimrc file.

Any progress on this front? Per the comment earlier, it looks like this is the most-upvoted issue via https://github.com/VSCodeVim/Vim/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc (as posted in #463 (comment) )

EDIT: Looks like I spoke too soon and this is actually working, modulo a bug!

jetbrains can read .vimrc just fine, hope vscode can do the same some day.

jetbrains can read .vimrc just fine, hope vscode can do the same some day.

I'm not sure if it's considered or untrivial, but I enjoy how jetbrains just swallows my vimrc and am not annoyed by the silent failures (basically it reads and supports what it can). It still works even after refactoring my vimrc into subfolders (few years ago) and just "plugged" from my main vimrc call plug#begin('~/dotfiles/vimide/.vim/plugged').

I'm excited to see active development on this.