BriteSnow / vscode-toggle-quotes

Simple quote toggler that cycle through " ' and `
MIT License
70 stars 15 forks source link

Short cut is keyboard layout dependent #20

Open lborgman opened 4 years ago

lborgman commented 4 years ago

I tried ctrl+'. It did not work. It turned out that on a Swedish keyboard the default binding is something quite different.

heymajor commented 4 years ago

@lborgman Follow these steps to adjust the shortcut.

Open keybinding JSON:

shift + ctrl + P

type: keyboard json and enter to select it

Add this to the file:

// Removes original bind for VScode Extension Toggle Quotes
 {
        "key": "ctrl+'",
        "command": "-editor.togglequotes",
    },

// Rebinds shortcut for VScode Extension Toggle Quotes
  {
        "key": "SHORTCUT",
        "command": "editor.togglequotes",
        "when": "!terminalFocus"
    }

Change the SHORTCUT to whatever you'd like to use to toggle the quotes. I used ctrl+shift+' for my shortcut, so I used:

// Rebinds shortcut for VScode Extension Toggle Quotes
{
        "key": "ctrl+shift+'",
        "command": "editor.togglequotes",
        "when": "!terminalFocus"
    },

// Removes original bind for VScode Extension Toggle Quotes
    {
        "key": "ctrl+'",
        "command": "-editor.togglequotes",
    },
lborgman commented 4 years ago

@heymajor Thanks for your suggestions.

mulfvik commented 4 years ago

On swedish keyboard it is ctrl+ä

brendan33 commented 4 years ago

With a standard UK Dell laptop keyboard I found the pressing CTRL+' opened a terminal window by default. I had to edit the keyboard bindings as described by @heymajor above. First unbind the existing command, then bind to this extension. Not sure why the key is called oem_3 but that's how it is in the default keyboard json.

{
    "key": "ctrl+oem_3",
    "command": "-workbench.action.terminal.toggleTerminal",
},

// Rebinds shortcut for VScode Extension Toggle Quotes
{
    "key": "ctrl+oem_3",
    "command": "editor.togglequotes",
    "when": "!terminalFocus"
}
jeremychone commented 1 year ago

Hi all, sorry for the delay. Is there something I should add to the documation? Any suggestion welcome.