feat(jj): add clang_format config
Clang format is disabled by default since `clang-tools` is huge, but we should still configure it if it's enabled.
This commit is contained in:
parent
e962441ce1
commit
99350606a4
1 changed files with 26 additions and 11 deletions
|
@ -11,19 +11,34 @@ let
|
||||||
) config.programs.nixvim.plugins.conform-nvim.settings.formatters;
|
) config.programs.nixvim.plugins.conform-nvim.settings.formatters;
|
||||||
jjFormatters =
|
jjFormatters =
|
||||||
let
|
let
|
||||||
ext = extension: "glob:'**/*.${extension}'";
|
ext_to_glob = ext: "glob:'**/*.${ext}'";
|
||||||
|
exts = builtins.map ext_to_glob;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fish = cmd: {
|
fish = cmd: {
|
||||||
command = [ cmd ];
|
command = [ cmd ];
|
||||||
patterns = [ (ext "fish") ];
|
patterns = exts [ "fish" ];
|
||||||
|
};
|
||||||
|
clang_format = cmd: {
|
||||||
|
command = [
|
||||||
|
cmd
|
||||||
|
"--assume-filename=$path"
|
||||||
|
];
|
||||||
|
patterns = exts [
|
||||||
|
"c"
|
||||||
|
"cc"
|
||||||
|
"cpp"
|
||||||
|
"h"
|
||||||
|
"hh"
|
||||||
|
"hpp"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
nixfmt = cmd: {
|
nixfmt = cmd: {
|
||||||
command = [
|
command = [
|
||||||
cmd
|
cmd
|
||||||
"--filename=$path"
|
"--filename=$path"
|
||||||
];
|
];
|
||||||
patterns = [ (ext "nix") ];
|
patterns = exts [ "nix" ];
|
||||||
};
|
};
|
||||||
shfmt = cmd: {
|
shfmt = cmd: {
|
||||||
command = [
|
command = [
|
||||||
|
@ -32,9 +47,9 @@ let
|
||||||
"$path"
|
"$path"
|
||||||
"-"
|
"-"
|
||||||
];
|
];
|
||||||
patterns = [
|
patterns = exts [
|
||||||
(ext "sh")
|
"sh"
|
||||||
(ext "bash")
|
"bash"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
stylua = cmd: {
|
stylua = cmd: {
|
||||||
|
@ -43,7 +58,7 @@ let
|
||||||
"--stdin-filepath=$path"
|
"--stdin-filepath=$path"
|
||||||
"-"
|
"-"
|
||||||
];
|
];
|
||||||
patterns = [ (ext "lua") ];
|
patterns = exts [ "lua" ];
|
||||||
};
|
};
|
||||||
taplo = cmd: {
|
taplo = cmd: {
|
||||||
command = [
|
command = [
|
||||||
|
@ -51,16 +66,16 @@ let
|
||||||
"--stdin-filepath=$path"
|
"--stdin-filepath=$path"
|
||||||
"-"
|
"-"
|
||||||
];
|
];
|
||||||
patterns = [ (ext "toml") ];
|
patterns = exts [ "toml" ];
|
||||||
};
|
};
|
||||||
yamlfmt = cmd: {
|
yamlfmt = cmd: {
|
||||||
command = [
|
command = [
|
||||||
cmd
|
cmd
|
||||||
"-in"
|
"-in"
|
||||||
];
|
];
|
||||||
patterns = [
|
patterns = exts [
|
||||||
(ext "yaml")
|
"yaml"
|
||||||
(ext "yml")
|
"yml"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue