diff options
author | Michał M. Sapka <michal@sapka.me> | 2023-05-26 15:24:02 +0200 |
---|---|---|
committer | Michał M. Sapka <michal@sapka.me> | 2023-05-26 15:24:02 +0200 |
commit | ad45af8c8b4e222e4ea20095a281dc394d2defed (patch) | |
tree | 5a2c7677e80f897e167c02c575be232771b90d5e /content/2022/gnu_stow.md | |
parent | 07b4394e6f91d3e1bd21fa56d12ffc2684470a30 (diff) |
feat: migrate to syntax hightlight
Diffstat (limited to 'content/2022/gnu_stow.md')
-rw-r--r-- | content/2022/gnu_stow.md | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/content/2022/gnu_stow.md b/content/2022/gnu_stow.md index 07cee9e..9c2bc02 100644 --- a/content/2022/gnu_stow.md +++ b/content/2022/gnu_stow.md @@ -18,17 +18,17 @@ GNU Stow. <!--more--> Let's take a very typical dotfiles repository. -``` +{{< highlight shell>}} ./nvim/init.lua ./tmux/tmux.conf -``` +{{</highlight>}} You want to have those files available as -``` +{{< highlight shell>}} ~/.config/nvim/init.lua ~/.tmux.conf -``` +{{</highlight>}} The most popular approach would be to symlink the files under the expected location. We could also copy the files every time something changes, but that would be crazy. Are we @@ -47,69 +47,69 @@ in the Stowed directory (called "Package directory") stores a separate directory Stow will join all those separate trees and create a proper structure under Target Directory, which by default is the parent of Stowed directory. Let's look at example. -``` +{{< highlight shell>}} ~/target/stow/one/config/one.conf ~/target/stow/two/config/two.conf ~/target/stow/three/config/three.conf -``` +{{< / highlight >}} So, our home director now has a "Target" directory, which has a "Stow" directory. The Stow directory stores three configs which we want to sylink as -``` +{{< highlight shell>}} ~/target/config/one.conf ~/target/config/two.conf ~/target/config/three.conf -``` +{{< / highlight >}} Let's stow the first one -``` +{{< highlight shell>}} cd ~/target/stow stow one -``` +{{< / highlight >}} And see what happened -``` +{{< highlight shell>}} cd ~/target ls -lA -``` +{{< / highlight >}} We get somethine like -``` +{{< highlight shell>}} lrwxrwxrwx 1 msapka wheel 15 Jun 9 23:01 config -> stow/one/config drwxr-xr-x 5 msapka wheel 4096 Jun 9 22:55 stow -``` +{{< / highlight >}} Stow created a config symlink in the target directory. Very cool, but it gets cooler! Let' stow the second one -``` +{{< highlight shell>}} cd ~/target/stow stow two -``` +{{< / highlight >}} and what we get -``` +{{< highlight shell>}} drwxr-xr-x 2 msapka wheel 4096 Jun 9 23:03 config drwxr-xr-x 5 msapka wheel 4096 Jun 9 22:55 stow -``` +{{< / highlight >}} Our config is no longer a symlink, but a real folder. Let's see what's inside here. -``` +{{< highlight shell>}} cd config ls -lA -``` +{{< / highlight >}} -``` +{{< highlight shell>}} lrwxrwxrwx 1 msapka wheel 27 Jun 9 23:03 one.conf -> ../stow/two/config/one.conf lrwxrwxrwx 1 msapka wheel 26 Jun 9 23:03 two.conf -> ../stow/one/config/two.conf -``` +{{< / highlight >}} We have our two configs, but what has happened? Stow looked at both sub trees for "one" and "two"m and joined then in a way, that is possible. The only way for one.conf and two.conf to @@ -119,17 +119,16 @@ Let's image that our target is actually homedir, so we have a ~/dotfiles directo each package directory can mimic the tree struture of the actual config! Coming back to our example, we can have a -``` +{{< highlight shell>}} ~/dotfiles/tmux/.tmux.conf ~/dotfiles/nvim/.config/nvim/init.lua -``` +{{< / highlight >}} Then, after stowing both packages we have symlinks under our desired - -``` +{{< highlight shell>}} ~/.config/nvim/init.lua ~/.tmux.conf -``` +{{< / highlight >}} GNU Stow is a very simple tool. All we understand what will happen with each sub tree. |