From 0d017034c43108d96795690bc506c83affc395be Mon Sep 17 00:00:00 2001 From: Thomas Churchman Date: Fri, 19 Jul 2024 10:04:51 +0200 Subject: [PATCH] docs: improve screenshot generation script --- media/grayscale-light.svg | 7 ++----- media/verf-light.svg | 7 ++----- scripts/screenshots.sh | 11 ++++++++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/media/grayscale-light.svg b/media/grayscale-light.svg index 5a9f4de..0c9d344 100644 --- a/media/grayscale-light.svg +++ b/media/grayscale-light.svg @@ -25,11 +25,8 @@ - - - 1 //! Calculate A+B. @@ -119,9 +116,9 @@ 17 } ~ -./hi-nvim-rs-web/code-examples/rust.rs  17,2           All +./hi-nvim-rs-web/code-examples/rust.rs  14,51          All -- VISUAL LINE -- -6 +3 diff --git a/media/verf-light.svg b/media/verf-light.svg index e7fd7e0..4ee015c 100644 --- a/media/verf-light.svg +++ b/media/verf-light.svg @@ -25,11 +25,8 @@ - - - 1 //! Calculate A+B. @@ -120,9 +117,9 @@ 17 } ~ -./hi-nvim-rs-web/code-examples/rust.rs  17,2           All +./hi-nvim-rs-web/code-examples/rust.rs  14,51          All -- VISUAL LINE -- -6 +3 diff --git a/scripts/screenshots.sh b/scripts/screenshots.sh index cb61233..11c0ba2 100755 --- a/scripts/screenshots.sh +++ b/scripts/screenshots.sh @@ -11,21 +11,26 @@ if [ -n "$SCREENSHOT_NVIM" ]; then NVIM="$SCREENSHOT_NVIM" fi +cargo build --release +BIN=./target/release/hi-nvim-rs + for light_dark in "light" "dark"; do for colorscheme in "highlow" "verf" "twocolor" "grayscale"; do - cargo run -- ./colorschemes/$colorscheme.toml >"$DIR/$colorscheme.vim" + $BIN -- ./colorschemes/$colorscheme.toml >"$DIR/$colorscheme.vim" ( # exit on a timer to perform some other commands in the meantime echo ":lua vim.defer_fn(function() vim.cmd('q!') end, 50)" echo -ne ":12\rnVjj$" - sleep 0.1 + sleep 0.5 ) | termsnap --term xterm-256color --columns 58 --lines 20 --render-before-clear -- \ "$NVIM" --clean \ -c "source ./scripts/nvim-config.vim" \ -c "set bg=$light_dark" \ -c "source $DIR/$colorscheme.vim" \ ./hi-nvim-rs-web/code-examples/rust.rs \ - >./media/$colorscheme-$light_dark.svg + >./media/$colorscheme-$light_dark.svg & done done + +wait