This commit is contained in:
gwg313 2024-11-25 11:57:38 -05:00
parent 63bbeaca3b
commit ce01469113
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
37 changed files with 1621 additions and 384 deletions

View file

@ -6,6 +6,7 @@
}: { }: {
# Enable sound with pipewire. # Enable sound with pipewire.
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;
hardware.alsa.enablePersistence = true;
security.rtkit.enable = true; security.rtkit.enable = true;
services.pipewire = { services.pipewire = {
enable = true; enable = true;

View file

@ -12,19 +12,19 @@
networking.wireless.enable = true; networking.wireless.enable = true;
environment.systemPackages = with pkgs; [wpa_supplicant_gui]; environment.systemPackages = with pkgs; [wpa_supplicant_gui];
networking.wireless.userControlled.enable = true; networking.wireless.userControlled.enable = true;
networking.wireless.environmentFile = config.sops.secrets."wireless.env".path; networking.wireless.secretsFile = config.sops.secrets."wireless.env".path;
networking.wireless.networks = { networking.wireless.networks = {
"@home_uuid@" = { "Tycho Station" = {
psk = "@home_psk@"; pskRaw = "ext:home_psk";
priority = 99; priority = 99;
}; };
"@school_uuid@" = { "CU-Wireless" = {
auth = '' auth = ''
key_mgmt=WPA-EAP key_mgmt=WPA-EAP
eap=PEAP eap=PEAP
phase2="auth=MSCHAPV2" phase2="auth=MSCHAPV2"
identity="@school_identity@" identity="glengoodwin"
password="@school_password@" password=ext:school_password
''; '';
priority = 89; priority = 89;
}; };
@ -34,8 +34,8 @@
key_mgmt=WPA-EAP key_mgmt=WPA-EAP
eap=PEAP eap=PEAP
phase2="auth=MSCHAPV2" phase2="auth=MSCHAPV2"
identity="@eduroam_identity@" identity="ext:eduroam_identity"
password="@school_password@" password="ext:school_password"
''; '';
priority = 79; priority = 79;
}; };

View file

@ -1,8 +1,9 @@
{pkgs, ...}: { {pkgs, ...}: {
stylix = { stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; # base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml";
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
# image = ./wallpaper.jpg; # image = ./wallpaper.jpg;
image = ../../wallpapers/nix-black-4k.png; image = ../../wallpapers/nixos-wallpaper-catppuccin-latte.png;
#polarity = "dark"; #polarity = "dark";
autoEnable = true; autoEnable = true;
enable = true; enable = true;

792
flake.lock generated

File diff suppressed because it is too large Load diff

View file

@ -65,8 +65,8 @@
}; };
stylix = { stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
image = ../../wallpapers/nix-black-4k.png; image = ../../wallpapers/nixos-wallpaper-catppuccin-latte.png;
autoEnable = true; autoEnable = true;
enable = true; enable = true;

View file

@ -65,8 +65,9 @@
}; };
stylix = { stylix = {
base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; # base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml";
image = ../../wallpapers/nix-black-4k.png; base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml";
image = ../../wallpapers/nixos-wallpaper-catppuccin-latte.png;
# polarity = "dark"; # polarity = "dark";
autoEnable = true; autoEnable = true;
enable = true; enable = true;

View file

@ -20,9 +20,12 @@
#sublime-music # A modern and feature-rich music player with a clean user interface and advanced playback options. #sublime-music # A modern and feature-rich music player with a clean user interface and advanced playback options.
thunderbird # Mozilla Thunderbird, a powerful and customizable email client with integrated calendaring and chat features. thunderbird # Mozilla Thunderbird, a powerful and customizable email client with integrated calendaring and chat features.
wireshark # Open-source network protocol analyzer for real-time packet inspection and analysis. wireshark # Open-source network protocol analyzer for real-time packet inspection and analysis.
inkscape
nicotine-plus nicotine-plus
anki anki
obsidian obsidian
chromium
vlc vlc
zotero
]; ];
} }

View file

@ -16,6 +16,16 @@
]; ];
command = "setlocal spell spelllang=en_us"; command = "setlocal spell spelllang=en_us";
} }
{
event = "FileType";
pattern = [
"tex"
"latex"
"markdown"
];
command = "setlocal wrap";
}
]; ];
}; };
} }

View file

