Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Define Keybinding to insert special character in VSCode

I would like to define a keybinding to insert a specific unicode character in VSCode. What is the right way to achieve this ?

like image 985
lorefnon Avatar asked Nov 18 '17 19:11

lorefnon


People also ask

How do I add a Keybinding in VS Code?

All keyboard shortcuts in VS Code can be customized via the keybindings. json file. To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.

What does Ctrl Shift P do in VS Code?

Define keyboard shortcuts for tasks# From the Command Palette (Ctrl+Shift+P), select Preferences: Open Keyboard Shortcuts File, bind the desired shortcut to the workbench. action. tasks. runTask command, and define the Task as args .

How do I set Keybinds in Visual Studio?

On the menu bar, choose Tools > Options. Expand Environment, and then choose Keyboard. Optional: Filter the list of commands by entering all or part of the name of the command, without spaces, in the Show commands containing box. In the list, choose the command to which you want to assign a keyboard shortcut.


1 Answers

VSCode has a type command to handle exactly this kind of use case:

In keybindings.json:

{
    "key": "ctrl+alt+1 s",
    "command": "type",
    "args": {
        "text": "Ψ"
    }
}
like image 147
lorefnon Avatar answered Oct 01 '22 00:10

lorefnon