Why is vscode vim.otherModesKeyBindingNonRecursive an unknown configuration? - visual-studio-code

I had this setting for couple of weeks now but it stopped working today. This is a setting for vscode vim easymotion. I dont know what happened. I havent change anything. Does anyone know why?
OS macOS high Sierra.
Vscode Version 1.24.1 (1.24.1).
Vscodevim v0.14.0 .
"vim.otherModesKeyBindingsNonRecursive": [
{
"before": [
"s"
],
"after": [
"leader",
"leader",
"s"
]
}
],

It looks like otherModesKeyBindingsNonRecursive has been replaced. See pull request 2726 on the VSCodeVim project. Instead see the current Key Remapping section in the project's README:
Custom remappings are defined on a per-mode basis.
"vim.insertModeKeyBindings"/"vim.normalModeKeyBindings"/"vim.visualModeKeyBindings"
Their example usage:
Bind : to show the command palette:
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [":"],
"commands": [
{
"command": "workbench.action.showCommands",
}
]
}
]

Related

How to map "Go To Implementation" using VsCode Vim?

I want to map something like gi to open a Typescript interface implementation for example. In VsCode the shortcut is Ctrl + F12 and I tried to add a map like this inoremap gi <C-F12> in .vimrc file but that does not work.
I also tried to do that in my settings.json but still no results.
"vim.insertModeKeyBindings": [
{
"before": ["g", "I"],
"after": ["<C-F12>"]
}
]
How can I do that?
You can achieve that by mapping a shortcut to a VSCode command, not a set of keys. If you look at VSCode shortcuts, you can see that the Go To Definition action is related to a command so you can take that command and map to a vim shortcut in your settings.json file.
In the example I will map gI to editor.action.goToImplementation which is the related command.
"vim.insertModeKeyBindings": [
{
"before": ["g", "I"],
"commands": ["editor.action.goToImplementation"]
}
],
"vim.normalModeKeyBindings": [
{
"before": ["g", "I"],
"commands": ["editor.action.goToImplementation"]
}
]

How to make vim extension in visual code studio to use binding that repeats change for next match

How can I make vim extension in VSC make to use my keybinding?
In my .vimrc I got those lines:
" s* - CRTL + D like behavior
nnoremap <silent> s* :let #/='\<'.expand('<cword>').'\>'<CR>cgn
xnoremap <silent> s* "sy:let #/=#s<CR>cgn
How could I add them to my VSC?
Tried to add to my settings.json something like below, but got no idea how to add it properly every time I got an error:
Failed to handle key `*`: command '"sy:let #/=#s<CR>cgn' not found
"vim.normalModeKeyBindings": [
{
"before": [
"s",
"*"
],
"commands": [
":nohl:let #/='\\<'.expand('<cword>').'\\>'<CR>cgn",
],
"silent": true
},
{
"before": [
"s",
"*"
],
"commands": [
"\"sy:let #/=#s<CR>cgn",
],
"silent": true
},
]

How do I rebind Y to yank to the end of the line when using VS Code's Vim extension?

I'm using VS Code's neovim integration with neovim installed from snap. I want Y to work the same way as D and C. In ~/.config/nvim/init.vim I would add
map Y y$
How do I do this in VS Code? I've tried
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["Y"],
"after": ["y$"]
},
],
and
"vim.normalModeKeyBindings": [
{
"before": ["Y"],
"after": ["y$"]
}
],
but neither worked.
Turns out you need to specify and separate each key into an individual "", so that would be:
"vim.normalModeKeyBindings": [
{
"before": ["Y"],
"after": ["y", "$"]
}
]

Open specific file using key when using vscode / vim

I often work in a specific file and would like to have that file opened when pressing a shortcut. I tried several combinations but seem to hit a wall..
// file settings.json
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["leader","t"],
"commands": [
"vscode.open"
],
"args": "notes/todo.md"
}
]
Any hint on how i can get this working? When executing the above code i get a illegal argument 'resource'
Using normal vim keywords solves the problem.
{
"before": [
"leader", "t"
],
"commands": [
":edit file:///notes/todo.md"
]
}

How to delete to blackhole register in VScode's Vim mode?

I really want to use Visual Code and it looks like it has a great Vim mode. Unfortunately I'm one of those people that changed my .vimrc so that deletes, changes and the like would move to the blackhole register so that it wouldn't take over my last yank.
Does anyone know of a way to do something similar for dd or C mappings? I've tried it various ways but can't seem to get it to work.
It seems to only work with a leader like so
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<leader>","d"],
"after": ["\"", "_", "d", "d"]
},
],
"vim.leader": "<space>",
Doing the following though doesn't work. Any ideas?
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["d","d"],
"after": ["\"", "_", "d", "d"]
},
],
Black hole register mapping functionality has been fixed in the recent PR, just a few months after you posted this question. Update your VScode to the latest stable release and your mappings should work fine.
If you are interested in how to disable cut functionality for d command, here is how to do it. Put this in your settings.json:
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["d"],
"after": [ "\"", "_", "d" ]
}
]
Hope this helps