refactor: complete overhaul
Complete overhaul of repo structure based on nvix. See https://github.com/niksingh710/nvix Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
ff2c59724a
commit
61feed4086
75 changed files with 2916 additions and 2314 deletions
56
plugins/lsp/conform.nix
Normal file
56
plugins/lsp/conform.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# formatter with lsp fallback
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
plugins.conform-nvim = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
default_format_opts.lsp_format = "prefer";
|
||||
notify_on_error = true;
|
||||
|
||||
format_on_save = ''
|
||||
function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
|
||||
if slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
|
||||
local function on_format(err)
|
||||
if err and err:match("timeout$") then
|
||||
slow_format_filetypes[vim.bo[bufnr].filetype] = true
|
||||
end
|
||||
end
|
||||
|
||||
return { timeout_ms = 200, lsp_fallback = true }, on_format
|
||||
end
|
||||
'';
|
||||
|
||||
format_after_save = ''
|
||||
function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
|
||||
if not slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
|
||||
return { lsp_fallback = true }
|
||||
end
|
||||
'';
|
||||
|
||||
formatters_by_ft = {
|
||||
"_" = [
|
||||
"squeeze_blanks"
|
||||
"trim_whitespace"
|
||||
"trim_newlines"
|
||||
];
|
||||
};
|
||||
|
||||
formatters.squeeze_blanks.command = lib.getExe' pkgs.coreutils "cat";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue