Refactor the function to keep an array of commands with requirements
that have to be met. Those commands are then cycled over a wrap around
index instead of the inflexible switch statement.
Instead of overwriting existing aliases, reuse them.
This makes it possible to add multiple flags in multiple calls to
`add_flags` for example when a flag should only be added on certain
systems, etc..
Since both were functions already their place seems more appropriate in
functions.zsh. This also fixes the completion of both, since they did
not complete files before.
Other changes in `unbkp`:
- Use `mv` instead of `cp`
- Fix little typo (forgotten quote) and support specifying the
original name instead of only the backup.
- Do not "rename" the file if there is no change in name
(Leading to the prompt if the file should be overwritten)
This annoys me in more cases than I thought. For example when checking
out a commit in the past in detached head mode and I want to see the
past commits before the current one.
Especially because there is no flag that can disable it again.
The flag has to be passed manually to `glog` now.
On (new) systems where commands are still missing, it is often a little
surprise when commands do not work after zsh-syntax-highlighting colored
them green. That's why I do not want alias to be created when they just
wrap a command with the same name without the command existing.
There also cases like `rm` where I do not want to type out `command rm`
every time just because `trash` is not installed.
Break the loop if `$REPO_DIR` does not exist anymore because it was
deleted other ways instead of looping forever as `git worktree remove`
fails on non-existing directories.
Go back to a simpler approach, that the `fzf-history-widget` is only
called on <C-Up> and ^K in normal mode and <Up> & <Down> scroll through
the history normally.
The reason behind this change is that there were still some edge cases
in which the widget was wrongfully called when normal scrolling was
intended.
This change also makes it now possible that I can use commands in the
'surrounding' of a past command by first navigating to it with the
fzf-widget and then just using <Up> & <Down>.
By adding a shebang to the scripts they can be executed directly without
an interactive shell. The shebang also makes vims modeline that only set
the filetype obsolete.
Pass additional arguments to git-commit so that flags can be passed
e.g `-n` to bypass the commit hooks.
Also use the according completion for `git-commit-last-msg`.
Kill the ssh-agent only if it was created in this session.
Like that the login shell can inherit SSH_AGENT_PID without it killing
the agent at the end. For this to work properly it is important that
LAUNCHED_SSH_AGENT is not exported, otherwise nested login shells will
mess with each other.
Do not unset CHASE_GLOB under android as then globbing with absolute
paths breaks as the PWD is often in a path with subdirectories that are
owned by root and not world-readable (e.g. /data/data/).
I *believe* this is the reason for it.