mirror of
https://github.com/Dichgrem/DCGOS.git
synced 2025-12-17 11:41:59 -05:00
Init:start-nix
This commit is contained in:
44
home/tui/nixvim/plugins/conform.nix
Executable file
44
home/tui/nixvim/plugins/conform.nix
Executable file
@@ -0,0 +1,44 @@
|
||||
{pkgs, ...}: {
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [
|
||||
stylua
|
||||
];
|
||||
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
notify_on_error = false;
|
||||
format_on_save = ''
|
||||
function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for lanuages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- lanuages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype]
|
||||
}
|
||||
end
|
||||
'';
|
||||
formatters_by_ft = {
|
||||
lua = ["stylua"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "";
|
||||
key = "<leader>f";
|
||||
action.__raw = ''
|
||||
function()
|
||||
require('conform').format { async = true, lsp_fallback = true }
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "[F]ormat buffer";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user