Skip to content

Commit

Permalink
document how to use stdin in nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricedesaxe committed Jul 19, 2024
1 parent dfdbf01 commit 1ab0842
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,21 @@ vim.api.nvim_exec([[
]], false)
```

You should also be able to configure it with input from stdin and output to stdout using the `--stdin` flag,
but I'm too much of a nvim noob to figure out how to configure it.
### Nvim with --stdin

You can also use stdin/stdout mode for nvim. This is an example of `init.lua`.

```lua
-- Create an augroup for tcsort
local tcsort_group = vim.api.nvim_create_augroup("tcsort", { clear = true })

-- Create an autocmd for BufWritePre event
vim.api.nvim_create_autocmd("BufWritePre", {
group = tcsort_group,
pattern = "*.templ",
command = "silent! %!tcsort --stdin",
})
```

## Contributing

Expand Down

0 comments on commit 1ab0842

Please sign in to comment.