I'm having no luck changing the key bindings for switching files in Sublime. Does anybody know that the deal is here? All i'm trying to achieve is cmd+] and cmd+[ to show next and previous files. Then i can use tab and shift+tab for all my indenting.
[
{ "keys": ["super+]"], "command": "Next File" },
{ "keys": ["super+["], "command": "Previous File" }
]
Thanks everyone!
This is actually what you might have been really looking for. I find it more useful to go back to the previous file I was working on, not moving left and right through the tabs. But you can have bindings to both behaviors.
// This is very useful, go back to the previously viewed file regardless of
// tab order
{ "keys": ["super+["], "command": "next_view_in_stack" },
{ "keys": ["super+]"], "command": "prev_view_in_stack" }
Try this:
[
{ "keys": ["ctrl+]"], "command": "next_view" },
{ "keys": ["ctrl+["], "command": "prev_view" }
]
Of course this goes into the "Key Bindings - User" file.
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.
I want to create a custom key binding to trigger the Tools > Snippets overlay. I know sublime uses the show_overlay command and overlay enum, but after trial an error I can't figure out what to set the enum to.
{
"keys": ["shortcut"],
"command": "show_overlay", "args": {"overlay": "some_unknown_command"}
}
I'm not looking to insert a specific snippet, just trigger the overlay.
You can find the command by entering sublime.log_commands(True) in the ST console, then using the menu to display the overlay. It will give you the arguments and command you need to use.
{
"keys": [ <your keys here> ],
"command": "show_overlay",
"args": {
"overlay": "command_palette",
"text": "Snippet:"
}
}
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" },
Is there a smarter way of removing the tag (let's say using HTML) around a selection in Sublime text 2?
For example if I have a span tag around some text and want to remove both the start and end of this tag (and leave the text inside untouched)...
Or alternative - remove current tag and it's corresponding end tag?
The Emmet plugin (once called Zen Coding) can do what you want. Install it and press Ctrl+Shift+; within a tag's contents to unwrap the tag.
A bit easier way to do this is to use a macro:
unwrap.sublime-macro
[
{
"args":
{
"to": "tag"
},
"command": "expand_selection"
},
{
"args": null,
"command": "copy"
},
{
"args":
{
"to": "tag"
},
"command": "expand_selection"
},
{
"args": null,
"command": "paste_and_indent"
}
]
...with a ctrl+u for example:
{
"keys": ["ctrl+u"],
"command": "run_macro_file",
"args": {"file": "res://Packages/User/unwrap.sublime-macro"}
}
Pros: no plugins required, only default ST functionality. Cons: modifies clipboard data.