wstow is a wrapper around GNU stow that makes it easier to make symlinks from multiple sources to multiple targets easily.
GNU stow is a symlink maker and manager that makes multiple symlinks easier. However, it still lacks some capabilites that makes it difficult to symlink multiple distinct package groups. Take a look at following example :
[Here assumed current working directory is home ( ~ or /home/<username>) and dotfiles is at ~/path/to/dotfiles ]
- To make symlinks to multiple folders under your config directory, eg :
vifm,nvim,bat,zshwith stow
- got to .config directory (
cd ~/.config) - Create vifm directory (
mkdir vifm) - Go to vifm directory (
cd vifm) - Use stow to symlink (
stow -v -t ./ -d ../path/to/dotfiles/.config -S vifm) - go back to .config directory (
cd ..) - Repeat from step 2 replacing '
vifm' with any other package name ( likenvim,zsh,alacritty)
- To make symlinks to multiple folders under your config directory, eg :
vifm,nvim,bat,zshwith wstow
wstow file ../path/to/dotfiles/.config ./ vifm alacritty zsh bat( The syntax is like this :-wstow mode SOURCE_DIR TARGET_PARENT_DIR PACKAGE_NAMES)
- Stow
findforignoreandfignoremodes
Just copy the script to anywhere in your PATH ( echo $PATH ). Make sure the script is executable ( chmod +x wstow )
The syntax for wstow is :-
wstow mode SOURCE_DIR TARGET_PARENT_DIR PACKAGE_NAMES
- mode
-
dry:- Do not make any changes. Just do dry-run or simulate what the changes will be made withfilemode -
file:- For all thePACKAGE1,PACKAGE2,... fromPACKAGE_NAMESmake symlinks for all files fromSOURCE_DIR/PACKAGE1,SOURCE_DIR/PACKAGE2,... inside the folderTARGET_PARENT_DIR/PACKAGE1,TARGET_PARENT_DIR/PACKAGE2,.. till all thePACKAGE_NAMES. Recurse into subdirectories inPACKAGE1,PACKAGE2,... and create symlinks. The subdirectories will also be created (stow--no-foldingfeature). -
folder:- For all thePACKAGE1,PACKAGE2,... fromPACKAGE_NAMESmake symlinks for files and folder fromSOURCE_DIR/PACKAGE1,SOURCE_DIR/PACKAGE2,... inside the folderTARGET_PARENT_DIR/PACKAGE1,TARGET_PARENT_DIR/PACKAGE2,.. till all thePACKAGE_NAMES. Symlinks for first level subdirectories are created without recursing likefilemode.
(Note ❗ :- Files/folders deleted inside a symlinked folder will delete original source. To remove a symlinked folder, delete the symlinked folder. Deleting the contents inside will delete from original source.) -
ignore:- Similar tofilemode except all packages fromSOURCE_DIRwill be used except for those provided asPACKAGE_NAMES. -
fignore:- Similar tofoldermode except all packages fromSOURCE_DIRwill be used except for those provided asPACKAGE_NAMES. -
restow:- Similar tofoldermode except re-stow or repair symlinks -
delete:- Similar tofoldermode except delete symlinks. ( When used to remove symlinks fromfilemode, empty subdirectories would remain.) ###End