Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

v

version 0.4

𝐯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).

prerequisites

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.

installing

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; end

Like 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.fish

usage

Show the current directory with lsd:

v

Show another directory—like ~/Documents—with lsd:

v ~/Documents

Show a text file—like ~/Documents/hello.md—with bat:

v ~/Documents/hello.md

Show an image—like ~/Pictures/me.jpeg—with your default image viewer:

v ~/Pictures/me.jpeg

more features

Pass 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.typst

Tell 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).

contributing

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.

license

GNU General Public License v3.0 or later, unless otherwise stated. See the GPLv3 license in LICENSE.md.