Is it possible to enable Code Folding in Xcode for Bash scripts

bashtext-editorxcode

I work a lot with bash scripts and some of them can get pretty lengthy. Up until now, I've been using BBEdit as my editor of choice because of the way it handles locked files and permissions. But … BBEdit doesn't support code folding. Xcode does, but it seems to only allow code folding in Obj-C and Swift. Is there any way to enable code folding for Bash scripts? If not, is there any app out there that can fold code in a bash script (preferably with syntax highlighting too)?

Best Answer

I haven't found a way to enable code folding for bash script in Xcode.

But here is an alternative: UltraEdit.
UE allows code folding for bash scripts after tweaking a file.

In the example below i have added

/Open Fold Strings = "{" "if" "elif" "do"
/Close Fold Strings = "}" "elif" "fi" "done"
/Ignore Fold Strings = "echo"

to the file ~/Library/Application Support/UltraEdit/wordfiles/bash.uew

Depending on your needs you may add other strings of course.

enter image description here

enter image description here

enter image description here