I'm trying to create a very simple snippet in VSCode and I'm using vim extension. I succeed to enter insertMode after inserting my snippet. I'm not able to write anything after that.
This is my python.json
file:
"Print": {
"prefix": "print",
"body": [
"print($1)$0"
],
"description": "Print statement"
}
This is my settings.json:
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": ["<leader>", "i", "p"],
"commands": [
{
"command": "editor.action.insertSnippet",
"args": {
"langId": "python",
"name": "Print"
}
},
{
"command": // COMMAND to enter insert mode here
},
{
"command": // COMMAND to type something (eg: `type` but I'm not sure I can use it with vim)
},
{
"command": // COMMAND to quit insert mode here
}
],
}
],
I know I could write arguments to the snippet but it's more for the sake of learning how to play with vim extension as I'd like to create another extension that uses vim one.
This is the end of my first question but I've got a second one:
When I use this keybinding, I want the code to be indented. For example ("|" represents cursor position):
def my_function():
a = "super string"
|
Applying shortcut
This is what I want:
def my_function():
a = "super string"
print(|)
This is what I get:
def my_function():
a = "super string"
print(|)