Move `git-track` into its own autoloadable function.
This way it is better maintainable as in one-liner format and brings the
possibility of having more complexity (e.g. for better portability).
By that it is also now executable as `git-spull` as well as `git spull`
as before.
Wrap lines at 80 columns where appropriate and I had the energy to think
about how/where to wrap.
There are still lines longer than that, which I plan to wrap in the
future. But that is enough for now.
For deleting a word while in the shell, I find it easier/faster to use
emacs bindings or Ctrl-Backspace and backward-kill-word instead of the
vi version.
In tmux, Ctrl-H (same esacape sequnce as Ctrl-Backspace) is used for
switching panes since f11b7fa56545 ("vim,tmux:plugs: Add
`vim-tmux-navigator`"), so I need to use Ctrl-W.
As that is bound to vi-backword-kill-word, rebind it to use the emacs
version.
Display only `user` when not in a remote shell and `user@hostname` when
connected.
Display the content in bold when running with privileges (no SSH & SSH).
Have those three always the furthest right in the `RPROMPT`. Also
reorder them to be in this order (up -> down : left -> right):
- background_jobs
- command_execution_time
- status
Add an alias that switches directories into the repository root, instead
of having the normal `cd` command behave like that.
Sadly this is not possible (AFAIK) with a git alias as that will always
spawn a subshell.
When using the zettel as a commit message this is also convenient as git
will ignore everything behind it. (Which also means that all horizontal
rulers in a zettel should use atleast 4 dashes)
zshcompsys(1):
> The function bashcompinit provides compatibility with bash's
> programmable completion system. When run it will define the functions,
> compgen and complete which correspond to the bash builtins with the
> same names. It will then be possible to use completion specifications
> and functions written for bash.
Instead of exec-ing the tmux process, run it normally and exit
afterwards. Otherwise the zlogout is not read as mentioned a couple of
lines above and in `zsh(1)`:
> However, if the shell terminates due to exec'ing another process, the
> logout files are not read.
When connected over ssh and attaching to/creating a tmux session, the
shell should `exec` the tmux command so that detaching from the session
automatically also closes the ssh connection.
If something should happen and the `tmux` command bricks the remote
shell this can fixed by logging in with:
ssh [destination] zsh -dfi
Escape slashes in the branch name before passing it to `mktemp`.
Otherwise it would complain with:
mktemp: invalid suffix [...], contains directory separator
Add description in one sentence and use cases for this.
Remove sentence about removing `TEMP_DIR` that is outdated since:
5a8b5ffd21 ("git:checkout-worktree: Use `mktemp` template")
Use a template that directly includes the repository name and the branch
checked out. This makes finding and deleting the worktree directory if
anything goes wrong a lot easier.
Checkout the worktree directly in the temporary directory. With that
`TEMP_DIR` becomes obsolete.
Fix the exit condition when the function is called outside of a git
repository.
Use zsh's `:t` History Expansion Modifier, as `$?` does not keep `git
rev-parse`'s exit code, but rather `basename`'s.
Split `toplevel` definition and assignment as the `local` builtin has
it's own exit code. Thus the function previously did not return if the
`PWD` was not in a git repo.