Skip to content

Instantly share code, notes, and snippets.

@xorspark
Last active May 13, 2024 18:32
Show Gist options
  • Save xorspark/736bcfea5089aa93d434b2341d2c376b to your computer and use it in GitHub Desktop.
Save xorspark/736bcfea5089aa93d434b2341d2c376b to your computer and use it in GitHub Desktop.
y U nO MoCk? Mocking text filter that I use from within vim. Because reasons.
#!/bin/bash
# makes mocking alt caps text from stdin
upper=0
while IFS= read -N 1 line; do
if [[ "$line" =~ [[:space::]] ]]; then
printf "%s" "$line"
elif (( upper == 0 )); then
printf "%s" "${line,}"
upper=1
else
printf "%s" "${line^}"
upper=0
fi
done <&0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment