I want to find the command for "Replace" (from the "Find in Files" panel) so that I can assign a keyboard shortcut to it.
Normally I can use sublime.log_commands(True) in the Console Ctrl ` to identify the command, but the Console and Find in Files panels appear on top of each other; so I can't read the Console while I'm using Find in Files.
Control + Alt + Enter
From the default key bindings:
{ "keys": ["ctrl+alt+enter"], "command": "replace_all", "args": {"close_panel": true},
"context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}]
}
Related
Anyone notice that the default ctrl+tab doesn't work like the typical consecutive tab switching from left to right, e.g., in Chrome? I'm trying to switch to the next adjacent tab, but it seems to jump around (alphabetic order I think).
How can I change the order in which sublime switches tabs?
The default behavior is to goto tab you have used at last. Just add this keybinding to your user keybindings:
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
In sublime text 3, there is shortcut to switch tab in similar to ctrl+tab in browser.
{ "keys": ["ctrl+pagedown"], "command": "next_view" },
{ "keys": ["ctrl+pageup"], "command": "prev_view" },
While this ctrl+tab has behavior similar to windows alt+tab to switch apps. CMIIW.
{ "keys": ["ctrl+tab"], "command": "next_view_in_stack" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view_in_stack" },
You can just make custom key binding and swap them around.
And for anyone looking for shortcut to move tab to left & right, there is a plugin for that.
please try command + shift + ] .This will bring you immediately to the next tab.
Command + Ctrl + P : Switch between the projects that are listed on the sublimeText Sidebar.
In Sublime Text 3,when we press Ctrl+Shift+B, we are given the option to either do "Build and Run" or "only Build", whereas Ctrl+B executes the previously chosen operation among the two. But I want it to be like, it should directly build and run when I press Ctrl+Shift+B and only build when I press Ctrl+B like it was in Sublime Text 2. Can someone help me out?
Addings this to your sublime-keymap should result in the expected behavior:
{ "keys": ["ctrl+b"], "command": "build", "args": { "variant": "" } },
{ "keys": ["ctrl+shift+b"], "command": "build", "args": { "variant": "Run" } },
However you might want to remap keep the list of options to alt+b:
{ "keys": ["alt+b"], "command": "build", "args": { "select": true } },
Not answering the question but good to know, F7 functions the same as Ctrl+b.
(CTRL + SHIFT + F) it's really a nice shortcut to keep code well organized in eclipse. Is there any thing equivalent for sublime text editor?
Unfortunately there isn't a default key binding equivalent to CTRL + SHIFT + F in eclise. However, there is the reindent command that can be used to make your own key binding.
Open the "Key Bindings - User" from your preferences and add this JSON:
[
{
"keys": ["CTRL+\\"],
"command": "reindent",
"args": {
"single_line": false
},
"context": [{
"key": "selector",
"operator": "not_equal",
"operand": "source.js,source.json,text.html"
}]
}, {
"keys": ["CTRL+\\"],
"command": "htmlprettify",
"context": [{
"key": "selector",
"operator": "equal",
"operand": "text.html"
}]
}, {
"keys": ["CTRL+\\"],
"command": "js_format",
"context": [{
"key": "selector",
"operator": "equal",
"operand": "source.js,source.json"
}]
}
]
This will bind -\ to the reindent command (CTRL + SHIFT + F is already taken by "Find in Files"). single_line is false to force it to reindent the whole page, just like in eclipse.
There are two additional variants of the key bindings for working with HTML and JavaScript. These require that you have the htmlprettify and js_format plugins installed. I found the default formatting inferior for HTML and Javascript, so if you are editing these files I do recommend the plugins. If you don't care about these formats, then you can delete the last two key binding entries.
Go to "preferences/Key Bindings" and add on the right panel this line
{"keys": ["ctrl+shift+f"], "command": "reindent", "args": {"single_line": false}}
that line is meant for indenting all your code in one shot so you would ctrl+a then ctrl+shift+f
Sublime has an build-in feature that does indent lines for you. You can find this when opening the command palette, then look for Indentation: Reindent Lines.
Specific actions to organize your code is harder, because of the different syntaxes of languages.
Luckily enough, Will Bond has been so nice to create a Package Manager for Sublime Text. Using this, features can be added into the editor. These packages do can add code formatting features. You can see a list of formatting packages here.
As one of the tags in your question contains HTML, I'll assume you're looking for a formatting tool for HTML. I've found a package for that, although I've got no personal experience with it. You may install it from here.
A plugin for Sublime Text , that formats (indents) HTML source code. It makes code easier for humans to read.
I would recommend reading through the docs for more information about the package.
you can set shortcut key for one line by press [ctrl+shift+f] easy!!!
goto menu Preferences -> Key Bindings – User
{ "keys": ["ctrl+shift+f"], "command": "reindent"}
see detail at http://how-to-sublime-text.blogspot.com/2014/11/reformat-code.html
I'm trying to configure ST3 keybindings to reindent whole text, save file and refresh the browser on ctrl+s. I'm using Chain of Command and Browser Refresh plugins, but the problem is I don't know how to pass commands with arguments, so that the reindent command would affect whole text instead of one line only. "single_line" : false seems to be ignored.
"keys": ["ctrl+3"],
"command": "chain",
"args": {
"commands": [
["reindent",{"context": "window", "args": {"single_line": false}}],
["browser_refresh"]
]
}
I've made it.
"keys": ["ctrl+s"],
"command": "chain",
"args": {
"commands": [
["reindent",{"single_line": false}],
["browser_refresh"]
]
}
In Sublime Text we can change key bindings for our needs. But I can't find way to overwrite basic binding for unfold functionality. I have next code in my Key bindings - User file:
{ "keys": ["ctrl+keypad4"], "command": "fold" },
{ "keys": ["ctrl+keypad5]"], "command": "unfold" },
ctrl+keypad4 works as expected, but binding for ctrl+keypad5 not work at all. How to fix it?
I don't want to change global keymap.
You have an extra close bracket in there. It should be:
{ "keys": ["ctrl+keypad5"], "command": "unfold" },