Skip to content

dotninth/hxduster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Stand With Ukraine


hxduster logo hxduster logo

πŸš€ Introduction

hxduster is a simple Bash script that allows you to use Tighten's Duster as a formatter for PHP files in Helix Editor.

The problem without this script is that Helix puts the contents of the file into stdin and takes the formatted version from stdout, and Tighten's Duster formats the file and saves it. The only way to use it was via dprint and :reload-all command in Helix. But it's inconvenient because you should run :rla command after each save and should be aware of it all the time.

hxduster solves this problem.


🏁 Getting Started

Requirements

Installation & Helix Configuration

If you don't have Tighten's Duster installed yet, install it through the Composer:

composer global require tightenco/duster

Now clone the repo and install the script. You can install it in any directory you want, I show you an example of the default $HOME/.local/bin folder in Linux here.

git clone git@github.com:dotninth/hxduster.git
cd hxduster
chmod +x ./hxduster.sh
mv hxduster.sh $HOME/.local/bin

Important

The path to the folder where you put the hxduster script should be in your .bashrc or .zshrc!

Now add hxduster to your Helix languages.toml configuration file.

hx $HOME/.config/helix/languages.toml
[[language]]
name = "php"
formatter = { command = "hxduster.sh", args = ["--stdin"] }
auto-format = true

And that's it! Open any PHP file in your Laravel project and see if hxduster works. You can break the formatting and run the :fmt command to make sure everything works as intended.

Have fun!


πŸ“„ License

The MIT License (MIT). Please see License File for more information.

About

A bash script that enables integration of Tighten's Duster with Helix Editor.

Topics

Resources

License

Stars

Watchers

Forks

Languages