How to embed current file path in a custom user keymap? I'm referring to this documentation:
http://sublimetext.info/docs/en/reference/build_systems.html
Which has been deprecated but I do not see equivalent documentation for $file_path variable which I need to use in my keymap in the latest documentation. I'm not having any luck. My keymap looks like this (trying to launch Google Chrome with flag to package my application):
{
"keys": [
"shift+ctrl+g"
],
"command": "exec",
"args": {
"cmd": [
"c:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
"--pack-extension=${file_path}"
]
}
}
The official documentation is here: https://www.sublimetext.com/docs/3/build_systems.html
You may toggle the version switch in the bottom of the sidebar. The $file_path variable still exists though, so it probably should work. You may try removing the wrapping braces { and }
Related
I know there are bunch of questions for this one, but none is working for me.
Until yesterday, pressing CTRL+SHIFT+C used to open CMD at the project level folder, but nothing happens since this morning.
I guess something in VScode keybinding settings has been changed accidently, so I tried to use various When expressions but still no luck.
My vscode keybinding settings look like the following.
Could anyone let me know what is wrong with it please ?
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+shift+c",
"command": "workbench.action.terminal.openNativeConsole",
"when": "editorFocus"
},
{
"key": "ctrl+shift+c",
"command": "-workbench.action.terminal.openNativeConsole",
"when": "!terminalFocus"
}
]
It was the issue on vscode 1.57 for about a week, but it is working now with the latest version.
Good Job VSCODE!
am installing Git and I have to choose which terminal emulator to use with my Git bash. I have to choose between Windows' default console window instead of MinTTY(the default terminal of MSYNC) but I prefer the former which has to be configured to use a Unicode font in order to display non-ASCII characters correctly.
I have the latest version of Windows 10 installed and I am using the latest Windows terminal. I have tried to access the settings by 2 ways;
Clicking the settings tab opens settings.json file in Microsoft Visual Studio.
Pressing and holding tab while clicking the settings tab opens defaults.json (Windows terminal's current default settings). Inside the json file, I found Scrollback settings as below:
// Scrollback
{ "command": "scrollDown", "keys": "ctrl+shift+down" },
{ "command": "scrollDownPage", "keys": "ctrl+shift+pgdn" },
{ "command": "scrollUp", "keys": "ctrl+shift+up" },
{ "command": "scrollUpPage", "keys": "ctrl+shift+pgup" },
It is from here that I failed to know how to proceed. Here is the full-path to the json file: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.4.3243.0_x64__8wekyb3d8bbwe\defaults.json
Thanks in advance.
As far as I know, most of the fonts that come with Windows are "Unicode" fonts. If you are looking for some special glyphs in particular, you may want something like a Nerd Font. To set the font in Windows Terminal, see this doc.
Specifically, set the font either in the "defaults" section or in the specific profile you are using with Git Bash. fontFace will be the main setting. My settings.json "defaults" looks like this:
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
//"useAcrylic": true,
//"acrylicOpacity": 0.75
// From Nerd Fonts
// https://github.com/ryanoasis/nerd-fonts
"fontFace": "CaskaydiaCove NF",
"fontSize": 13,
"cursorShape": "filledBox"
},
My default key-bindings for pasting are
{ "keys": ["ctrl+v"], "command": "paste" },
{ "keys": ["ctrl+shift+v"], "command": "paste_and_indent" },
I overrode them in my user key-bindings with
{ "keys": ["alt+k"], "command": "paste" },
{ "keys": ["ctrl+k"], "command": "paste_and_indent" },
I use Dvorak keyboard, which means your V is my K. Also, I want paste_and_indent to be the default.
But Ctrl+k executes paste, not paste_and_indent. I determined this by turning on command logging in the console, with
sublime.log_commands(True)
However, if I make the paste_and_indent command to something else, like Ctrl+Alt+k or Alt+k, it correctly calls paste_and_indent.
I looked through the key-bindings for all of my installed packages, and don't see any other command using Ctrl+k. I also disabled most of my packages except syntaxes. I even accidentally disabled Package Control, but still, Ctrl+k only executes paste.
How can I determine and fix this conflict, so Ctrl+k executes paste_and_indent?
Check out the FindKeyConflicts plugin. There are several options for looking at all key bindings, or just conflicting ones, in a variety of contexts. All the options are available via the Command Palette.
In Sublime Text 2 or 3 (I use both, and the answer is probably the same for both), how do you change the hotkey of an installed plugin/package? (on Windows or Linux / Ubuntu)
I already know how to change the key bindings of built-in Sublime commands (Preferences > Key Bindings). For instance, one binding I already have is:
{"keys": ["ctrl+super+b"], "command": "show_panel", "args": {"panel": "output.exec"}}
But in the case of a plugin, how do I know what string to use for "command"? Is there an easy way to find out what the "command" is for an arbitrary function in Sublime?
I would like a general answer that applies to any plugin one could install. Though as an example, today I'm trying to change the hotkey for a plugin called SimpleClone, which has assigned Ctrl+Shift+Right to Split Right. Ctrl+Shift+Right is a rather poor hotkey choice by the maker of the plugin since it already has a use in the operating system: when typing it selects the word to the right. Hence I want to change the assigned key binding.
If plugin has some shortcuts defined, they will be in the *.sublime-keymap files. So if you want to find some shortcut I guess you could grep through all the *.sublime-keymap files in Packages directories, but if you roughly know which plugin uses that shortcut you want to change that shouldn't be necessary :)
For example the Emmet plugin has keybindings defined in: Packages/Emmet/Default (Platform).sublime-keymap.
You can copy the keybinding definitions from these files to your user keybindings file (Packages/User/Default (platform).sublime-keymap) and modify them as you want.
You can open Packages list by pressing Cmd-Shift-P (on Windows should be Ctrl-Shift-P), choosing Package Control: list packages then select the package you neeed and press Enter. Sublime will open package directory where you can find all desired *.sublime-keymap files.
You can do the following:
Go to "Menu->Preferences->Browse packages..."
Find the directory of the interested package.
Find file with ".sublime-commands" extension.
Get command name from file.
Use "Menu->Preferences->Key bindings" for add key binding.
Ex (StringUtilities):
[
{ "keys": ["ctrl+b"], "command": "convert_to_base64" },
{ "keys": ["ctrl+shift+b"], "command": "convert_from_base64" },
{ "keys": ["ctrl+u"], "command": "url_encode" },
{ "keys": ["ctrl+shift+u"], "command": "url_decode" }
]
Is there a way to force Sublime to use a setting ONLY for a given file extension. In my specific case, I'd like to use Unix line endings on the .sh file extension.
Yes, there is, but the settings are by syntax, not file extension. First, open a .sh file, and the syntax should automatically be set to Shell Script (Bash). Next, click on Preferences -> Settings-More -> Syntax Specific-User and something like the following should appear:
{
"extensions":
[
"bash",
"zsh",
"sh",
"profile"
]
}
Change it to the following:
{
"extensions":
[
"bash",
"zsh",
"sh",
"profile"
],
"default_line_ending": "unix"
}
and save. You can follow this same general principle for any syntax, using any setting available in Preferences -> Settings-Default.