Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you set the return space on the parentheses in sublime 3?

When I type action() and hit return in the between the parentheses, I get this:

action (
    )

instead of this:

action (
)

How do I change this?

I have this in my keybindings right now but it only works in non-js files-

[
    { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context":
        [
            { "key": "setting.auto_indent", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }
        ]
    },
    { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Add Line in Braces.sublime-macro"}, "context":
        [
            { "key": "setting.auto_indent", "operator": "equal", "operand": true },
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true },
            { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true }
        ]
    },
    { "keys": ["super+shift+\\"], "command": "reveal_in_side_bar"},
    {"keys": ["tab"], "command": "expand_abbreviation_by_tab", "context":
      [
        { "operand": "source.js", "operator": "equal", "match_all": true, "key": "selector" },
        { "match_all": true, "key": "selection_empty" },
        { "operator": "equal", "operand": false, "match_all": true, "key": "has_next_field" },
        { "operand": false, "operator": "equal", "match_all": true, "key": "auto_complete_visible" },
        { "match_all": true, "key": "is_abbreviation" }
      ]
    },
]
like image 251
stackjlei Avatar asked Apr 19 '17 05:04

stackjlei


People also ask

How do you add a space in Sublime text?

Here is how to tell to Sublime text to do that automatically This is the result you want : [a space], the bracket, “$0” is where your cursor will be, then, the closing bracket. After that, on line 16, we manage the suppression of the open-bracket, to remove the close-one.

How do you change the indentation in Sublime text 3?

That's quite simple in Sublime. Just Ctrl+Shift+P (or Command+Shift+P on MacOS) to open the tools pallet, type reindent , and pick Indentation: Reindent Lines . It should reindent all the file you are in, just remember to save before running the command, or it may not appear. Is there a faster way to do this?

How do I change tabs to spaces in Sublime text 3?

To configure the tab width in Sublime Text 3, click on “View” in the top bar, then click on “Indentation” in the drop-down list. Next, in the second level of the drop-down list select the width you want a tab to take up. Sublime Text 3 defaults to tabs being four spaces wide.

What are the indentation options available in the Sublime text editor?

Changing default indentation settingstranslateTabsToSpaces: set to either 'true' or 'false'. If true, then when tab is pressed, an equivalent number of spaces will be inserted into the buffer instead. Defaults to false. tabSize: controls the visual width of tabs.


1 Answers

If nothing is working out then you can write a snippet for yourself in sublime like this (Menu Bar -> Tools -> Developer -> New snippet) and put the following code and save it.

<snippet>
    <content><![CDATA[
action(${1:}
)
]]></content>
    <tabTrigger>act</tabTrigger>
    <!-- <scope>source.JavaScript</scope> -->
</snippet>

It is a temporary solution not the best one. But for time being it can work.

like image 61
sv_jan5 Avatar answered Oct 09 '22 21:10

sv_jan5