feat: yazi extra shortcuts

# Changes
## docs:
- Add extra tutorial docs
## Features:
- Add `pdf combine` to yazi
- Add `pdf normalization` to yazi
- Add `Markdown to html` to yazi
## Breaking Changes:
- Rename sops secret `wireguard/conf` to `wireguard/wg0.conf`: Make sure
update your `sops-conf.nix` and secrets file.
This commit is contained in:
danny 2025-10-01 15:14:19 +08:00
parent dc8f796e18
commit 54ab4d4181
17 changed files with 266 additions and 34 deletions

View file

@ -4,6 +4,17 @@ let
url = "https://raw.githubusercontent.com/xz/new.css/refs/heads/master/new.css";
hash = "sha256-Xd3AMZOeThsrupQusSLjqv3hbNmcpeTms0ieI9nyxOk=";
};
inlineHeader =
pkgs.writeText "pandoc-inline-header"
# html
''
<style>
h1 { font-size: 1.55em !important; }
h2 { font-size: 1.35em !important; }
h3 { font-size: 1.2em !important; }
h4 { font-size: 1.1em !important; }
</style>
'';
in
pkgs.writeShellScriptBin "md2html" ''
set -e
@ -15,7 +26,8 @@ pkgs.writeShellScriptBin "md2html" ''
HTML_TEMP="''\${BASENAME}.html"
PDF_OUTPUT="''\${BASENAME}.pdf"
${pkgs.pandoc}/bin/pandoc "$INPUT" -s \
${pkgs.pandoc}/bin/pandoc "$INPUT" -f markdown-implicit_figures \
--include-in-header=${inlineHeader} -s \
--to=html5 --embed-resources \
--css=${cssStyle} -o "$HTML_TEMP" "$@"

View file

@ -3,10 +3,6 @@ let
top = "60";
right = "100%-w-10";
notransTag = "notrans";
noTransList = [
"title:(.*)( - YouTube Mozilla Firefox)"
"title:(.*)( - Mozilla Firefox)"
];
in
{
windowrule = [
@ -109,13 +105,7 @@ in
# Disable Tansparent
"opacity 1.0 override 1.0 override, tag:${notransTag}"
"noblur, tag: ^(${notransTag})$"
]
++ (concatLists (
map (w: [
"opacity 1.0 override 1.0 override, ${w}"
"noblur, ${w}"
]) noTransList
));
];
layerrule = [
"blur, waybar"

View file

@ -67,6 +67,7 @@ in
"BlinkCmpBorder",
"BlinkCmpKind",
"WarningMsg",
"ColorColumn",
"ErrorMsg",
"BlinkCmpMenuBorder",
"FzfLuaBackdrop",
@ -407,7 +408,8 @@ in
markdown = {
enable = true;
extensions = {
render-markdown-nvim.enable = true;
render-markdown-nvim.enable = false;
markview-nvim.enable = true;
};
};
html.enable = true;
@ -453,7 +455,6 @@ in
"base16"
"lsp-signature-nvim"
"snacks-nvim"
"render-markdown-nvim"
];
setupOpts.enable_autosnippets = true;
};

View file

@ -1,13 +1,68 @@
{ pkgs, ... }:
let
tex = pkgs.texliveFull.withPackages (
ps: with ps; [
standalone
everysel
preview
doublestroke
msg
setspace
rsfs
relsize
ragged2e
fundus-calligra
microtype
wasysym
physics
dvisvgm
jknapltx
wasy
cm-super
dvisvgm
amstex
babel-english
amsmath
amsfonts
mathtools
amscdx
xcolor
]
);
in
{
programs.nvf.settings.vim = {
keymaps = import ./keymaps.nix;
extraPackages = with pkgs; [ fd ];
extraPackages = with pkgs; [
fd
imagemagick
ghostscript
tex
];
};
programs.nvf.settings.vim.utility.snacks-nvim = {
enable = true;
setupOpts = {
image = {
enabled = false;
doc = {
enabled = true;
};
math = {
enabled = true;
latex = {
font_size = "Large";
packages = [
"amsmath"
"amssymb"
"amsfonts"
"amscd"
"mathtools"
];
};
};
};
bigfile = {
enabled = true;
};

View file

@ -58,13 +58,11 @@ in
(python3.withPackages (python-pkgs: [
python-pkgs.pip
python-pkgs.requests
python-pkgs.weasyprint
]))
# Work stuff
libreoffice-qt
pandoc
texliveSmall
# Bluetooth
blueberry

View file

@ -2,6 +2,7 @@
inputs,
system,
pkgs,
lib,
...
}:
let
@ -11,6 +12,15 @@ let
rev = "main";
hash = "sha256-TUS+yXxBOt6tL/zz10k4ezot8IgVg0/2BbS8wPs9KcE=";
};
md2html = pkgs.callPackage ./../scripts/md2html.nix { };
pdfNormalize = pkgs.writeShellScriptBin "normalize-pdf" ''
# Nomalize pdf to A4 size
${lib.getExe pkgs.ghostscript} -o "normalized_$1" \
-sDEVICE=pdfwrite \
-sPAPERSIZE=a4 \
-dFIXEDMEDIA \
-dPDFFitPage "$1"
'';
in
{
programs = {
@ -62,6 +72,22 @@ in
player = [
{ run = ''mpv --force-window "$@"''; }
];
open = [
{
run = ''xdg-open "$@"'';
desc = "Open";
}
];
};
open = {
prepend_rules = [
{
mime = "application/pdf";
use = "open";
}
];
};
};
@ -107,7 +133,7 @@ in
{
on = "T";
run = "plugin toggle-pane max-preview";
desc = "Show or hide the preview pane";
desc = "Show or hide the preview panel";
}
# Copy selected files to the system clipboard while yanking
{
@ -144,6 +170,38 @@ in
run = ''shell "$SHELL" --block'';
desc = "Open $SHELL here";
}
# Combine PDF
{
on = [
"F" # file
"p" # pdf
"c" # combine
];
for = "unix";
run = ''shell '${lib.getExe pkgs.pdftk} "$@" cat output combined_$(date +%Y%m%d_%H%M%S).pdf 2>/dev/null &' '';
desc = "Combine selected pdf";
}
{
on = [
"F" # file
"p" # pdf
"n" # normalize
];
for = "unix";
run = ''shell -- for path in "$@"; do ${lib.getExe pdfNormalize} "$path"; done'';
}
{
on = [
"F" # file
"m" # markdown
"h" # html
];
for = "unix";
run = [
''shell -- for path in "$@"; do ${lib.getExe md2html} "$path"; done''
];
desc = "Convert Markdown to HTML";
}
];
};
};