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
,zsh
with 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
,zsh
with 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
find
forignore
andfignore
modes
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 withfile
mode -
file
:- For all thePACKAGE1
,PACKAGE2
,... fromPACKAGE_NAMES
make 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-folding
feature). -
folder
:- For all thePACKAGE1
,PACKAGE2
,... fromPACKAGE_NAMES
make 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 likefile
mode.
(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 tofile
mode except all packages fromSOURCE_DIR
will be used except for those provided asPACKAGE_NAMES
. -
fignore
:- Similar tofolder
mode except all packages fromSOURCE_DIR
will be used except for those provided asPACKAGE_NAMES
. -
restow
:- Similar tofolder
mode except re-stow or repair symlinks -
delete
:- Similar tofolder
mode except delete symlinks. ( When used to remove symlinks fromfile
mode, empty subdirectories would remain.) ###End