Done.
This commit is contained in:
commit
7860b2a6d0
2 changed files with 67 additions and 0 deletions
22
README.md
Normal file
22
README.md
Normal file
|
@ -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
|
45
v
Executable file
45
v
Executable file
|
@ -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
|
Loading…
Add table
Reference in a new issue