zsh
and GNU stow
#14
1 changed files with 24 additions and 14 deletions
|
@ -1,4 +1,4 @@
|
|||
______________________________________________________________________
|
||||
---
|
||||
|
||||
date: 2025-06-04
|
||||
title: zsh and GNU stow
|
||||
|
@ -8,7 +8,7 @@ tags:
|
|||
- linux
|
||||
- development
|
||||
|
||||
______________________________________________________________________
|
||||
---
|
||||
|
||||
In [my last post exploring `nvim`](https://blog.mcknight.tech/2025/05/21/nvim/), I mentioned some potential next projects on my agenda.
|
||||
Well, I wasted no time continuing down the path of trying to perfect my shell experience. I very quickly updated my
|
||||
|
@ -102,13 +102,13 @@ haven't run into any issues thus far and `zsh` is good enough to be the default
|
|||
operating systems, including macOS and TrueNAS.
|
||||
|
||||
There are a couple reasons I decided to try `zsh`, the first being tab completion which
|
||||
I find helpful when completing a path or command where there are only a couple options to tab through.
|
||||
I find helpful when completing a path or command where there are only a couple options to tab through.
|
||||
The other reasons I wanted to experiment with `zsh` are a bit more complex.
|
||||
|
||||
### RC Files
|
||||
|
||||
[Run Commands files](https://en.wikipedia.org/wiki/RUNCOM) are basically files that
|
||||
are executed when a program starts. I
|
||||
[Run Commands files](https://en.wikipedia.org/wiki/RUNCOM) are basically files that
|
||||
are executed when a program starts. I
|
||||
[previously detailed my .bashrc file](https://blog.mcknight.tech/2024/03/27/Shell-Customizations/#BASH-Configuration),
|
||||
which is executed whenever I open a new `bash` shell.
|
||||
I wanted to experiment with `zsh` configuration because it feels a little more modern
|
||||
|
@ -189,7 +189,7 @@ I use different aliases for different shells (i.e. `sudosu` is shell-specific).
|
|||
|
||||
### `zsh` Plugins
|
||||
|
||||
Another interesting feature of `zsh` is that it supports plugins.
|
||||
Another interesting feature of `zsh` is that it supports plugins.
|
||||
Now just like with Neovim, there are a number of different plugin managers that can be
|
||||
used with `zsh`. I don't know if there is a "best" choice, but after some light reading
|
||||
on the popular options I could fine and some [LLM summary comparisons](https://search.brave.com/search?q=zinit+vs+omz&source=desktop&summary=1&conversation=f5495011020a89faf13bf1),
|
||||
|
@ -197,44 +197,53 @@ I settled on [Zinit](https://github.com/zdharma-continuum/zinit) as a lightweigh
|
|||
apparently maintained option.
|
||||
|
||||
#### OMZ extract
|
||||
This convenience command lets me extract files without having to remember the syntax for
|
||||
|
||||
This convenience command lets me extract files without having to remember the syntax for
|
||||
extracting `.tar.xz`, `.zip`, `.tar.gz`, etc. A simple `extract <file>`
|
||||
|
||||
#### OMZ colored-man-pages
|
||||
|
||||
This adds some color to man pages which I think makes it a little easier to skim to find
|
||||
CLI args and section headers. Its not the *best* IMO, but something is better than nothing
|
||||
here when trying to skim through what can be pretty dense documentation.
|
||||
|
||||
#### OMZ encode64
|
||||
|
||||
It isn't every day that I need to get a b64-encoded representation of a string, but its
|
||||
handy to be able to do so quickly and easily.
|
||||
|
||||
#### OMZ pip
|
||||
|
||||
I like having tab completion for pip. I haven't used it too much yet, but I already see
|
||||
how this will save me from trying to `pip isntall` when I really mean `pip install`. I
|
||||
do this more than I'd like to admit. Other than that, its nice to have reminders for the
|
||||
less commonly used flags.
|
||||
|
||||
#### OMZ sudo
|
||||
|
||||
The Oh My Zsh sudo plugin adds a convenience keybind (`esc`+`esc`) to prepend `sudo` to
|
||||
the current command or the previous command if the input is empty. I find this to be
|
||||
the current command or the previous command if the input is empty. I find this to be
|
||||
convenient as it is fairly common to re-run the previous command with elevated privileges
|
||||
or to prepend `sudo` if I forgot to start with that.
|
||||
|
||||
#### zsh-autosuggestions
|
||||
|
||||
This plugin works much like suggestions in an IDE, providing a suggested command completion
|
||||
that can be filled in with a bound key (I am using `Shift`+`Tab`).
|
||||
I find this mapping more convenient than the default `->`, since I can reach it without
|
||||
that can be filled in with a bound key (I am using `Shift`+`Tab`).
|
||||
I find this mapping more convenient than the default `->`, since I can reach it without
|
||||
moving my fingers from the home row and it is easy to remember `tab` and `shift`+`tab`
|
||||
are both a kind of completion.
|
||||
|
||||
#### zsh-syntax-highlighting
|
||||
|
||||
This plugin highlights syntax as you type in a command. This clearly identifies unresolved
|
||||
commands or files to help catch errors before trying to run an incomplete command. It also
|
||||
helps to identify un-escaped characters in a quoted string.
|
||||
|
||||
### `.zshrc`
|
||||
|
||||
Now that I've explained it in parts, here's my `.zshrc` file in its entirety:
|
||||
|
||||
```
|
||||
# Lines configured by zsh-newuser-install
|
||||
HISTFILE=~/.histfile
|
||||
|
@ -360,25 +369,27 @@ bindkey '^[[Z' autosuggest-accept
|
|||
```
|
||||
|
||||
#### Some notes on `autossh`
|
||||
|
||||
I have only been using `autossh` for a couple hours at this point, based on internet recommendations
|
||||
that it will do better at resuming with `tmux` (via `tmux-resurrect`). Based on initial testing, it
|
||||
appears to be working but I don't yet know if it is markedly better than plain `ssh`.
|
||||
|
||||
Not necessarily related to `autossh`, the `assh` function I included allows for connecting to a
|
||||
Not necessarily related to `autossh`, the `assh` function I included allows for connecting to a
|
||||
server and applying my `.bashrc` without making permanent changes to the remote server. This does
|
||||
not apply to connections that use a `RemoteCommand` in the SSH config, which is intentional; I have
|
||||
remotes that run a `tmux` session for remote connections and I wouldn't want to mess with shell
|
||||
configurations when multiple connections will be attaching the same `tmux` session.
|
||||
|
||||
### Conclusion
|
||||
|
||||
I don't think my shell configuration will ever be "done", but I've reached a point where I'm
|
||||
satisfied for now. GNU `stow` has simplified my dotfile management and made it easier to
|
||||
satisfied for now. GNU `stow` has simplified my dotfile management and made it easier to
|
||||
manage more configurations as I add tools to my repertoire. I now have `zsh` looking like
|
||||
my `bash` shell and all of my aliases and `PATH` management better organized to minimize
|
||||
redundant code in shell-specific config files. I've enabled a few zsh plugins that create a
|
||||
more pleasant shell experience with extra text highlighting and shortkeys.
|
||||
|
||||
I have no immediate plans for what to work on next, though I
|
||||
I have no immediate plans for what to work on next, though I
|
||||
[still have some ideas](https://blog.mcknight.tech/2025/05/21/nvim/#What-to-do-next). I may continue my search for a good
|
||||
visual file manager in the terminal, or try out Pop!_OS for its window tiling features,
|
||||
although I might wait for their [Cosmic DE](https://system76.com/cosmic/) to graduate to
|
||||
|
@ -388,4 +399,3 @@ I also still have some [IDE exploration to do](https://blog.mcknight.tech/2025/0
|
|||
As I spend more time using `nvim`, I am starting to use it more for coding tasks and it may become my primary "IDE".
|
||||
In any case, I am actively messing with my `nvim` configuration, so I probably have enough thoughts for another post
|
||||
about that.
|
||||
|
||||
|
|
Loading…
Reference in a new issue