@ -3,10 +3,10 @@
plugins.bufferline = let plugins.bufferline = let
mouse = { mouse = {
right = right =
# lua # Lua
"'vertical sbuffer %d'"; "'vertical sbuffer %d'";
close = close =
# lua # Lua
'' ''
function(bufnum) function(bufnum)
require("mini.bufremove").delete(bufnum) require("mini.bufremove").delete(bufnum)
@ -25,7 +25,7 @@
close_icon = ""; close_icon = "";
diagnostics = "nvim_lsp"; diagnostics = "nvim_lsp";
diagnostics_indicator = diagnostics_indicator =
# lua # Lua
'' ''
function(count, level, diagnostics_dict, context) function(count, level, diagnostics_dict, context)
local s = "" local s = ""
@ -57,13 +57,11 @@
}; };
priority = 2; priority = 2;
# icon = ""; # icon = "";
matcher.__raw = matcher.__raw = ''
# lua function(buf)
'' return buf.name:match('%test') or buf.name:match('%.spec')
function(buf) end
return buf.name:match('%test') or buf.name:match('%.spec') '';
end
'';
} }
{ {
name = "Docs"; name = "Docs";
@ -73,13 +71,11 @@
sp = "#494d64"; sp = "#494d64";
}; };
auto_close = false; auto_close = false;
matcher.__raw = matcher.__raw = ''
# lua function(buf)
'' return buf.name:match('%.md') or buf.name:match('%.txt')
function(buf) end
return buf.name:match('%.md') or buf.name:match('%.txt') '';
end
'';
} }
]; ];
}; };
@ -94,13 +90,11 @@
max_prefix_length = 15; max_prefix_length = 15;
modified_icon = ""; modified_icon = "";
numbers.__raw = numbers.__raw = ''
# lua function(opts)
'' return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal))
function(opts) end
return string.format('%s·%s', opts.raise(opts.id), opts.lower(opts.ordinal)) '';
end
'';
persist_buffer_sort = true; persist_buffer_sort = true;
right_mouse_command.__raw = mouse.right; right_mouse_command.__raw = mouse.right;
@ -122,61 +116,6 @@
} }
]; ];
}; };
# NOTE: fixes colorscheme with transparent_background
# and better contrast selected tabs
highlights = let
commonBgColor = "#363a4f";
commonFgColor = "#1e2030";
commonSelectedAttrs = {
bg = commonBgColor;
};
# Define a set with common selected attributes
selectedAttrsSet = builtins.listToAttrs (
map
(name: {
inherit name;
value = commonSelectedAttrs;
})
[
# "separator_selected" # Handled uniquely
"buffer_selected"
"tab_selected"
"numbers_selected"
"close_button_selected"
"duplicate_selected"
"modified_selected"
"info_selected"
"warning_selected"
"error_selected"
"hint_selected"
"diagnostic_selected"
"info_diagnostic_selected"
"warning_diagnostic_selected"
"error_diagnostic_selected"
"hint_diagnostic_selected"
]
);
in
# Merge the common selected attributes with the unique attributes
selectedAttrsSet
// {
fill = {
bg = commonFgColor;
};
separator = {
fg = commonFgColor;
};
separator_visible = {
fg = commonFgColor;
};
separator_selected = {
bg = commonBgColor;
fg = commonFgColor;
};
};
}; };
}; };
@ -184,46 +123,41 @@
{ {
mode = "n"; mode = "n";
key = "<leader>bP"; key = "<leader>bP";
action = ":BufferLineTogglePin<cr>"; action = "<cmd>BufferLineTogglePin<cr>";
options = { options = {
desc = "Pin buffer toggle"; desc = "Pin buffer toggle";
silent = true;
}; };
} }
{ {
mode = "n"; mode = "n";
key = "<leader>bp"; key = "<leader>bp";
action = ":BufferLinePick<cr>"; action = "<cmd>BufferLinePick<cr>";
options = { options = {
desc = "Pick Buffer"; desc = "Pick Buffer";
silent = true;
}; };
} }
{ {
mode = "n"; mode = "n";
key = "<leader>bsd"; key = "<leader>bsd";
action = ":BufferLineSortByDirectory<cr>"; action = "<cmd>BufferLineSortByDirectory<cr>";
options = { options = {
desc = "Sort By Directory"; desc = "Sort By Directory";
silent = true;
}; };
} }
{ {
mode = "n"; mode = "n";
key = "<leader>bse"; key = "<leader>bse";
action = ":BufferLineSortByExtension<cr>"; action = "<cmd>BufferLineSortByExtension<cr>";
options = { options = {
desc = "Sort By Extension"; desc = "Sort By Extension";
silent = true;
}; };
} }
{ {
mode = "n"; mode = "n";
key = "<leader>bsr"; key = "<leader>bsr";
action = ":BufferLineSortByRelativeDirectory<cr>"; action = "<cmd>BufferLineSortByRelativeDirectory<cr>";
options = { options = {
desc = "Sort By Relative Directory"; desc = "Sort By Relative Directory";
silent = true;
}; };
} }
]; ];

View file

