ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Pretty Shell

by aerobounce ST3

Prettify or Minify bash / posix / mksh script with Sublime Text 3

Details

Installs

  • Total 215
  • Win 45
  • Mac 112
  • Linux 58
Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6
Windows 0 4 6 2 1 1 2 1 3 2 2 1 2 1 1 2 4 3 1 1 2 4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 4 1 2 2 2 3 3 1 4 2 1 2 2 6 7 5 2 1 1 5 3 0 3 1 2 1 3 3 5 3 1 1 3 4 5 4 10 1 1 3 7 0 0 0
Linux 0 2 2 3 1 2 1 1 2 3 4 0 2 3 1 1 2 4 3 4 1 1 2 3 0 1 1 2 1 2 0 0 0 2 0 1 1 1 0 1 4 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

🐚 Pretty Shell

Shell Script beautifier plugin for Sublime Text 3

📦 Install

  1. Package Control: Install Package
  2. Type PrettyShell and Install
  3. You're ready

📦 Manual Install

  1. Quit Sublime Text
  2. Clone this repository as shown below
  3. You're ready
# Example on macOS 
git clone https://github.com/aerobounce/Sublime-Pretty-Shell.git "$HOME/Library/Application Support/Sublime Text 3/Packages/PrettyShell"
# It should work on Linux / Windows too.
# Follow the same steps with the equivalent clone target directory.

⚠️ Dependency

Pretty Shell does not work without shfmt as this package utilizes the formatter.
shfmt is available via several package managers.

If installed via a package manager and Sublime Text recognizes its path, that's it.
Otherwise, an error will be shown. Specify absolute path to the executable in the settings:

"shfmt_bin_path": "Absolute Path to shfmt"

⌨️ Usage

  1. Command Palette...
  2. Pretty Shell: Format

or just save script file you are editing while pretty_on_save is true.

🔤 Default Key Bindings

  • macOS: cmd + ctrl + s
  • Linux: alt + ctrl + s
  • Windows: alt + ctrl + s

🛠 Options

"simplify": true, // Simplify the code
"language": "bash", // Language variant to parse (bash / posix / mksh)
"indent": 4, // 0 for tabs
"binop": false, // Binary operators such as '&&' and '|' may start a line
"switchcase": true, // Indent switch cases
"rediop": true, // Redirect operators will be followed by a space
"align": false, // Keep column alignment paddings
"minify": false, // Minify program to reduce its size
"pretty_on_save": true,
"shfmt_bin_path": "shfmt"

☑️ Todo

  • [x] Show parsing errors
  • [ ] Format only selection
  • [x] Ship with shfmt binaries for portability? -> Package will be too heavy

🤝 Special Thanks