vimrc-to-json icon indicating copy to clipboard operation
vimrc-to-json copied to clipboard

A Python script that converts a .vimrc file to a settings.json for VSCodeVim.

Hold up! ⚠️

Did you know that VsCodeVim as of version 1.12.0 supports .vimrc files? So you might not even need this tool!

Set vim.vimrc.enable to true and set vim.vimrc.path appropriately.

.vimrc to JSON

A Python script that converts a .vimrc into a settings.json for VSCodeVim.

How to use

  1. Install Python 3.x

  2. Download vimrc-to-json.py manually or run curl https://raw.githubusercontent.com/Sheepolution/vimrc-to-json/master/vimrc-to-json.py > vimrc-to-json.py

  3. Put your .vimrc and vimrc-to-json.py in the same directory

  4. Run vimrc-to-json.py. It outputs a settings.json for VSCodeVim.

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"]
		}
	]
}

License

This tool is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE for details.