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

Space redirects -sr also seem to convert space indents to tabs #1069

Closed
javydekoning opened this issue Apr 8, 2024 · 2 comments
Closed

Space redirects -sr also seem to convert space indents to tabs #1069

javydekoning opened this issue Apr 8, 2024 · 2 comments

Comments

@javydekoning
Copy link

This causes conflicts with my editorconf (where I use 2 spaces for indents).

Running with -sr:

 function installdep() {
-  if [ ${PLAT} = "ubuntu" ]; then
-    apt-get -y update
-    # Satisfying even Ubuntu older versions.
-    apt-get -y install jq awscli ruby2.0 || apt-get -y install jq awscli ruby
-  elif [ ${PLAT} = "amz" ]; then
-    yum -y update
-    yum install -y aws-cli ruby jq
-  fi
+       if [ ${PLAT} = "ubuntu" ]; then
+               apt-get -y update
+               # Satisfying even Ubuntu older versions.
+               apt-get -y install jq awscli ruby2.0 || apt-get -y install jq awscli ruby
+       elif [ ${PLAT} = "amz" ]; then
+               yum -y update
+               yum install -y aws-cli ruby jq
+       fi
 }
@mvdan
Copy link
Owner

mvdan commented Apr 8, 2024

From man shfmt:

If any EditorConfig files are found, they will be used to apply formatting options. If any parser or printer flags are given to the tool, no EditorConfig files will be used. A default like -i=0 can be used for this purpose.

So your solution is to either add space_redirects = true to the EditorConfig file, or to repeat all of your EditorConfig formatting options as flags in the command line.

@javydekoning
Copy link
Author

Yikes, that was easy. Thanks!

Added:

[*.sh]
space_redirects = true

To my editorconf and it's fixed

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

2 participants