Sublime 3 toggle comment command doesn't work in Windows - keyboard-shortcuts

I've edited the file Preferences > Key Bindings User, and added this:
[
{ "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } },
]
But the shortcuts doesn't work. What went wrong?

I solved my problem:
[
{ "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },
]
Just replace '/' by 'keypad_divide'

This works for me, with a QWERTY (Italian) keyboard, where the / is above the number 7.
Add in Preferences > Key Bindings User
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }
It should works good on German QWERTZ keyboard also.

This worked for me on Windows 10:
{ "keys": ["control+keypad_divide"],"command": "toggle_comment", "args": {"block": false} },
{ "keys": ["shift+control+keypad_divide"],"command": "toggle_comment", "args": {"block": true}}

I was having the same problem, but what worked for me was
ctrl + รง
without going to preferences.
(I have no idea why, notice is the c cedilla)

With portuguese keyboard layout (my case) I had to use this:
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }

The solution for italian keyboards also works for spanish keyboards on Windows 10:
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }

Follows this link for the solution:
Keyboard shorcut to Toggle (Block) comment in Sublime-Text
Few additional comments:
Also, as a good practice try to edit the Default (Windows).sublime-keymap -User file to place your personal preferences
If the symbol still doesn't works for you, possibly due to different keyboard layout, then can change opt for other key as well for e.g.
"keys": ["ctrl+shift+#"] ...
in the Default (Windows).sublime-keymap -User file.

This one work for me under window 10
{ "keys": ["ctrl+'"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+'"], "command": "toggle_comment", "args": { "block": true } }

[
{ "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } },
]
keypad_divide just solve my problem

This has solved the issue for me, without having to add an alternate keyboard shortcut:
{ "keys": ["ctrl+'"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+'"], "command": "toggle_comment", "args": { "block": true } }
I don't quite understand why. This key undoubtedly types a slash(/) but SublimeText interprets it as an apostrophe(') in the key binding.

Related

User defined colors in textmate grammar?

I use TexMate grammar to change colors of certain keywords/lines in output pane.:
my-output.tmLanguage.json
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "my-output",
"scopeName": "source.my-output",
"patterns": [
{
"match": "foo",
"name": "my-bar"
}
]
}
The colors are hardcoded in package.json as:
"contributes": {
"grammars": [
{
"language": "my-output",
"scopeName": "source.my-output",
"path": "my-output.tmLanguage.json"
}
],
"configurationDefaults": {
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "my-foo",
"settings": {
"foreground": "#123456"
}
}
]
}
}
}
Does VSCode provide ability to override textmate colors if defined in user's config?

How do I configure Serilog for multiple Environments appsettings.json

I am trying to configure appsettings.json so that I have multiple Serilog variables for each of our environments(Dev, UAT, Prod etc) I have the following serilog that works for dev:
"Serilog": {
"MinimumLevel": "Verbose",
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.Seq"
],
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "Seq",
"Args": {
"serverUrl": "https://seq-dev.test.com"
},
"Properties": {
"Application": "Console.Sample",
"Environment": "Local"
}
}
]
},
My current solution is to have an array of Serilog instance. I am going to be passing an arg into main specificying which environment I want and I should use that Seq instance(Example: args: Environment="d" for dev - this should pull the dev Serilog)
"d": {
"Serilog": {
"MinimumLevel": "Verbose",
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.Seq"
],
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "Seq",
"Args": {
"serverUrl": "https://seq-dev.test.com"
},
"Properties": {
"Application": "Console.Sample",
"Environment": "Local"
}
}
]
}
},
"q": {
"Serilog": {
"MinimumLevel": "Verbose",
"Using": [
"Serilog.Sinks.Console",
"Serilog.Sinks.Seq"
],
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "Seq",
"Args": {
"serverUrl": "https://seq-dev.test.com"
},
"Properties": {
"Application": "Console.Sample",
"Environment": "Local"
}
}
]
}
},
This is more of a configuration thing.
You need to specify a appsettings json for each environment
The one that will be used by the application is determine by this ENV variable

submenu on context menuitem in vscode extensions

i see a lot of github issues that seem to indicate that the ability to add a submenu that drops down when we click on a custom context menu item, say in explorer/context, was added in Sep 2020, but i can't find it in the extensions documentation.
can someone point me to that?
Thanks,
Nilesh
The syntax:
{
"contributes": {
"menus": {
"scm/title": [
{
"command": "git.commit",
"group": "navigation"
},
{
"submenu": "git.stage",
"group": "navigation"
}
],
"git.stage": [
{
"command": "git.stageAll",
"group": "navigation"
},
{
"command": "git.stageUntracked",
"group": "navigation"
}
]
},
"submenus": [
{
"id": "git.stage",
"label": "Stage",
"icon": "$(something)"
}
]
}
}
see: https://github.com/microsoft/vscode/issues/100172#issuecomment-645203070

Is there a way to enable camel humping through method names in VS Code?

As this question is for the "big" Visual Studio and Resharper, I'd like to see that feature in VS Code too.
Scrolling through the shortcut list for VS Code, I couldn't find it but I'm hoping that it's still there but called something less intuitive than camel, hump or such.
As of version 1.25 these commands are built in:
I found this extensions to work https://marketplace.visualstudio.com/items?itemName=ow.vscode-subword-navigation
Funny thing is that you need to configure each combination separately:
{
"key": "alt+left",
"command": "subwordNavigation.cursorSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+right",
"command": "subwordNavigation.cursorSubwordRight",
"when": "editorTextFocus"
},
{
"key": "alt+shift+left",
"command": "subwordNavigation.cursorSubwordLeftSelect",
"when": "editorTextFocus"
},
{
"key": "alt+shift+right",
"command": "subwordNavigation.cursorSubwordRightSelect",
"when": "editorTextFocus"
},
{
"key": "alt+backspace",
"command": "subwordNavigation.deleteSubwordLeft",
"when": "editorTextFocus"
},
{
"key": "alt+delete",
"command": "subwordNavigation.deleteSubwordRight",
"when": "editorTextFocus"
}
If for some reasons your bindings are not set here is the json to obtain Cezn's shortcuts.
{
"key": "ctrl+alt+right",
"command": "cursorWordPartRight",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+right",
"command": "cursorWordPartRightSelection",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+left",
"command": "cursorWordPartLeft",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+shift+left",
"command": "cursorWordPartLeftSelection",
"when": "editorTextFocus"
}
{
"key": "ctrl+alt+backspace",
"command": "deleteWordPartLeft",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+delete",
"command": "deleteWordPartRight",
"when": "editorTextFocus && !editorReadonly"
}
Be careful with the ctrl+alt+delete one since it conflicts with another popular windows shortcut.
Other interesting bindings are:
{
"key": "ctrl+n",
"command": "explorer.newFile",
"when": "explorerViewletFocus"
},
{
"key": "ctrl+shift+n",
"command": "explorer.newFolder",
"when": "explorerViewletFocus"
}
There is an extension for this: Camel Case Navigation

Is there a shorcut to jump to another layout in sublime text3?

We can make a view with two layouts columns in sublime text 3. And when I want to type in another layout I always click to this layout so I don't want to click. I want to use shortcut. Is there such a shortcut?
The short answer to your question is super+k super+left and super+k super+right
Here are the shortcuts directly from Default keybidings.
If you're on Window super in Control key and if you're on Mac super is Command
{ "keys": ["super+k", "super+up"], "command": "new_pane" },
{ "keys": ["super+k", "super+shift+up"], "command": "new_pane", "args": {"move": false} },
{ "keys": ["super+k", "super+down"], "command": "close_pane" },
{ "keys": ["super+k", "super+left"], "command": "focus_neighboring_group", "args": {"forward": false} },
{ "keys": ["super+k", "super+right"], "command": "focus_neighboring_group" },
{ "keys": ["super+k", "super+shift+left"], "command": "move_to_neighboring_group", "args": {"forward": false} },
{ "keys": ["super+k", "super+shift+right"], "command": "move_to_neighboring_group" },