Sublime Forum

Indent a line to the upper line, if auto_indent is turned off

#1

Say you have a file like this one, and the cursor is at line 5, and you have auto_indent turned off.

function renamefile() {
    local new="$(rename "$2")"
    if [[ "$2" != "$new" ]]; then
        mv "$1/$2" "$1/$new"
|
        echo "$new"
    fi
}

Is it possible to indent line 5 to its upper line? That is, like this:

function renamefile() {
    local new="$(rename "$2")"
    if [[ "$2" != "$new" ]]; then
        mv "$1/$2" "$1/$new"
        |
        echo "$new"
    fi
}

Maybe using a macro?

0 Likes

#2

The command being executed when hitting tab is “reindent”, if auto_indent was true.

1 Like

#3

So a macro should enable auto_indent temporary, then execute the reindent command, and then turn auto_indent off, is it correct?

0 Likes

#4

Just execute reindent command.

1 Like

#5

Ah, thanks. Actually, I didn’t tried yet. Just discovered that Command-K Command-] do exactly this.

0 Likes