Vim icon indicating copy to clipboard operation
Vim copied to clipboard

can't make control save to execute esc command

Open danielo515 opened this issue 6 years ago • 4 comments

Describe the bug I have the following keybinding:

  "vim.insertModeKeyBindingsNonRecursive": [
    {
      "before": ["j", "k"],
      "after": ["<Esc>"]
    },
    {
      "before": ["<C-s>"],
      "commands": ["workbench.action.files.save","extension.vim_escape"]
    },
  ],

To Reproduce add the provided keybinding and try to save a file in insert mode

Expected behavior I want the file to be saved and insert mode to be exited

Additional context Add any other context about the problem here.

VS Code version: Code 1.41.1 (26076a4de974ead31f97692a0d32f90d735645c0, 2019-12-18T14:57:51.166Z) OS version: Darwin x64 19.2.0

System Info
Item Value
CPUs Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz (12 x 2900)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 3
Memory (System) 32.00GB (0.08GB free)
Process Argv .
Screen Reader no
VM 0%
Extensions (76)
Extension Author (truncated) Version
yaml2json ahe 0.0.3
auto-add-brackets ali 0.10.0
Handlebars and 0.4.1
jest-snippets and 1.7.0
better-toml bun 0.3.2
npm-intellisense chr 1.3.0
vscode-devtools-for-chrome cod 0.0.6
danielo-node-snippets dan 1.8.1
danielo-vsc-tools dan 1.0.1
vscode-eslint dba 2.0.15
jest-test-language-support dpl 1.30.2
es7-react-js-snippets dsz 2.5.0
gitlens eam 10.2.0
EditorConfig Edi 0.14.4
prettier-vscode esb 3.20.0
vimL fal 0.0.3
auto-rename-tag for 0.1.1
vscode-flow-ide gca 1.2.0
monkey-c ghi 0.3.1
lintlens ghm 2.7.0
vscode-pull-request-github Git 0.14.0
githd hui 2.2.0
yuml Jai 3.5.1
reason-vscode jar 1.7.5
flow jla 0.0.3
vscode-peacock joh 3.3.1
styled-components-snippets jon 0.6.0
open-in-vim jon 0.6.0
vscode-styled-components jpo 0.0.28
vscode-home-assistant kee 1.5.0
expand-region let 0.1.4
vscode-wrap-console-log mid 1.7.2
dotenv mik 1.0.1
vscode-docker ms- 0.10.0
remote-containers ms- 0.94.0
remote-ssh ms- 0.48.0
remote-ssh-edit ms- 0.49.0
remote-ssh-explorer ms- 0.49.0
remote-wsl ms- 0.41.9
vscode-remote-extensionpack ms- 0.19.0
cpptools ms- 0.26.3
Go ms- 0.13.0
vscode-typescript-next ms- 3.8.20200204
debugger-for-chrome msj 4.12.6
vscode-purty mva 0.4.1
color-highlight nau 2.3.0
incrementor nms 0.1.0
language-purescript nwo 0.2.2
indent-rainbow ode 7.4.0
vscode-jest Ort 3.1.1
advanced-new-file pat 1.2.0
vscode-react-refactor pla 1.0.5
vscode-graphql Pri 0.2.2
vscode-yaml red 0.6.1
partial-diff ryu 1.4.1
vscode-javascript-booster sbu 0.11.0
bash-beautify sha 0.1.1
code-settings-sync Sha 3.4.3
tiddlywiki5 sin 0.0.2
addDocComments ste 0.0.8
code-spell-checker str 1.7.22
control-snippets svi 1.7.2
json-schema-validator tbe 0.1.0
open-spec-file the 0.0.6
highlight-matching-tag vin 0.9.6
template-strings vit 0.0.5
vscode-icons vsc 9.7.0
vim vsc 1.12.4
vscode-wakatime Wak 2.2.1
vscode-file-extra wil 2.0.0
vscode-import-cost wix 2.12.0
change-case wma 1.0.0
disable-eslint-rule Woo 0.0.2
markdown-all-in-one yzh 2.7.0
vscode-open-in-github ziy 1.3.6
es6-string-javascript zjc 1.0.1

danielo515 avatar Feb 05 '20 09:02 danielo515

Hi, today I discovered you can do this, it should do what you want. { "before": ["<C-s>"], "after": ["<esc>"], "commands": ["workbench.action.files.save"] },

sql-koala avatar Feb 11 '20 21:02 sql-koala

Hi, today I discovered you can do this, it should do what you want. { "before": ["<C-s>"], "after": ["<esc>"], "commands": ["workbench.action.files.save"] },

I think that was my first attempt thinking "this is not going to work" and indeed didn't worked. I'll copy paste yours to make sure I did not make any mistake. Thanks

danielo515 avatar Feb 12 '20 06:02 danielo515

Same here, none of the suggestions work.

However, using another key works, such as

  "vim.insertModeKeyBindingsNonRecursive": [
    {
      "before": ["<C-j>"],
      "commands": ["workbench.action.files.save","extension.vim_escape"]
    }
  ],

so clearly seems like a vscode-vim bug.

hasufell avatar Feb 27 '22 18:02 hasufell

Not great, but works (keybindings.json)

	{
		"key": "ctrl+s",
		"command": "runCommands",
		"args": {
			"commands": [
				"workbench.action.files.save",
				"extension.vim_escape",
			]
		}
	},

silvio-r avatar Aug 13 '24 19:08 silvio-r

Not great, but works (keybindings.json)

	{
		"key": "ctrl+s",
		"command": "runCommands",
		"args": {
			"commands": [
				"workbench.action.files.save",
				"extension.vim_escape",
			]
		}
	},

worked like a charm, tyty!

teeemofey avatar Dec 14 '24 09:12 teeemofey