Update the build-dir shell function to usage zcurses instead of the Python pick package to interactively select build directories, this results in a more responsive user experience. Add argument parsing to handle various use cases. Add prompt when the build command for the selected build directory could not be detected, allowing the user to specify the desired build command. ``` usage: build-dir [-h] [--build] [<directory>] Find and select the current build directory interactively. positional arguments: <directory> the build directory to select optional arguments: -h, --help show this help message and exit --build invoke a build after selection ```
Zsh Configuration
conduit
Simple, local, configuration manager.
Installation of the configuration files in this repository is orchestrated by
conduit as defined in the .conduit.yaml
file. This
includes Zsh package installs, setting Zsh as the users default
shell, and symbolic linking file such as zshrc
to ~/.zshrc
, and
cloning plugin repositories. The repository is cloned to ~/.config/zsh
.
Prompt
A custom prompt theme called "fresh" is used by default, its defined in
prompt_fresh_setup and symbolic linked to
~/.local/share/zsh/site-functions
which is on the fpath
. The prompt enabled
using prompt fresh
when the prompt subsystem is enabled. The prompt is
multi-line and does not redraw during command editing. The first line of the
prompt is drawn using a precmd
hook and displays variable length information
such as the time, current directory, Git repository branch and status,
and the last commands exit code if its non-zero.
Git Status
The "fresh" theme supports displaying Git repository status information, the
majority of this information is gathered using a C program which is compiled on
the fly when the theme is enabled, it resides in ~/.cache/zsh/git-prompt
and
is removed when the theme is disabled. Since the C program uses the standard
library, development headers must be present in addition to the compiler.
zsh-git-prompt was originally used but proved to be agonisingly
slow on large repositories containing many unstaged changes. Instead the
git-prompt
C program calls git status --porcelain
, which is extremely fast,
and parses the output in a loop. Output from git-prompt
is a space separated
list of interesting numbers which is captured in a Zsh array and interpreted for
display. This results in no noticeable lag when redrawing the prompt.
Plugins
Plugins are sourced manually and their git repositories tracked by conduit, no plugin manager is used.
- zsh-syntax-highlighting Fish shell like syntax highlighting for Zsh.
- zsh-history-substring-search Zsh port of the Fish shell's history search.
Environment & Settings
The bulk of, if not all, configuration occurs in zshenv
and
zshrc
these files.
~/.local
In addition to /usr/local
add ~/.local
to useful environment variables. This
is especially useful with pip install --user <package>
.
- Add
~/.local/share/zsh/site-functions
tofpath
- Add
~/.local/bin
toPATH
- Add
~/.local/share/man
toMANPATH
- Add
~/.local/share/info
toINFOPATH
History
Command history is stored in ~/.cache/zsh/histfile
, duplicates are removed,
and multi-terminal history support is enabled.
Line Editor
The vi mode line editor is enabled. zsh-vim-mode was a reasonable starting point but was replaced as it uses some strange defaults.
Cursor Shape
In order to easily ascertain which vi mode the line editor is currently using
escape sequences are sent to the terminal emulator on certain events to change
the current shape of the cursor. Two cursor shapes are used; block for vicmd
mode; a vertical line for viins
mode. Additional escape sequences are used
when tmux is detected to ensure the terminal emulator receives the
appropriate sequence. iTerm2 and VTE compatible terminal emulators are
supported.
Three hooks are registered with the line editor; zle-keymap-select
changes the
cursor shape then the mode is changed; zle-line-init
changes the shape
starting editing a new command; and zle-line-finish
resets the cursor shape
when the line edit is complete.
vicmd
Mode
Undo and repo and enabled using u
and U
. Showing help for the command under
the cursor with <Esc>h
is replaced with K
. The Vim "Ex" mode binding
:
is disabled mode since is barely of use and easy to enter accidentally.
Bindings for k
and j
integrate with zsh-history-substring-search
performing up and down searches respectively.
Edit Command Line
When editing a command using Zsh's line editor becomes cumbersome due to length
the <Ctrl>+V
binding opens the default editor (Vim) to edit the current
command.
Miscellaneous
Interactive comments are enabled, useful when creating demo GIF's of terminal
program usage. Ignore end of file, bound to <Ctrl>+D
, is disabled to avoid
accidentally exiting the terminal.
Audio beeps are disable. Terminal flow control is disabled, this allows
Vim and other terminal programs to use <Ctrl>+S
mapping/binding, this
proves useful as the S
key is in the middle of the home row on QWERTY
keyboards.
Completion
The completion subsystem is enable, any custom completions should be symbolic
linked to ~/.local/share/zsh/site-functions
.
Aliases
Various aliases are defined at the end of zshrc for convenience.