Refresh generated neovim config
This commit is contained in:
@ -38,14 +38,14 @@ OPTIONS *conform-option
|
||||
-- This can also be a function that returns the table.
|
||||
format_on_save = {
|
||||
-- I recommend these options. See :help conform.format for details.
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
timeout_ms = 500,
|
||||
},
|
||||
-- If this is set, Conform will run the formatter asynchronously after save.
|
||||
-- It will pass the table to conform.format().
|
||||
-- This can also be a function that returns the table.
|
||||
format_after_save = {
|
||||
lsp_fallback = true,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
-- Set the log level. Use `:ConformInfo` to see the location of the log file.
|
||||
log_level = vim.log.levels.ERROR,
|
||||
@ -86,9 +86,13 @@ OPTIONS *conform-option
|
||||
},
|
||||
-- Set to false to disable merging the config with the base definition
|
||||
inherit = true,
|
||||
-- When inherit = true, add these additional arguments to the beginning of the command.
|
||||
-- When inherit = true, add these additional arguments to the command.
|
||||
-- This can also be a function, like args
|
||||
prepend_args = { "--use-tabs" },
|
||||
-- When inherit = true, add these additional arguments to the end of the command.
|
||||
-- This can also be a function, like args
|
||||
append_args = { "--trailing-comma" },
|
||||
},
|
||||
-- These can also be a function that returns the formatter
|
||||
other_formatter = function(bufnr)
|
||||
@ -115,11 +119,11 @@ setup({opts}) *conform.setu
|
||||
{opts} `nil|conform.setupOpts`
|
||||
{formatters_by_ft} `nil|table<string, conform.FiletypeFormatter>` Map
|
||||
of filetype to formatters
|
||||
{format_on_save} `nil|conform.FormatOpts|fun(bufnr: integer): conform.FormatOpts` I
|
||||
{format_on_save} `nil|conform.FormatOpts|fun(bufnr: integer): nil|conform.FormatOpts` I
|
||||
f this is set, Conform will run the formatter on
|
||||
save. It will pass the table to conform.format().
|
||||
This can also be a function that returns the table.
|
||||
{format_after_save} `nil|conform.FormatOpts|fun(bufnr: integer): conform.FormatOpts` I
|
||||
{format_after_save} `nil|conform.FormatOpts|fun(bufnr: integer): nil|conform.FormatOpts` I
|
||||
f this is set, Conform will run the formatter
|
||||
asynchronously after save. It will pass the table
|
||||
to conform.format(). This can also be a function
|
||||
@ -138,32 +142,32 @@ format({opts}, {callback}): boolean *conform.forma
|
||||
|
||||
Parameters:
|
||||
{opts} `nil|conform.FormatOpts`
|
||||
{timeout_ms} `nil|integer` Time in milliseconds to block for
|
||||
formatting. Defaults to 1000. No effect if async =
|
||||
true.
|
||||
{bufnr} `nil|integer` Format this buffer (default 0)
|
||||
{async} `nil|boolean` If true the method won't block. Defaults
|
||||
to false. If the buffer is modified before the
|
||||
formatter completes, the formatting will be discarded.
|
||||
{dry_run} `nil|boolean` If true don't apply formatting changes to
|
||||
the buffer
|
||||
{formatters} `nil|string[]` List of formatters to run. Defaults to
|
||||
all formatters for the buffer filetype.
|
||||
{lsp_fallback} `nil|boolean|"always"` Attempt LSP formatting if no
|
||||
formatters are available. Defaults to false. If
|
||||
"always", will attempt LSP formatting even if
|
||||
formatters are available.
|
||||
{quiet} `nil|boolean` Don't show any notifications for warnings
|
||||
or failures. Defaults to false.
|
||||
{range} `nil|table` Range to format. Table must contain `start`
|
||||
and `end` keys with {row, col} tuples using (1,0)
|
||||
indexing. Defaults to current selection in visual mode
|
||||
{id} `nil|integer` Passed to |vim.lsp.buf.format| when
|
||||
lsp_fallback = true
|
||||
{name} `nil|string` Passed to |vim.lsp.buf.format| when
|
||||
lsp_fallback = true
|
||||
{filter} `nil|fun(client: table): boolean` Passed to
|
||||
|vim.lsp.buf.format| when lsp_fallback = true
|
||||
{timeout_ms} `nil|integer` Time in milliseconds to block for
|
||||
formatting. Defaults to 1000. No effect if async = true.
|
||||
{bufnr} `nil|integer` Format this buffer (default 0)
|
||||
{async} `nil|boolean` If true the method won't block. Defaults to
|
||||
false. If the buffer is modified before the formatter
|
||||
completes, the formatting will be discarded.
|
||||
{dry_run} `nil|boolean` If true don't apply formatting changes to
|
||||
the buffer
|
||||
{formatters} `nil|string[]` List of formatters to run. Defaults to all
|
||||
formatters for the buffer filetype.
|
||||
{lsp_format} `nil|"never"|"fallback"|"prefer"|"first"|"last"` "fallbac
|
||||
k" LSP formatting when no other formatters are available,
|
||||
"prefer" only LSP formatting when available, "first" LSP
|
||||
formatting then other formatters, "last" other formatters
|
||||
then LSP.
|
||||
{quiet} `nil|boolean` Don't show any notifications for warnings
|
||||
or failures. Defaults to false.
|
||||
{range} `nil|table` Range to format. Table must contain `start`
|
||||
and `end` keys with {row, col} tuples using (1,0)
|
||||
indexing. Defaults to current selection in visual mode
|
||||
{id} `nil|integer` Passed to |vim.lsp.buf.format| when using
|
||||
LSP formatting
|
||||
{name} `nil|string` Passed to |vim.lsp.buf.format| when using
|
||||
LSP formatting
|
||||
{filter} `nil|fun(client: table): boolean` Passed to
|
||||
|vim.lsp.buf.format| when using LSP formatting
|
||||
{callback} `nil|fun(err: nil|string, did_edit: nil|boolean)` Called once
|
||||
formatting has completed
|
||||
Returns:
|
||||
@ -187,7 +191,7 @@ get_formatter_info({formatter}, {bufnr}): conform.FormatterInfo *conform.get_for
|
||||
{bufnr} `nil|integer`
|
||||
|
||||
will_fallback_lsp({options}): boolean *conform.will_fallback_lsp*
|
||||
Check if the buffer will use LSP formatting when lsp_fallback = true
|
||||
Check if the buffer will use LSP formatting when lsp_format = "fallback"
|
||||
|
||||
Parameters:
|
||||
{options} `nil|table` Options passed to |vim.lsp.buf.format|
|
||||
@ -238,6 +242,7 @@ FORMATTERS *conform-formatter
|
||||
`crystal` - Format Crystal code.
|
||||
`csharpier` - The opinionated C# code formatter.
|
||||
`cue_fmt` - Format CUE files using `cue fmt` command.
|
||||
`d2` - D2 is a modern diagram scripting language that turns text to diagrams.
|
||||
`darker` - Run black only on changed lines.
|
||||
`dart_format` - Replace the whitespace in your program with formatting that
|
||||
follows Dart guidelines.
|
||||
@ -246,22 +251,28 @@ FORMATTERS *conform-formatter
|
||||
`dfmt` - Formatter for D source code.
|
||||
`djlint` - ✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks -
|
||||
Handlebars - GoLang.
|
||||
`docstrfmt` - reStructuredText formatter.
|
||||
`dprint` - Pluggable and configurable code formatting platform written in Rust.
|
||||
`easy-coding-standard` - ecs - Use Coding Standard with 0-knowledge of PHP-CS-
|
||||
Fixer and PHP_CodeSniffer.
|
||||
`efmt` - Erlang code formatter.
|
||||
`elm_format` - elm-format formats Elm source code according to a standard set of
|
||||
rules based on the official [Elm Style Guide](https://elm-
|
||||
lang.org/docs/style-guide).
|
||||
`erb_format` - Format ERB files with speed and precision.
|
||||
`erlfmt` - An automated code formatter for Erlang.
|
||||
`eslint_d` - Like ESLint, but faster.
|
||||
`fantomas` - F# source code formatter.
|
||||
`findent` - Indent, relabel and convert Fortran sources.
|
||||
`fish_indent` - Indent or otherwise prettify a piece of fish code.
|
||||
`fixjson` - JSON Fixer for Humans using (relaxed) JSON5.
|
||||
`fnlfmt` - A formatter for Fennel code.
|
||||
`forge_fmt` - Forge is a command-line tool that ships with Foundry. Forge tests,
|
||||
builds, and deploys your smart contracts.
|
||||
`format-queries` - Tree-sitter query formatter.
|
||||
`fourmolu` - A fork of ormolu that uses four space indentation and allows
|
||||
arbitrary configuration.
|
||||
`fprettify` - Auto-formatter for modern fortran source code.
|
||||
`gci` - GCI, a tool that controls Go package import order and makes it always
|
||||
deterministic.
|
||||
`gdformat` - A formatter for Godot's gdscript.
|
||||
@ -280,6 +291,7 @@ FORMATTERS *conform-formatter
|
||||
`google-java-format` - Reformats Java source code according to Google Java
|
||||
Style.
|
||||
`hcl` - A formatter for HCL files.
|
||||
`hindent` - Haskell pretty printer.
|
||||
`htmlbeautifier` - A normaliser/beautifier for HTML that also understands
|
||||
embedded Ruby. Ideal for tidying up Rails templates.
|
||||
`indent` - GNU Indent.
|
||||
@ -291,6 +303,7 @@ FORMATTERS *conform-formatter
|
||||
`jq` - Command-line JSON processor.
|
||||
`jsonnetfmt` - jsonnetfmt is a command line tool to format jsonnet files.
|
||||
`just` - Format Justfile.
|
||||
`kcl` - The KCL Format tool modifies the files according to the KCL code style.
|
||||
`ktfmt` - Reformats Kotlin source code to comply with the common community
|
||||
standard conventions.
|
||||
`ktlint` - An anti-bikeshedding Kotlin linter with built-in formatter.
|
||||
@ -298,6 +311,8 @@ FORMATTERS *conform-formatter
|
||||
included in major TeX distributions.
|
||||
`leptosfmt` - A formatter for the Leptos view! macro.
|
||||
`liquidsoap-prettier` - A binary to format Liquidsoap scripts
|
||||
`llf` - A LaTeX reformatter / beautifier.
|
||||
`lua-format` - Code formatter for Lua.
|
||||
`markdown-toc` - API and CLI for generating a markdown TOC (table of contents)
|
||||
for a README or any markdown files.
|
||||
`markdownlint` - A Node.js style checker and lint tool for Markdown/CommonMark
|
||||
@ -315,6 +330,8 @@ FORMATTERS *conform-formatter
|
||||
`nixfmt` - nixfmt is a formatter for Nix code, intended to apply a uniform
|
||||
style.
|
||||
`nixpkgs_fmt` - nixpkgs-fmt is a Nix code formatter for nixpkgs.
|
||||
`npm-groovy-lint` - Lint, format and auto-fix your Groovy / Jenkinsfile / Gradle
|
||||
files using command line.
|
||||
`ocamlformat` - Auto-formatter for OCaml code.
|
||||
`ocp-indent` - Automatic indentation of OCaml source files.
|
||||
`opa_fmt` - Format Rego files using `opa fmt` command.
|
||||
@ -339,9 +356,12 @@ FORMATTERS *conform-formatter
|
||||
`pretty-php` - The opinionated PHP code formatter.
|
||||
`puppet-lint` - Check that your Puppet manifests conform to the style guide.
|
||||
`purs-tidy` - A syntax tidy-upper for PureScript.
|
||||
`pyink` - A Python formatter, forked from Black with a few different formatting
|
||||
behaviors.
|
||||
`reorder-python-imports` - Rewrites source to reorder python imports
|
||||
`rescript-format` - The built-in ReScript formatter.
|
||||
`roc` - A fast, friendly, functional language.
|
||||
`rstfmt` - A formatter for reStructuredText.
|
||||
`rubocop` - Ruby static code analyzer and formatter, based on the community Ruby
|
||||
style guide.
|
||||
`rubyfmt` - Ruby Autoformatter! (Written in Rust)
|
||||
@ -372,6 +392,7 @@ FORMATTERS *conform-formatter
|
||||
`stylelint` - A mighty CSS linter that helps you avoid errors and enforce
|
||||
conventions.
|
||||
`styler` - R formatter and linter.
|
||||
`stylish-haskell` - Haskell code prettifier.
|
||||
`stylua` - An opinionated code formatter for Lua.
|
||||
`swift_format` - Swift formatter from apple. Requires building from source with
|
||||
`swift build`.
|
||||
@ -390,12 +411,12 @@ FORMATTERS *conform-formatter
|
||||
`trim_whitespace` - Trim whitespaces with awk.
|
||||
`twig-cs-fixer` - Automatically fix Twig Coding Standards issues
|
||||
`typos` - Source code spell checker
|
||||
`typstfmt` - Basic formatter for the Typst language with a future!
|
||||
`typstyle` - Beautiful and reliable typst code formatter.
|
||||
`uncrustify` - A source code beautifier for C, C++, C#, ObjectiveC, D, Java,
|
||||
Pawn and Vala.
|
||||
`usort` - Safe, minimal import sorting for Python projects.
|
||||
`verible` - The SystemVerilog formatter.
|
||||
`vsg` - Style guide enforcement for VHDL.
|
||||
`xmlformat` - xmlformatter is an Open Source Python package, which provides
|
||||
formatting of XML documents.
|
||||
`xmllint` - Despite the name, xmllint can be used to format XML files as well as
|
||||
|
||||
@ -24,7 +24,7 @@ vim.api.nvim_create_user_command("Format", function(args)
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_fallback = true, range = range })
|
||||
require("conform").format({ async = true, lsp_format = "fallback", range = range })
|
||||
end, { range = true })
|
||||
```
|
||||
|
||||
@ -53,7 +53,7 @@ require("conform").setup({
|
||||
return
|
||||
end
|
||||
-- ...additional logic...
|
||||
return { timeout_ms = 500, lsp_fallback = true }
|
||||
return { timeout_ms = 500, lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
|
||||
@ -65,7 +65,7 @@ require("conform").setup({
|
||||
return
|
||||
end
|
||||
-- ...additional logic...
|
||||
return { lsp_fallback = true }
|
||||
return { lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
```
|
||||
@ -83,7 +83,7 @@ require("conform").setup({
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return { timeout_ms = 500, lsp_fallback = true }
|
||||
return { timeout_ms = 500, lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
|
||||
@ -123,14 +123,14 @@ require("conform").setup({
|
||||
end
|
||||
end
|
||||
|
||||
return { timeout_ms = 200, lsp_fallback = true }, on_format
|
||||
return { timeout_ms = 200, lsp_format = "fallback" }, on_format
|
||||
end,
|
||||
|
||||
format_after_save = function(bufnr)
|
||||
if not slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
return { lsp_fallback = true }
|
||||
return { lsp_format = "fallback" }
|
||||
end,
|
||||
})
|
||||
```
|
||||
@ -149,7 +149,7 @@ return {
|
||||
-- Customize or remove this keymap to your liking
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "Format buffer",
|
||||
@ -164,7 +164,7 @@ return {
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
},
|
||||
-- Set up format-on-save
|
||||
format_on_save = { timeout_ms = 500, lsp_fallback = true },
|
||||
format_on_save = { timeout_ms = 500, lsp_format = "fallback" },
|
||||
-- Customize formatters
|
||||
formatters = {
|
||||
shfmt = {
|
||||
|
||||
Reference in New Issue
Block a user