𝐯iew directories and files with a single command.
v is a little fish function that infers whether you want to use lsd, bat, or xdg-open given any path (or no path at all).
v is made for the fish shell.
To use v, you'll need to have lsd and bat installed.
You'll also need xdg-utils, but this comes preinstalled with just about all distros' graphical installations.
In a fish shell, run:
begin; set -l install_path ~/.config/fish/functions/v.fish; curl -o $install_path https://raw.githubusercontent.com/solanto/v/refs/heads/main/v.fish && source $install_path; endLike how many distros alias la to ls -al, an abbreviation like vv might be helpful.
echo -e "\nabbr -a -- vv 'v -l -al'" >> ~/.config/fish/conf.d/abbreviations.fish
source ~/.config/fish/conf.d/abbreviations.fishShow the current directory with lsd:
vShow another directory—like ~/Documents—with lsd:
v ~/DocumentsShow a text file—like ~/Documents/hello.md—with bat:
v ~/Documents/hello.mdShow an image—like ~/Pictures/me.jpeg—with your default image viewer:
v ~/Pictures/me.jpegPass any supported options to lsd with --lsd (-l) and to bat with --bat (-b). v will apply options only to the task at hand; lsd won't see bat's options, and vice versa.
v --lsd -al ~/Documents
v -L -al -B -s doc.typstTell v you don't want to use xdg-open with --no-xdg (-n).
See version info with --version (-v) and a help message with --help (-h).
Feel free to ask questions or make suggestions here or at person@dandelion.computer. I'll do my best to collaborate with those who'd like to!
If you fork v, be sure to change domain in the v function to your own domain (which could even be something like your-username.github.io) to make it clear as to whose code anyone is running.
GNU General Public License v3.0 or later, unless otherwise stated. See the GPLv3 license in LICENSE.md.