some formatting

This commit is contained in:
gwg313 2024-12-02 18:12:36 -05:00
parent c91faa5aaf
commit 57c3bb3e61
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
21 changed files with 472 additions and 360 deletions

View file

@ -1,123 +1,126 @@
{...}: {
{ ... }:
{
programs.nixvim = {
plugins.bufferline = let
mouse = {
right =
# Lua
"'vertical sbuffer %d'";
close =
# Lua
''
function(bufnum)
require("mini.bufremove").delete(bufnum)
end
'';
};
in {
enable = true;
settings = {
options = {
mode = "buffers";
always_show_bufferline = true;
buffer_close_icon = "󰅖";
close_command.__raw = mouse.close;
close_icon = "";
diagnostics = "nvim_lsp";
diagnostics_indicator =
plugins.bufferline =
let
mouse = {
right =
# Lua
"'vertical sbuffer %d'";
close =
# Lua
''
function(count, level, diagnostics_dict, context)
local s = ""
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and " "
or (e == "warning" and " " or "" )
if(sym ~= "") then
s = s .. " " .. n .. sym
end
end
return s
function(bufnum)
require("mini.bufremove").delete(bufnum)
end
'';
# Will make sure all names in bufferline are unique
enforce_regular_tabs = false;
};
in
{
enable = true;
groups = {
options = {
toggle_hidden_on_enter = true;
settings = {
options = {
mode = "buffers";
always_show_bufferline = true;
buffer_close_icon = "󰅖";
close_command.__raw = mouse.close;
close_icon = "";
diagnostics = "nvim_lsp";
diagnostics_indicator =
# Lua
''
function(count, level, diagnostics_dict, context)
local s = ""
for e, n in pairs(diagnostics_dict) do
local sym = e == "error" and " "
or (e == "warning" and " " or "" )
if(sym ~= "") then
s = s .. " " .. n .. sym
end
end
return s
end
'';
# Will make sure all names in bufferline are unique
enforce_regular_tabs = false;
groups = {
options = {
toggle_hidden_on_enter = true;
};
items = [
{
name = "Tests";
highlight = {
underline = true;
fg = "#a6da95";
sp = "#494d64";
};
priority = 2;
# icon = "";
matcher.__raw = ''
function(buf)
return buf.name:match('%test') or buf.name:match('%.spec')
end
'';
}
{
name = "Docs";
highlight = {
undercurl = true;
fg = "#ffffff";
sp = "#494d64";
};
auto_close = false;
matcher.__raw = ''
function(buf)
return buf.name:match('%.md') or buf.name:match('%.txt')
end
'';
}
];
};
items = [
indicator = {
style = "icon";
icon = "";
};
left_trunc_marker = "";
max_name_length = 18;
max_prefix_length = 15;
modified_icon = "";
numbers.__raw = ''
function(opts)
return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal))
end
'';
persist_buffer_sort = true;
right_mouse_command.__raw = mouse.right;
right_trunc_marker = "";
separator_style = "slant";
show_buffer_close_icons = true;
show_buffer_icons = true;
show_close_icon = true;
show_tab_indicators = true;
sort_by = "extension";
tab_size = 18;
offsets = [
{
name = "Tests";
highlight = {
underline = true;
fg = "#a6da95";
sp = "#494d64";
};
priority = 2;
# icon = "";
matcher.__raw = ''
function(buf)
return buf.name:match('%test') or buf.name:match('%.spec')
end
'';
}
{
name = "Docs";
highlight = {
undercurl = true;
fg = "#ffffff";
sp = "#494d64";
};
auto_close = false;
matcher.__raw = ''
function(buf)
return buf.name:match('%.md') or buf.name:match('%.txt')
end
'';
filetype = "neo-tree";
text = "File Explorer";
text_align = "center";
highlight = "Directory";
}
];
};
indicator = {
style = "icon";
icon = "";
};
left_trunc_marker = "";
max_name_length = 18;
max_prefix_length = 15;
modified_icon = "";
numbers.__raw = ''
function(opts)
return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal))
end
'';
persist_buffer_sort = true;
right_mouse_command.__raw = mouse.right;
right_trunc_marker = "";
separator_style = "slant";
show_buffer_close_icons = true;
show_buffer_icons = true;
show_close_icon = true;
show_tab_indicators = true;
sort_by = "extension";
tab_size = 18;
offsets = [
{
filetype = "neo-tree";
text = "File Explorer";
text_align = "center";
highlight = "Directory";
}
];
};
};
};
keymaps = [
{

View file

@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
programs.nixvim = {
extraConfigLuaPre =
# lua
@ -10,22 +11,22 @@
local slow_format_filetypes = {}
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
if args.bang then
-- FormatDisable! will disable formatting just for this buffer
vim.b.disable_autoformat = true
else
vim.g.disable_autoformat = true
end
end, {
desc = "Disable autoformat-on-save",
bang = true,
})
desc = "Disable autoformat-on-save",
bang = true,
})
vim.api.nvim_create_user_command("FormatEnable", function()
vim.b.disable_autoformat = false
vim.g.disable_autoformat = false
end, {
desc = "Re-enable autoformat-on-save",
})
desc = "Re-enable autoformat-on-save",
})
vim.api.nvim_create_user_command("FormatToggle", function(args)
if args.bang then
-- Toggle formatting for current buffer
@ -35,9 +36,9 @@
vim.g.disable_autoformat = not vim.g.disable_autoformat
end
end, {
desc = "Toggle autoformat-on-save",
bang = true,
})
desc = "Toggle autoformat-on-save",
bang = true,
})
'';
plugins = {
@ -63,7 +64,7 @@
end
return { timeout_ms = 200, lsp_fallback = true }, on_format
end
end
'';
format_after_save =
@ -97,40 +98,40 @@
"shellharden"
"shfmt"
];
bicep = ["bicep"];
c = ["clang_format"];
cmake = ["cmake-format"];
cpp = ["clang_format"];
cs = ["csharpier"];
css = ["stylelint"];
fish = ["fish_indent"];
fsharp = ["fantomas"];
go = ["gofmt"];
haskell = ["ormolu"];
bicep = [ "bicep" ];
c = [ "clang_format" ];
cmake = [ "cmake-format" ];
cpp = [ "clang_format" ];
cs = [ "csharpier" ];
css = [ "stylelint" ];
fish = [ "fish_indent" ];
fsharp = [ "fantomas" ];
go = [ "gofmt" ];
haskell = [ "ormolu" ];
javascript = [
[
"prettierd"
"prettier"
]
];
json = ["jq"];
lua = ["stylua"];
markdown = ["deno_fmt"];
nix = ["nixfmt"];
json = [ "jq" ];
lua = [ "stylua" ];
markdown = [ "deno_fmt" ];
nix = [ "nixfmt" ];
python = [
"isort"
"black"
];
rust = ["rustfmt"];
rust = [ "rustfmt" ];
sh = [
"shellcheck"
"shellharden"
"shfmt"
];
sql = ["sqlfluff"];
swift = ["swift_format"];
terraform = ["terraform_fmt"];
toml = ["taplo"];
sql = [ "sqlfluff" ];
swift = [ "swift_format" ];
terraform = [ "terraform_fmt" ];
toml = [ "taplo" ];
typescript = [
[
"prettierd"
@ -141,8 +142,8 @@
"xmlformat"
"xmllint"
];
yaml = ["yamlfmt"];
zig = ["zigfmt"];
yaml = [ "yamlfmt" ];
zig = [ "zigfmt" ];
"_" = [
"squeeze_blanks"
"trim_whitespace"

View file

@ -1,11 +1,12 @@
{...}: {
{ ... }:
{
programs.nixvim = {
plugins = {
mini = {
enable = true;
modules = {
bufremove = {};
bufremove = { };
};
};
};
@ -44,7 +45,7 @@
local get_listed_bufs = function()
return vim.tbl_filter(function(bufnr)
return vim.api.nvim_buf_get_option(bufnr, "buflisted")
return vim.api.nvim_buf_get_option(bufnr, "buflisted")
end, vim.api.nvim_list_bufs())
end

View file

@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
programs.nixvim = {
plugins.noice = {
enable = true;
@ -51,7 +52,7 @@
pattern = "^:%s*he?l?p?%s+";
icon = "󰋖";
};
input = {};
input = { };
};
};
@ -105,9 +106,9 @@
local servers = { 'jdtls' }
for index, value in ipairs(servers) do
if value == client then
return true
end
if value == client then
return true
end
end
end
'';

View file

@ -1,6 +1,7 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs.nixvim = {
extraPlugins = [pkgs.vimPlugins.precognition-nvim];
extraPlugins = [ pkgs.vimPlugins.precognition-nvim ];
keymaps = [
{
@ -9,9 +10,9 @@
action.__raw = ''
function()
if require("precognition").toggle() then
vim.notify("precognition on")
vim.notify("precognition on")
else
vim.notify("precognition off")
vim.notify("precognition off")
end
end
'';