Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indention broken #11

Closed
mojotx opened this issue Feb 7, 2019 · 3 comments
Closed

Indention broken #11

mojotx opened this issue Feb 7, 2019 · 3 comments

Comments

@mojotx
Copy link

mojotx commented Feb 7, 2019

This is using the tag 20190202.

Create a file with the following, and re-indent with gg=G:

#!/bin/sh

if [[ /bin/true ]]; then
        echo "true"
else
        echo "false"
        if [[ /bin/false ]]; then
                echo "false"
        else
                echo "true"
        fi
        fi
        if [[ /bin/true ]]
        then
                echo "true"
        else
                echo "false"
                if [[ /bin/false ]]
                then
                        echo "false"
                else
                        echo "true"
        fi
        fi
@raghuvrao
Copy link

Here is probably the minimal test:

if true; then
    if true; then
        true
    fi
fi

With gg=G, the above is indented as follows:

if true; then
    if true; then
        true
    fi
    fi

Upon putting the above test case into another if ... fi block, the indentation comes out as follows:

if true; then
    if true; then
        if true; then
            true
        fi
        fi
        fi

The closing fi statements always align to the most recent if, and not to the actual corresponding if.

This problem did not exist in versions of indent/sh.vim prior to commit 2c2da66.

chrisbra added a commit that referenced this issue Mar 16, 2019
@chrisbra
Copy link
Owner

okay, I think I fixed it. Please verify

@mojotx
Copy link
Author

mojotx commented Mar 21, 2019

I'm confirming that this appears to be resolved with the latest fix. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants