Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a CTRL + SHIFT + F for sublime like eclipse shortcut?

(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?

like image 307
Savrige Avatar asked May 14 '26 08:05

Savrige


2 Answers

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.

like image 181
user1373284 Avatar answered May 16 '26 21:05

user1373284


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

like image 26
PostMaloneM3m3r Avatar answered May 16 '26 21:05

PostMaloneM3m3r



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!