WIP: Groundwork for impermanence setup for nixos and home
This commit is contained in:
+35
-2
@@ -5,7 +5,6 @@
|
||||
programs.nixvim = {
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
formatters_by_ft = {
|
||||
lua = [ "stylua" ];
|
||||
@@ -13,6 +12,40 @@
|
||||
python = [ "black" ];
|
||||
rust = [ "rustfmt" ];
|
||||
rasi = [ "prettierd" ];
|
||||
c = [ "clang_format" ];
|
||||
cpp = [ "clang_format" ];
|
||||
};
|
||||
|
||||
formatters.clang_format = {
|
||||
# If the file has a project .clang-format (walking up from the
|
||||
# file itself, not nvim's cwd), use it - this is how a real
|
||||
# kernel checkout, or any other C/C++ project's own style,
|
||||
# gets respected automatically. Otherwise fall back to an
|
||||
# inline approximation of kernel style instead of plain LLVM,
|
||||
# since that's the sane default for one-off C files.
|
||||
prepend_args = {
|
||||
__raw = ''
|
||||
function(self, ctx)
|
||||
local found = vim.fs.find(
|
||||
{ ".clang-format", "_clang-format" },
|
||||
{ path = ctx.filename, upward = true }
|
||||
)[1]
|
||||
if found then
|
||||
return { "-style=file" }
|
||||
end
|
||||
return {
|
||||
"-style={BasedOnStyle: LLVM, IndentWidth: 8, UseTab: Always, "
|
||||
.. "TabWidth: 8, BreakBeforeBraces: Linux, ColumnLimit: 80, "
|
||||
.. "IndentCaseLabels: false, PointerAlignment: Right, "
|
||||
.. "DerivePointerAlignment: false, SpaceBeforeParens: ControlStatements, "
|
||||
.. "SpacesInParentheses: false, SpaceAfterCStyleCast: false, "
|
||||
.. "AllowShortIfStatementsOnASingleLine: false, AllowShortBlocksOnASingleLine: false, "
|
||||
.. "AllowShortFunctionsOnASingleLine: None, AllowShortLoopsOnASingleLine: false, "
|
||||
.. "ReflowComments: false}"
|
||||
}
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
format_on_save = {
|
||||
@@ -21,7 +54,6 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Install formatters
|
||||
extraPackages = with pkgs; [
|
||||
stylua
|
||||
@@ -29,6 +61,7 @@
|
||||
black
|
||||
rustfmt
|
||||
prettierd
|
||||
clang-tools # provides clang-format
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user