1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-10-09 19:11:15 +02:00

nvim: added clearing of preview files for markdown

This commit is contained in:
2023-12-06 01:05:15 +01:00
parent 2f74fa5c04
commit e8a7b8d896
2 changed files with 19 additions and 1 deletions

13
.local/bin/etc/nvim/mdclear Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env sh
# Clears the files created for previewing markdown files in nvim
# based on a program by lukesmithxyz
case "$1" in
*.md)
file=$(readlink -f "$1")
dir=$(dirname "$file")
base="${file%.*}"
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(html|pdf)" -delete ;;
*) printf "Give .md file as argument.\\n" ;;
esac