You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- change this anywhere in your config (or not), these are the defaults
52
-
vim.g.guard_config= {
53
-
-- format on write to buffer
54
-
fmt_on_save=true,
55
-
-- use lsp if no formatter was defined for this filetype
56
-
lsp_as_default_formatter=false,
57
-
-- whether or not to save the buffer after formatting
58
-
save_on_fmt=true,
59
-
-- automatic linting
60
-
auto_lint=true,
61
-
-- how frequently can linters be called
62
-
lint_interval=500
63
-
}
42
+
- They can also be chained together:
43
+
44
+
```lua
45
+
localft=require('guard.filetype')
46
+
ft('haskell'):fmt('ormolu')
47
+
:lint('hlint')
64
48
```
65
49
66
-
- Use `Guard fmt` to manually call format, when there is a visual selection only the selection is formatted. **NOTE**: Regional formatting is best-effort, expect inconsistencies.
67
-
-`enable-fmt`, `disable-fmt` turns auto formatting on and off for the current buffer.
68
-
- Use `Guard Lint` to lint manually.
69
-
-`enable-lint` and `disable-lint` controls auto linting for the current buffer.
50
+
- Formatters and linters can also be chained:
70
51
71
-
## Examples
52
+
```lua
53
+
localft=require('guard.filetype')
54
+
ft('python'):fmt('isort')
55
+
:append('black')
56
+
:lint('mypy')
57
+
:append('mypyc')
58
+
:append('dmypy')
59
+
```
72
60
73
-
Format c files with clang-format and lint with clang-tidy:
61
+
- You can register the same formatter for multiple filetypes:
0 commit comments