From 7860b2a6d0d6c07e8bfd5445c402809f96ff1625 Mon Sep 17 00:00:00 2001 From: Vilyaem Date: Wed, 19 Feb 2025 06:04:49 -0500 Subject: [PATCH] Done. --- README.md | 22 ++++++++++++++++++++++ v | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 README.md create mode 100755 v diff --git a/README.md b/README.md new file mode 100644 index 0000000..c521591 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# V, automatic file-opener, pager-handler, and alias + +V is a shell script that is a universal 'viewer' and 'opener'. It rocks. This +is a conversion from thricegreat's rc 'v' to Kornshell. Vilyaem added more features +to it, on its own, it is just an alias for vim, when piped to, it opens the contents +in vim, but most importantly it is used as an opener. + + +## Examples + + +Play a video named video.mp4 using ffplay or mpv + +v video.mp4 + +Open a file in Vim + +v file.c + +## LICENSE + +Pubilc Domain CC ZERO diff --git a/v b/v new file mode 100755 index 0000000..ef3ece5 --- /dev/null +++ b/v @@ -0,0 +1,45 @@ +#!/bin/sh +#v, automatic file-opener, pager-handler, and alias + +# Turn into a pager like less: ls | v +if [ ! tty >/dev/null ]; then + while read line; do + #echo "Processing: $line" + echo "$line" + done +fi + +# Use vim if no argument is provided +if [ $# -eq 0 ]; then + #vim + nvim + exit 0 +fi + +case $* in +#*mp4*|*mkv*|*webm*|*flv*|*ts*|*m4a*|*opus*|*mp3) +*mp4*|*mkv*|*webm*|*flv*|*m4a*|*opus*|*mp3) +#ffplay $* +mpv $* +;; +*jpg*|*jpeg*|*png*|*gif|*webp) +sxiv $* +;; +*djvu*|*pdf*|*epub*) +zathura $* +;; +*docx*|*odt*|*rtf*|*xls*|*xlsx*|*ppt*|*pptx*) +libreoffice $* +;; +*zim*) +kiwix-dekstop $* +;; +*txt*|*md*|*csv*|*html*|*js*|*json*|*conf*|*.c|*.h|*.mk|*.info|*.orig|*.local|*[a-z]*|*[A-Z]*|/etc*|*config*|*rc) +#vim $* +nvim $* +;; +*) +#echo 'Not yet defined.' +nvim $* +;; +esac