Skip to content

Commit f1de8d2

Browse files
authored
doc: Merge pull request #12 from maxim-uvarov/update-readme
make installation instructions more convenient, add chapter about setting up auto format in helix
2 parents 48934dd + 993c75a commit f1de8d2

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,28 @@
1515

1616
## setup
1717

18-
1. install topiary-cli (0.6.0+ suggested)
19-
2. clone this repo to `$env.XDG_CONFIG_HOME/topiary`
20-
3. set environment variables
21-
2218
```nushell
19+
# install topiary-cli (0.6.0+ suggested)
20+
# for example, installing with cargo
21+
cargo install --git https://github.com/tweag/topiary topiary-cli
22+
23+
# clone this repo to `$env.XDG_CONFIG_HOME/topiary`
24+
git clone https://github.com/blindFS/topiary-nushell ($env.XDG_CONFIG_HOME | path join topiary)
25+
26+
# set environment variables
2327
$env.TOPIARY_CONFIG_FILE = ($env.XDG_CONFIG_HOME | path join topiary languages.ncl)
2428
$env.TOPIARY_LANGUAGE_DIR = ($env.XDG_CONFIG_HOME | path join topiary languages)
25-
2629
```
30+
2731
## usage
2832

29-
+ `topiary format script.nu`
30-
+ neovim: format on save with [conform.nvim](https://github.com/stevearc/conform.nvim):
33+
```nushell
34+
topiary format script.nu
35+
```
36+
37+
### neovim
38+
39+
Format on save with [conform.nvim](https://github.com/stevearc/conform.nvim):
3140

3241
```lua
3342
-- lazy.nvim setup
@@ -49,6 +58,17 @@ $env.TOPIARY_LANGUAGE_DIR = ($env.XDG_CONFIG_HOME | path join topiary languages)
4958
},
5059
```
5160

61+
### helix
62+
63+
To format on save in Helix, add this configuration to your `helix/languages.toml`.
64+
65+
```toml
66+
[[language]]
67+
name = "nu"
68+
auto-format = true
69+
formatter = { command = "topiary", args = ["format", "--language", "nu"] }
70+
```
71+
5272
## contribute
5373

5474
Help to find format issues with following method (dry-run, detects parsing/idempotence/semantic breaking):

0 commit comments

Comments
 (0)