Skip to content

more flexibility for autocmd control #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Aug 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
readme
  • Loading branch information
xiaoshihou514 committed Jul 29, 2023
commit 19fb9a1db4b71ed1caec3d905dac234b3a2ecad2
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## guard.nvim

Async formatting and linting utility for neovim.
Async formatting and linting utility for neovim.

## Features

Expand Down Expand Up @@ -49,12 +49,9 @@ require('guard').setup({
})
```

Use `GuardFmt` to manually call format, use `GuardDisable` to diable auto format. and you can create
a keymap like

```lua
vim.keymap.set({'n','v'}, '<cmd>GuardFmt<CR>')
```
- Use `GuardFmt` to manually call format, when there is a visual selection only the selection is formatted.
- Use `GuardDisable` to disable auto format, you can also disable for certain filetypes or buffers by using `GuardDisable lua` or `GuardDisable 1` (0 for current buffer)
- Use `GuardEnable` to re-enable auto format, usage is the same as `GuardDisable`

### Builtin tools

Expand All @@ -74,16 +71,17 @@ Table format for custom tool:

```
{
cmd --string tool command
args --table command arugments
fname --string insert filename to args tail
stdin --boolean pass buffer contents into stdin
timeout --integer
ignore_pattern --table ignore run format when pattern match
ignore_error --when has lsp error ignore format
cmd -- string: tool command
args -- table: command arugments
fname -- string: insert filename to args tail
stdin -- boolean: pass buffer contents into stdin
timeout -- integer
ignore_pattern -- table: ignore run format when pattern match
ignore_error -- boolean: when has lsp error ignore format
find -- string: format if the file is found in the lsp root dir

--special
fn --function if fn is set other field will not take effect
fn -- function: if fn is set other field will not take effect
}
```

Expand All @@ -95,6 +93,6 @@ Table format for custom tool:

## Troubleshooting

if guard does not auto format on save, run `checkhealth` first.
If guard does not auto format on save, run `checkhealth` first.

## License MIT