Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I bind "Enter" to a command in VS Code?

I went to Code->Preferences->Keyboard Shortcuts to bind ENTER to the acceptSelectedSuggestionOnEnter command (somehow my VS Code stopped letting me accept input suggestion by pressing Enter...), but I wasn't able to enter ENTER by pressing it when it asked me to "press desired key combination and then press ENTER" because the entry box closes on ENTER.

vs code version: 1.72.2 On a Mac

like image 856
coddd Avatar asked Aug 12 '26 08:08

coddd


1 Answers

It's difficult (impossible?) to do in the keyboard shortcuts UI for the reason you mentioned, but you can do it in the keybindings.json file with "key": "enter" like shown in the docs. You can open up keybindings.json using the Preferences: Open Keyboard Shortcuts (JSON) command in the command palette.

like image 183
starball Avatar answered Aug 18 '26 14:08

starball



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!