@ -8,7 +8,8 @@ _: {
percentage = 0.25; percentage = 0.25;
}; };
flavour = "macchiato"; # flavour = "macchiato";
flavour = "latte";
integrations = { integrations = {
aerial = true; aerial = true;

View file

@ -43,44 +43,45 @@
plugins = { plugins = {
conform-nvim = { conform-nvim = {
enable = true; enable = true;
settings = {
formatOnSave = format_on_save =
# lua # lua
'' ''
function(bufnr) function(bufnr)
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return 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
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 =
# lua
''
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 end
'';
return { timeout_ms = 200, lsp_fallback = true }, on_format };
end
'';
formatAfterSave =
# lua
''
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
'';
# NOTE: # NOTE:
# Conform will run multiple formatters sequentially # Conform will run multiple formatters sequentially

View file

@ -14,16 +14,22 @@ _: {
./git-conflict.nix ./git-conflict.nix
./gitsigns.nix ./gitsigns.nix
./harpoon.nix ./harpoon.nix
# ./haskell-scope-highlighting.nix
./illuminate.nix ./illuminate.nix
# ./obsidian.nix
./indent-blankline.nix ./indent-blankline.nix
./lightbulb.nix ./lightbulb.nix
./lualine.nix ./lualine.nix
./luasnip.nix ./luasnip.nix
./lean.nix ./lean.nix
./lsp.nix ./lsp.nix
./marks.nix
./mark-radar.nix
./mini.nix
./mini-bufremove.nix ./mini-bufremove.nix
./mini-surround.nix ./mini-surround.nix
./mini-indentscope.nix ./mini-indentscope.nix
./glow.nix
./navic.nix ./navic.nix
./nix.nix ./nix.nix
./noice.nix ./noice.nix
@ -31,6 +37,7 @@ _: {
./precognition.nix ./precognition.nix
./spectre.nix ./spectre.nix
./refactoring.nix ./refactoring.nix
./render-markdown.nix
./telescope.nix ./telescope.nix
./todo-comments.nix ./todo-comments.nix
./toggleterm.nix ./toggleterm.nix

View file

@ -0,0 +1,41 @@
{pkgs, ...}: let
stylePkg = pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "glamour";
rev = "f410083af1e9b2418bcd73dbbbc987461d4aa292";
hash = "sha256-a7yR19KcxIS4UPhuhB+X0B+s8D5eytw0/EB0X4z46kA=";
};
in {
programs.nixvim = {
plugins = {
glow = {
enable = true;
settings = {
border = "single";
style = "${stylePkg.outPath}/themes/catppuccin-latte.json";
};
};
which-key.settings.spec = [
{
__unkeyed = "<leader>p";
mode = "n";
group = "Preview";
icon = " ";
}
];
};
keymaps = [
{
mode = "n";
key = "<leader>pg";
action = "<cmd>Glow<CR>";
options = {
desc = "Glow (Markdown)";
};
}
];
};
}

View file

@ -0,0 +1,7 @@
{...}: {
programs.nixvim = {
plugins.haskell-scope-highlighting = {
enable = true;
};
};
}

View file

@ -15,7 +15,7 @@
fromLua = [{paths = [../snippets];}]; fromLua = [{paths = [../snippets];}];
}; };
extraFiles = { extraFiles = {
"personal/luasnip-helper-funcs.lua".text = '' "lua/personal/luasnip-helper-funcs.lua".text = ''
local M = {} local M = {}
local ls = require("luasnip") local ls = require("luasnip")

View file

@ -0,0 +1,7 @@
{...}: {
programs.nixvim = {
plugins.mark-radar = {
enable = true;
};
};
}

View file

@ -0,0 +1,7 @@
{...}: {
programs.nixvim = {
plugins.marks = {
enable = true;
};
};
}

View file

@ -0,0 +1,18 @@
{...}: {
programs.nixvim = {
plugins.mini = {
enable = true;
mockDevIcons = true;
modules = {
ai = {};
align = {};
basics = {};
bracketed = {};
git = {};
icons = {};
pairs = {};
};
};
};
}

View file

@ -0,0 +1,7 @@
{...}: {
programs.nixvim = {
plugins.obsidian = {
enable = true;
};
};
}

View file

@ -5,7 +5,7 @@
keymaps = [ keymaps = [
{ {
mode = "n"; mode = "n";
key = "<leader>uP"; key = "<leader>vp";
action.__raw = '' action.__raw = ''
function() function()
if require("precognition").toggle() then if require("precognition").toggle() then

View file

@ -0,0 +1,9 @@
{pkgs, ...}: {
programs.nixvim = {
plugins.render-markdown = {
enable = true;
};
};
home.packages = with pkgs; [python312Packages.pylatexenc];
}

View file

@ -7,7 +7,12 @@
settings = { settings = {
indent.enable = true; indent.enable = true;
highlight.enable = true; highlight = {
enable = true;
disable = [
"latex"
];
};
incremental_selection.enable = true; incremental_selection.enable = true;
}; };
}; };

View file

@ -3,7 +3,7 @@
plugins.vimtex = { plugins.vimtex = {
enable = true; enable = true;
settings = { settings = {
compiler_method = "latexrun"; compiler_method = "pdflatex";
toc_config = { toc_config = {
split_pos = "vert topleft"; split_pos = "vert topleft";
split_width = 40; split_width = 40;

View file

@ -0,0 +1,92 @@
local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual
-- Math context detection
local tex = {}
tex.in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end
tex.in_text = function()
return not tex.in_mathzone()
end
-- Return snippet tables
return {
-- LEFT/RIGHT PARENTHESES
s(
{ trig = "([^%a])l%(", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\left(<>\\right)", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- LEFT/RIGHT SQUARE BRACES
s(
{ trig = "([^%a])l%[", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\left[<>\\right]", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- LEFT/RIGHT CURLY BRACES
s(
{ trig = "([^%a])l%{", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\left\\{<>\\right\\}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- BIG PARENTHESES
s(
{ trig = "([^%a])b%(", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\big(<>\\big)", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- BIG SQUARE BRACES
s(
{ trig = "([^%a])b%[", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\big[<>\\big]", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- BIG CURLY BRACES
s(
{ trig = "([^%a])b%{", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\big\\{<>\\big\\}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- ESCAPED CURLY BRACES
s(
{ trig = "([^%a])\\%{", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
fmta("<>\\{<>\\}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- LATEX QUOTATION MARK
s(
{ trig = "``", snippetType = "autosnippet" },
fmta("``<>''", {
d(1, get_visual),
})
),
}

View file

@ -0,0 +1,221 @@
local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual
-- Math context detection
local tex = {}
tex.in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end
tex.in_text = function()
return not tex.in_mathzone()
end
local line_begin = require("luasnip.extras.expand_conditions").line_begin
-- Return snippet tables
return {
-- GENERIC ENVIRONMENT
s(
{ trig = "new", snippetType = "autosnippet" },
fmta(
[[
\begin{<>}
<>
\end{<>}
]],
{
i(1),
d(2, get_visual),
rep(1),
}
),
{ condition = line_begin }
),
s(
{ trig = "def", snippetType = "autosnippet" },
fmta(
[[
\begin{definition}[<>]
<>
\end{definition}
]],
{
i(1),
d(2, get_visual),
}
),
{ condition = line_begin }
),
-- ENVIRONMENT WITH ONE EXTRA ARGUMENT
s(
{ trig = "n2", snippetType = "autosnippet" },
fmta(
[[
\begin{<>}{<>}
<>
\end{<>}
]],
{
i(1),
i(2),
d(3, get_visual),
rep(1),
}
),
{ condition = line_begin }
),
-- ENVIRONMENT WITH TWO EXTRA ARGUMENTS
s(
{ trig = "n3", snippetType = "autosnippet" },
fmta(
[[
\begin{<>}{<>}{<>}
<>
\end{<>}
]],
{
i(1),
i(2),
i(3),
d(4, get_visual),
rep(1),
}
),
{ condition = line_begin }
),
-- TOPIC ENVIRONMENT (my custom tcbtheorem environment)
s(
{ trig = "nt", snippetType = "autosnippet" },
fmta(
[[
\begin{topic}{<>}{<>}
<>
\end{topic}
]],
{
i(1),
i(2),
d(3, get_visual),
}
),
{ condition = line_begin }
),
-- EQUATION
s(
{ trig = "nn", snippetType = "autosnippet" },
fmta(
[[
\begin{equation*}
<>
\end{equation*}
]],
{
i(1),
}
),
{ condition = line_begin }
),
-- SPLIT EQUATION
s(
{ trig = "ss", snippetType = "autosnippet" },
fmta(
[[
\begin{equation*}
\begin{split}
<>
\end{split}
\end{equation*}
]],
{
d(1, get_visual),
}
),
{ condition = line_begin }
),
-- ALIGN
s(
{ trig = "all", snippetType = "autosnippet" },
fmta(
[[
\begin{align*}
<>
\end{align*}
]],
{
i(1),
}
),
{ condition = line_begin }
),
-- ITEMIZE
s(
{ trig = "itt", snippetType = "autosnippet" },
fmta(
[[
\begin{itemize}
\item <>
\end{itemize}
]],
{
i(0),
}
),
{ condition = line_begin }
),
-- ENUMERATE
s(
{ trig = "enn", snippetType = "autosnippet" },
fmta(
[[
\begin{enumerate}
\item <>
\end{enumerate}
]],
{
i(0),
}
)
),
-- INLINE MATH
s(
{ trig = "([^%l])mm", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>$<>$", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- INLINE MATH ON NEW LINE
s(
{ trig = "^mm", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("$<>$", {
i(1),
})
),
-- FIGURE
s(
{ trig = "fig" },
fmta(
[[
\begin{figure}[htb!]
\centering
\includegraphics[width=<>\linewidth]{<>}
\caption{<>}
\label{fig:<>}
\end{figure}
]],
{
i(1),
i(2),
i(3),
i(4),
}
),
{ condition = line_begin }
),
}

View file

@ -0,0 +1,106 @@
local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual
-- A logical OR of `line_begin` and the regTrig '[^%a]trig'
function line_begin_or_non_letter(line_to_cursor, matched_trigger)
local line_begin = line_to_cursor:sub(1, -(#matched_trigger + 1)):match("^%s*$")
local non_letter = line_to_cursor:sub(-(#matched_trigger + 1), -(#matched_trigger + 1)):match("[^%a]")
return line_begin or non_letter
end
-- Math context detection
local tex = {}
tex.in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end
tex.in_text = function()
return not tex.in_mathzone()
end
local line_begin = function(line_to_cursor, matched_trigger)
-- +1 because `string.sub("abcd", 1, -2)` -> abc
return line_to_cursor:sub(1, -(#matched_trigger + 1)):match("^%s*$")
end
-- Return snippet tables
return {
-- TYPEWRITER i.e. \texttt
s(
{ trig = "([^%a])tt", regTrig = true, wordTrig = false, snippetType = "autosnippet", priority = 2000 },
fmta("<>\\texttt{<>}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
}),
{ condition = tex.in_text }
),
-- ITALIC i.e. \textit
s(
{ trig = "([^%a])tii", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\textit{<>}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- BOLD i.e. \textbf
s(
{ trig = "tbb", snippetType = "autosnippet" },
fmta("\\textbf{<>}", {
d(1, get_visual),
})
),
-- MATH ROMAN i.e. \mathrm
s(
{ trig = "([^%a])rmm", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\mathrm{<>}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- MATH CALIGRAPHY i.e. \mathcal
s(
{ trig = "([^%a])mcc", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\mathcal{<>}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- MATH BOLDFACE i.e. \mathbf
s(
{ trig = "([^%a])mbf", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\mathbf{<>}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- MATH BLACKBOARD i.e. \mathbb
s(
{ trig = "([^%a])mbb", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\mathbb{<>}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
})
),
-- REGULAR TEXT i.e. \text (in math environments)
s(
{ trig = "([^%a])tee", regTrig = true, wordTrig = false, snippetType = "autosnippet" },
fmta("<>\\text{<>}", {
f(function(_, snip)
return snip.captures[1]
end),
d(1, get_visual),
}),
{ condition = tex.in_mathzone }
),
}

View file

@ -0,0 +1,19 @@
local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual
local line_begin = require("luasnip.extras.expand_conditions").line_begin
-- Return snippet tables
return {
-- tex.sprint
s(
{ trig = "tpp", snippetType = "autosnippet" },
fmta(
[[
tex.sprint(<>)
]],
{
d(1, get_visual),
}
)
),
}

View file

@ -1,8 +1,12 @@
local helpers = require("personal.luasnip-helper-funcs") local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual local get_visual = helpers.get_visual
local ls = require("luasnip")
local sn = ls.snippet_node
local t = ls.text_node
local r = ls.restore_node
-- Math context detection -- Math context detection
local tex = {} local tex = {}
-- local function in_mathzone() return vim.api.nvim_eval('vimtex#syntax#in_mathzone()') == 1 end
tex.in_mathzone = function() tex.in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1 return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end end
@ -10,8 +14,31 @@ tex.in_text = function()
return not tex.in_mathzone() return not tex.in_mathzone()
end end
tex.generate_matrix = function(args, snip)
local rows = tonumber(snip.captures[2])
local cols = tonumber(snip.captures[3])
local nodes = {}
local ins_indx = 1
for j = 1, rows do
table.insert(nodes, r(ins_indx, tostring(j) .. "x1", i(1)))
ins_indx = ins_indx + 1
for k = 2, cols do
table.insert(nodes, t(" & "))
table.insert(nodes, r(ins_indx, tostring(j) .. "x" .. tostring(k), i(1)))
ins_indx = ins_indx + 1
end
table.insert(nodes, t({ "\\\\", "" }))
end
-- fix last node.
nodes[#nodes] = t("\\\\")
return sn(nil, nodes)
end
-- Return snippet tables -- Return snippet tables
return { return {
s({ trig = "vton", snippetType = "autosnippet" }, {
t("\\vec{v}_1, \\cdots, \\vec{v}_n"),
}),
-- SUPERSCRIPT -- SUPERSCRIPT
s( s(
{ trig = "([%w%)%]%}])'", wordTrig = false, regTrig = true, snippetType = "autosnippet" }, { trig = "([%w%)%]%}])'", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
@ -397,6 +424,15 @@ return {
}), }),
{ condition = tex.in_mathzone } { condition = tex.in_mathzone }
), ),
-- { trig = "([^%a])lim", wordTrig = false, regTrig = true, snippetType = "autosnippet" },
-- fmta("<>\\lim_{<>}", {
-- f(function(_, snip)
-- return snip.captures[1]
-- end),
-- }),
-- { condition = tex.in_mathzone }
-- ),
-- --
-- BEGIN STATIC SNIPPETS -- BEGIN STATIC SNIPPETS
-- --
@ -489,4 +525,36 @@ return {
s({ trig = "xx", snippetType = "autosnippet" }, { s({ trig = "xx", snippetType = "autosnippet" }, {
t("\\times "), t("\\times "),
}), }),
s(
{
trig = "([bBpvV])mat(%d+)x(%d+)([ar])",
name = "[bBpvV]matrix",
dscr = "matrices",
regTrig = true,
hidden = true,
},
fmta(
[[
\begin{<>}<>
<>
\end{<>}]],
{
f(function(_, snip)
return snip.captures[1] .. "matrix"
end),
f(function(_, snip)
if snip.captures[4] == "a" then
out = string.rep("c", tonumber(snip.captures[3]) - 1)
return "[" .. out .. "|c]"
end
return ""
end),
d(1, tex.generate_matrix),
f(function(_, snip)
return snip.captures[1] .. "matrix"
end),
}
),
{ condition = tex.in_math, show_condition = tex.in_math }
),
} }

View file

@ -0,0 +1,58 @@
local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual
local line_begin = require("luasnip.extras.expand_conditions").line_begin
-- Environment/syntax context detection
local tex = {}
tex.in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end
tex.in_text = function()
return not tex.in_mathzone()
end
tex.in_tikz = function()
local is_inside = vim.fn["vimtex#env#is_inside"]("tikzpicture")
return (is_inside[1] > 0 and is_inside[2] > 0)
end
-- Return snippet tables
return {
s({ trig = "q" }, {
t("\\quad "),
}),
s({ trig = "qq", snippetType = "autosnippet" }, {
t("\\qquad "),
}),
s({ trig = "npp", snippetType = "autosnippet" }, {
t({ "\\newpage", "" }),
}, { condition = line_begin }),
s({ trig = "which", snippetType = "autosnippet" }, {
t("\\text{ for which } "),
}, { condition = tex.in_mathzone }),
s({ trig = "all", snippetType = "autosnippet" }, {
t("\\text{ for all } "),
}, { condition = tex.in_mathzone }),
s({ trig = "and", snippetType = "autosnippet" }, {
t("\\quad \\text{and} \\quad"),
}, { condition = tex.in_mathzone }),
s({ trig = "forall", snippetType = "autosnippet" }, {
t("\\text{ for all } "),
}, { condition = tex.in_mathzone }),
s({ trig = "toc", snippetType = "autosnippet" }, {
t("\\tableofcontents"),
}, { condition = line_begin }),
s({ trig = "inff", snippetType = "autosnippet" }, {
t("\\infty"),
}),
s({ trig = "ii", snippetType = "autosnippet" }, {
t("\\item "),
}, { condition = line_begin }),
s(
{ trig = "--", snippetType = "autosnippet" },
{ t("% --------------------------------------------- %") },
{ condition = line_begin }
),
-- HLINE WITH EXTRA VERTICAL SPACE
s({ trig = "hl" }, { t("\\hline {\\rule{0pt}{2.5ex}} \\hspace{-7pt}") }, { condition = line_begin }),
}

View file

@ -0,0 +1,192 @@
local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual
local line_begin = require("luasnip.extras.expand_conditions").line_begin
-- Math context detection
local tex = {}
tex.in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end
tex.in_text = function()
return not tex.in_mathzone()
end
-- Return snippet tables
return {
-- ANNOTATE (custom command for annotating equation derivations)
s(
{ trig = "ann", snippetType = "autosnippet" },
fmta(
[[
\annotate{<>}{<>}
]],
{
i(1),
d(2, get_visual),
}
)
),
-- REFERENCE
s(
{ trig = " RR", snippetType = "autosnippet", wordTrig = false },
fmta(
[[
~\ref{<>}
]],
{
d(1, get_visual),
}
)
),
-- DOCUMENTCLASS
s(
{ trig = "dcc", snippetType = "autosnippet" },
fmta(
[=[
\documentclass[<>]{<>}
]=],
{
i(1, "a4paper"),
i(2, "article"),
}
),
{ condition = line_begin }
),
-- USE A LATEX PACKAGE
s(
{ trig = "pack", snippetType = "autosnippet" },
fmta(
[[
\usepackage{<>}
]],
{
d(1, get_visual),
}
),
{ condition = line_begin }
),
-- INPUT a LaTeX file
s(
{ trig = "inn", snippetType = "autosnippet" },
fmta(
[[
\input{<><>}
]],
{
i(1, "~/dotfiles/config/latex/templates/"),
i(2),
}
),
{ condition = line_begin }
),
-- LABEL
s(
{ trig = "lbl", snippetType = "autosnippet" },
fmta(
[[
\label{<>}
]],
{
d(1, get_visual),
}
)
),
-- HPHANTOM
s(
{ trig = "hpp", snippetType = "autosnippet" },
fmta(
[[
\hphantom{<>}
]],
{
d(1, get_visual),
}
)
),
s(
{ trig = "TODOO", snippetType = "autosnippet" },
fmta([[\TODO{<>}]], {
d(1, get_visual),
})
),
s(
{ trig = "nc" },
fmta([[\newcommand{<>}{<>}]], {
i(1),
i(2),
}),
{ condition = line_begin }
),
s(
{ trig = "sii", snippetType = "autosnippet" },
fmta([[\si{<>}]], {
i(1),
})
),
s(
{ trig = "qtt" },
fmta([[\qty{<>}{<>}]], {
i(1),
i(2),
})
),
-- URL
s(
{ trig = "url" },
fmta([[\url{<>}]], {
d(1, get_visual),
})
),
-- href command with URL in visual selection
s(
{ trig = "LU", snippetType = "autosnippet" },
fmta([[\href{<>}{<>}]], {
d(1, get_visual),
i(2),
})
),
-- href command with text in visual selection
s(
{ trig = "LL", snippetType = "autosnippet" },
fmta([[\href{<>}{<>}]], {
i(1),
d(2, get_visual),
})
),
-- HSPACE
s(
{ trig = "hss", snippetType = "autosnippet" },
fmta([[\hspace{<>}]], {
d(1, get_visual),
})
),
-- VSPACE
s(
{ trig = "vss", snippetType = "autosnippet" },
fmta([[\vspace{<>}]], {
d(1, get_visual),
})
),
-- SECTION
s(
{ trig = "h1", snippetType = "autosnippet" },
fmta([[\section{<>}]], {
d(1, get_visual),
})
),
-- SUBSECTION
s(
{ trig = "h2", snippetType = "autosnippet" },
fmta([[\subsection{<>}]], {
d(1, get_visual),
})
),
-- SUBSUBSECTION
s(
{ trig = "h3", snippetType = "autosnippet" },
fmta([[\subsubsection{<>}]], {
d(1, get_visual),
})
),
}

View file

@ -1,5 +0,0 @@
\begin{align*}
\end{align*}

View file

@ -0,0 +1,84 @@
local helpers = require("personal.luasnip-helper-funcs")
local get_visual = helpers.get_visual
local line_begin = require("luasnip.extras.expand_conditions").line_begin
-- Math context detection
local tex = {}
tex.in_mathzone = function()
return vim.fn["vimtex#syntax#in_mathzone"]() == 1
end
tex.in_text = function()
return not tex.in_mathzone()
end
return {
-- Equation, choice for labels
s(
{
trig = "beq",
dscr = "Expands 'beq' into an equation environment, with a choice for labels",
snippetType = "autosnippet",
},
fmta(
[[
\begin{equation}<>
<>
\end{equation}
]],
{
c(1, {
sn(
2, -- Choose to specify an equation label
{
t("\\label{eq:"),
i(1),
t("}"),
}
),
t([[]]), -- Choose no label
}, {}),
i(2),
}
)
),
-- Figure environment
s(
{ trig = "foofig", dscr = "Use 'fig' for figure environmennt, with options" },
fmta(
[[
\begin{figure}<>
\centering
\includegraphics<>{<>}
\caption{<>}
\label{fig:<>}
\end{figure}
]],
{
-- Optional [htbp] field
c(1, {
t([[]]), -- Choice 1, empty
t("[htbp]"), -- Choice 2, this may be turned into a snippet
}, {}),
-- Options for includegraphics
c(2, {
t([[]]), -- Choice 1, empty
sn(
3, -- Choice 2, this may be turned into a snippet
{
t("[width="),
i(1),
t("\\textwidth]"),
}
),
}, {}),
i(3, "filename"),
i(4, "text"),
i(5, "label"),
}
),
{ condition = line_begin }
),
}

View file

@ -10,6 +10,7 @@
shellAliases = { shellAliases = {
update = "sudo nixos-rebuild switch"; update = "sudo nixos-rebuild switch";
clean = "nix-collect-garbage -d"; clean = "nix-collect-garbage -d";
repair = "nix-store --repair --verify --check-contents";
reload = "source ~/.zshrc"; reload = "source ~/.zshrc";
"." = "cd ../"; "." = "cd ../";

View file

@ -23,6 +23,8 @@
../../common/networking ../../common/networking
../../common/virtualization ../../common/virtualization
../../common/nixos
../../common/gui
./syncthing.nix ./syncthing.nix
./auditd.nix ./auditd.nix
@ -46,6 +48,7 @@
ssh.enable = true; ssh.enable = true;
ssh_guard.enable = true; ssh_guard.enable = true;
nfs.enable = true; nfs.enable = true;
steam.enable = true;
# Bootloader. # Bootloader.
boot = { boot = {

View file

@ -1,9 +1,4 @@
{ {pkgs, ...}: {
config,
pkgs,
stdenv,
...
}: {
boot.kernelPackages = pkgs.linuxPackages_hardened; boot.kernelPackages = pkgs.linuxPackages_hardened;
boot.kernelParams = [ boot.kernelParams = [
# Disable slab merging to prevent heap exploitation # Disable slab merging to prevent heap exploitation

View file

@ -1,5 +1,6 @@
restic_key: ENC[AES256_GCM,data:DzpWvFP5gyhrnLVIYgu9ouotWqkOAHehihSKf/TqJE+sHTD4vnIScfhzoKzdkoDoWfkcmQ==,iv:q83qNYuP/3mngvg+kUfOVToogL8VTvZ6HiGIztpnP/s=,tag:YNWwbma0HmPKqYCS1L5kQQ==,type:str] restic_key: ENC[AES256_GCM,data:DzpWvFP5gyhrnLVIYgu9ouotWqkOAHehihSKf/TqJE+sHTD4vnIScfhzoKzdkoDoWfkcmQ==,iv:q83qNYuP/3mngvg+kUfOVToogL8VTvZ6HiGIztpnP/s=,tag:YNWwbma0HmPKqYCS1L5kQQ==,type:str]
wireless.env: ENC[AES256_GCM,data:LzvMh6lfM9pnS3joSK3SUqEZDfP+Qk7NQmROWny1XhvQ0SkihvlM40YgA4ZGtwcPO1OnrDy6Srfvy+fuOqqt1XEK6qIOSir6cODkGQbKBa1Ui347P28tw6hgEHM57EYTAfMMwaHTtglPAvN/7YvdMPMT+EwcoyCzj5efRR6pZ0FeLSOtzKeYwe4oaRX1MP+THooSzw+zuoGmU6x3Dq4E8hruFd2o0ug3OEj2r95LVmGnnUiiLxU8YhDd+PXXyz8T6fFdapN1,iv:pdXqMqiR3qEQG1LvXqXWB8vpM6d2/Curv4gvuLOOatI=,tag:7H2wST9Mx9C3RCsOeUD1Vw==,type:str] wireless.env: ENC[AES256_GCM,data:/5i0Kv+VFTtVpaD7tfO2ahePu20eYkUYAqoh39PA2aoMWywLddQEQy4arj2Nvcw8hsRk760Kiq4wz3c23dPDqy7rU980NF2RaP4ODMIiQISfYeQP9coD84JhlnSTW+7EkhV520naqJgIYY0IsA8OxR/5euyFMHOL75FKnBh1ILY2DPSsJNG2m2ldw+US7E+7r4REl8tDqKfCIL5tznmbVTbPrer7cwrXe+ScFaholmqSntaB06yIIO3yr88TmE6EXF6oLCXU,iv:DPOqx7M7E83+DYjGFPZy44cxrta/3953IDjXL40rLAc=,tag:KmYBpQKgshMSgxnC96T1bQ==,type:str]
home_uuid: ENC[AES256_GCM,data:VX92mQuoYXpPxe6EzQ==,iv:3i7Ll7rITrOTYMKK4tHy+IU5DVWFbFjrFHQ3uw3Gr7g=,tag:0bp/XaR4JOdFYpSVtpxm5A==,type:str]
sops: sops:
kms: [] kms: []
gcp_kms: [] gcp_kms: []
@ -15,8 +16,8 @@ sops:
US9oa0pORXRVWWlyYlZZTGhXdTdOaWsKClqIK/YNJIIGFqOO0t4oni8dRTTXQniG US9oa0pORXRVWWlyYlZZTGhXdTdOaWsKClqIK/YNJIIGFqOO0t4oni8dRTTXQniG
ioIwAOdEgE/n0vcYhHXxLxWlTeqGZF076g7EFfIqiSNqrDtacRnazg== ioIwAOdEgE/n0vcYhHXxLxWlTeqGZF076g7EFfIqiSNqrDtacRnazg==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2024-09-13T19:21:22Z" lastmodified: "2024-10-03T04:35:54Z"
mac: ENC[AES256_GCM,data:dzWc9v24u1tT8ZeVCXawKn3IovFxlfs6B8yrgzkn7rZGtZDN5iAwTStuZtRYW8tydNuY7KZa9dH/9+Eh7YW9iGsumzQ3ewCHCyg9kdBpC9yGGDkIw41mKG3aweFERtXfq0WWnqDHnr7ZGrtPfsEOxvMG+uKU7K3lslhlcyeQf+U=,iv:BNXwcKP5vOHxbKX8fD3lbEuzhuHqAI5qi8mXtleG6p4=,tag:7WPAxw8IfE+flxzAentE6Q==,type:str] mac: ENC[AES256_GCM,data:6h43edjI9ouW2vbTcydrvbrqDb7GmMVgXBUk8nHyd0mV5QzR0ZeGzl+WXN5cwTRqwahAMsFax6riWyCFyMAEHIC66ucQhhPKH90vsKpm7/Nh037lbIfbYnqVG5PTdRzLo0zELkNmB5NX7j0amgynEX3xm1ipcWPGowTQiVjkQ98=,iv:zsVRb2ahPZ27hOkdhjmDl3px0wBri+xIwSvya2Kg8Hg=,tag:qrDuyDrIfccOnvqekiNnWA==,type:str]
pgp: [] pgp: []
unencrypted_suffix: _unencrypted unencrypted_suffix: _unencrypted
version: 3.9.0 version: 3.9.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB