-
Notifications
You must be signed in to change notification settings - Fork 2
Indent and prettify
This plugin provides a command to automatically indent and prettify your fish code, powered by fish_indent
(a program that comes with fish).
The indentation will respect your view's current tab size preferences, including your choice of spaces or tabs.
Under normal execution the entire file will be formatted, but by selecting some text before running the command you can limit the formatting to only that section or sections (multiple individual selection regions are permitted).
There are several ways to format the active fish file:
- Press
ctrl+alt+i
. - Save the file (if you have turned on this feature).
- Press your build system shortcut (
ctrl+b
by default), and if prompted selectfish - Indent and Prettify
in the quick panel. - Open the command palette (
shift+ctrl+p
by default) and lazy typefish: Indent and Prettify
to find and select it. - Add your own keyboard shortcut by modifying the keymap (Preferences > Key Bindings) and adding a section like this:
Just change the
{ "keys": ["ctrl+alt+i"], "command": "do_fish_indent", "context": [ {"key": "selector", "operator": "equal", "operand": "source.shell.fish"} ] }
ctrl+alt+i
string; refer to the official Sublime Text documentation on the topic of key bindings.
(Modify via fish settings.) This feature will format a file every time you save it.
It is disabled by default; to enable it, set indent_on_save
to true
.
To prevent a certain file being formatted on save, add the basename (that is, the filename with leading directory components removed) to the indent_on_save_blacklist
list.
There is currently no support for globbing characters (*
, ?
) or regular expressions in the blacklist.
If fish is installed in a nonstandard location on your system, then you must manually configure its install directory by setting fish_directory
.
The contents of this wiki are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.