ftpsync upload key binding in sublime text 2 - file-upload

i'm asking how to add a key binding for "Upload the file" of FTPsync, i just put this line in key bindings user in FTPSync but is not working:
[
{ "keys": ["ctrl+alt+u"], "command": "ftp_sync_target" }
]
Thanks

That likely isn't the right command. In the ST console, enter sublime.log_commands(True). Then run the command like you would normally (without the key binding) and you should see the command to use. Alternatively, you can look at Default.sublime-commands or the key map file for the plugin to view the command to use.

Related

Sublime text 2, how to set hotkey to menu items 'View - Word Wrap Column - etc'?

I've found solutions on hotkeys Edit - Wrap - etc menu, and View - Word Wrap toggle. But not View - Word Wrap Column - etc menu items. Also tried to find plugins, nothing ...
https://www.sublimetext.com/docs/3/key_bindings.html
Currently there is no compiled list of all built-in commands. The
names of many commands can be found by looking at the Default ({PLATFORM_NAME}).sublime-keymap files in the Default/ package.
If you open the console with Ctrl` and enter
sublime.log_commands(True)
it will print the command for every. single. thing. you. do. Change the True to False to turn it off.
At any rate, for View → Word Wrap Column → 80, for example, it prints
command: set_setting {"setting": "wrap_width", "value": 80}
To set the keyboard shortcut, open your .sublime-keymap file and add the following:
{ "keys": ["ctrl+alt+shift+8"],
"command": "set_setting",
"args": {"setting": "wrap_width", "value": 80}
}
You can of course change the keys to whatever you want.

How do I remap the default CTRL+f (find) in Visual Studio Code such that I can use CTRL+f as is typical in unix/linux?

In Visual Studio Code, Ctrl+f activates the Find widget. I use vscode on Windows 10 (ssh into 'nix) and separately on the Ubuntu 18.04 Linux distro (w/Gnome Shell), when using the integrated terminal. I expected Ctrl+f to step one character forward in the CLI, as is typical on many Linux terminals, within vscode. How do I accomplish this?
I'd additionally like to maintain the find functionality, if possible, though with a different binding.
Because my search in SO retrieved little, I'm posting the solution and references I found for the community.
After searching several links via Google, I found straightforward documentation to solve this problem at https://vscode.readthedocs.io/en/latest/editor/integrated-terminal/.
The solution, in summary:
Open up Preferences: Open Keyboard Shortcuts, e.g. Ctrl+Shift+p and typing keyboard and then enter or return.
Type Ctrl+f in the Keyboard Shortcuts search bar and find the "Terminal: Focus Find Widget" line. Mine looks like this:
Click the pencil icon to alter the keybinding. One available for me was Ctrl+Alt+f.
Note: the following is pasted from the docs for easy reference.
Or, in your keybindings.json change:
{ "key": "ctrl+f", "command": "-workbench.action.terminal.focusFindWidget",
"when": "terminalFocus" },
to something like this:
{ "key": "ctrl+alt+f", "command": "-workbench.action.terminal.focusFindWidget",
"when": "terminalFocus" },
I also had to add this to my settings.json to make it work (VSCode version 1.62.0):
"terminal.integrated.commandsToSkipShell": [
"-workbench.action.terminal.focusFind"
]
In my VSCode v1.58.2, it now looks like this:
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+alt+f",
"command": "workbench.action.terminal.focusFind",
"when": "terminalFindFocused && terminalProcessSupported || terminalFocus && terminalProcessSupported"
},
{
"key": "ctrl+f",
"command": "-workbench.action.terminal.focusFind",
"when": "terminalFindFocused && terminalProcessSupported || terminalFocus && terminalProcessSupported"
}
]

Change Integrated Terminal title in vscode

We can open command prompt in vscode by using the Integrated Terminal feature in View menu.
We can even open multiple terminals as shown below:
Is there any way I can change the title of the terminal ?
1: cmd.exe will be build terminal
2: cmd.exe will be watch terminal
I have gone through the integrated terminal documentation but I didn't find a way to do that.
Press in windows Ctrl + Shift + P and after type: Terminal: Rename, there you can change the terminal name/title
In v1.61 there is the ability to set the terminal names using variables. See terminal custom titles in release notes.
Terminal names are traditonally the name of the process they're
associated with. Thus, it can be difficult to distinguish between
them.
We now support configuring both title and description to help with
this using variables described in terminal.integrated.tabs.title and
terminal.integrated.tabs.description settings.
The current default values are:
{
"terminal.integrated.tabs.title": "${process}",
"terminal.integrated.tabs.description": "${task}${separator}${local}${separator}${cwdFolder}"
}
Variables available are:
${cwd} - The terminal's current working directory
${cwdFolder} - The terminal's current working directory.
${workspaceFolder} - The workspace in which the terminal was launched.
${local} - Indicates a local terminal in a remote workspace.
${process} - The name of the terminal process.
${separator} - A conditional separator (" - ") that only shows when surrounded by variables with values or static text.
${sequence} - The name provided to xterm.js by the process.
${task} - Indicates this terminal is associated with a task.
It looks like the ${task} variable is what you are looking for.
Sometimes, plugins will remove default keyboard shortcut bindings.
Look for "terminal.rename" in keyboard shortcuts then edit the keyboard shortcut to your preferred shortcut.
To apply your shortcut, make sure your cursor is focus in edit part of the window before you key in. Not at the terminal part.
In v1.41 there is a new command which can be used like so:
{
"key": "ctrl+t",
"command": "workbench.action.terminal.renameWithArg",
"args": {
"name": "remote"
}
}
if you have some frequently used name, like "remote" or "build" that you use often.
With VSCode 1.63 (Nov. 2021), entering "<blank>" (ie., empty string) as name will restore the default name for that terminal.
See issue 134020
For instance:
If my setting is ${cwd}${separator}${process} and I name a terminal "foo".
How do I reset "foo" back to the value of ${cwd}${separator}${process}?
My suggestion was that if you attempted to submit a blank name that would automatically reset to the value of your setting.

Configure multiple commands on key combination

In Visual Studio Code, File > Preferences > Keyboard Shortcuts Menu, I can override default bindings in keybindings.json. But how can I add multiple bindings on a key? I wan't to do something like save as well as format code on press of ctrl+s
{ "key": "ctrl+s","command": "workbench.action.files.save,editor.action.format" }
Is this doable?
As far as I know that is currently not possible as the first keyboard shortcut that matches wins (searched from bottom to top) and no further shortcuts are evaluated - from the docs:
When a key is pressed:
the rules are evaluated from bottom to top.
the first rule that matches, both the key and in terms of when, is accepted.
no more rules are processed.
if a rule is found and has a command set, the command is executed.
That said, it seems that someone had the same desire and wrote an extension for that - see gyuha.format-on-save
However I did not test that extension myself so I can't tell you how well it works
Use the when clause as shown here where I hook up ctrl+enter to only case where .py[thon] script editor extension is active which is similar to the ctrl+enter file | preferences | keyboard shortcuts enabled by .R script editor extension.
[
{
"key": "ctrl+enter",
"command": "python.execSelectionInTerminal",
"when": "editorTextFocus && editorLangId == 'python'"
}
]

How to create a shortcut for user's build system in Sublime Text?

I've just created a build system named XeLaTeX by creating a file named XeLaTeX.sublime-build in the User directory of Sublime Text, whose content is:
{
"cmd": ["xelatex.exe","-synctex=1","-interaction=nonstopmode","$file_base_name"]
}
What should I do, if I want to bind my F1 key to this specific build system?
Note: Ctrl + B, the default build system should not be influenced. That is to say, I could use Ctrl + B to use the default one, and the key F1, the new system, is also available at the same time.
Maybe there is another way to achieve this. Add the following text to Default(Windows).sublime-keymap will execute the command:
{"keys": ["f1"], "command": "exec", "args": {"cmd": ["xelatex.exe","-synctex=1","-interaction=nonstopmode","$file_base_name"]}},
However, $file_base_name is not defined here. Is there any method to pass current file (base_)name to exec?
I nailed it by myself.
AFAIK, there is no such a way to pass current file name through key binding, and it's not possible to use key binding to specify a certain build system. Thus, writing a Python script is of necessity.
There are only three steps.
1. Save the following content to /Data/Package/User/compile_with_xelatex.py:
import sublime, sublime_plugin
class CompileWithXelatexCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().run_command('exec', {'cmd': ["xelatex.exe","-synctex=1","-interaction=nonstopmode", self.view.file_name()[:-4]]})
2. Add a line to /Data/Packages/User/Default(<your-plat>).sublime-keymap
{"keys": ["f1"], "command": "compile_with_xelatex"},
3. Open your LaTeX source file with Sublime Text, and then press F1 to compile it with XeLaTeX.
Indeed, it's a little tricky, but it works like a charm for me.
Build systems work by either selecting them specifically in the Tools -> Build System menu, or by using a selector to match a specific syntax. If you want to use a selector, add the following line to your XeLaTeX.sublime-build file (make sure to add a comma , after the first line, the file needs to be valid JSON):
"selector": "text.tex.latex"
The build command is already bound to CtrlB and F7, but if you also want it bound to F1, open Preferences -> Key Bindings-User and add the following line if you already have custom key bindings:
{ "keys": ["f1"], "command": "build" }
If the file is empty, just add opening and closing square brackets [ ] at the beginning and end of the file, respectively, as it also needs to be valid JSON.
Now, whenever you open a LaTeX file, you should be able to hit F1 to build it. If for some reason it doesn't work (if, for example, you have other build systems for LaTeX installed by plugins like LaTeXTools), then just select Tools -> Build Systems -> XeLaTeX, and everything should work properly.
Your example will work, if you give parameter "$file_basename" not "$file_base_name".