Git sets some environment variables when executing a shell command.
Specifically it sets GIT_DIR when called inside a submodule. This makes
git inside the subshell target the main worktree instead of the
temporary one.
This way one can easily redirect stderr for both commands (not just
`sort`) and specify a path. The path defaults to the current directory,
but listing each entry by globbing.
List only the local heads by default and require the remote refs to be
passed as arguments. For example:
git track origin
To make this easier, add support of an `--all` flag to list all remote
refs.
When searching for a specific commit in a long history the chronological
sorting can sometimes be annoying. Map ctrl-s to toggle-sort so that the
best result can be at the top.
This commit addresses a couple of issues:
1. fzf's `key-bindings.zsh` was sourced twice: Once in keys.zsh and once
via the symlink in `external-plugins/`. Fix this by removing the
source in `keys.zsh`.
2. The section about the fzf bindings in keys.zsh was a mess. Reorder
and rewrite some comments to make it nicer.
3. My just added custom `fzf-cd-inplace-widget` does not work like this.
Since `key-bindings.zsh` is sourced (was sourced again) after
`keys.zsh`, my override is overridden itself by the default. I
noticed and fixed this when I originally wrote and tested the
function, but unfortunately I forgot the old `bindkey` commands in
`keys.zsh`, which is why I now forgot about it and committed this
erroneously. To fix this, bind the keys after sourcing
`key-binding.zsh` in the newly added `fzf.key-bindings.config.zsh`.
Additionally, move the widget definition as well to have everything
at one place.
Fixes: 3cf445e739 (zsh:keys: Modify fzf's cd widget to be "in-prompt",
2025-08-06)
Currently, fzf's cd widget executes the cd command via accept-line, so
the command is also visible in the scrollback buffer. In contrast to
this, the cd-{forward,backward,up} suite changes the directory in-place,
without touching BUFFER, with an additional prompt redraw (one could say
"in-prompt"). Since I find this more appealing, overwrite the default
fzf widget with a custom one that has the same behaviour.
I don't feel as if I'm actively benefiting from match_prev_cmd and it
definitely makes my prompt slower. (One could probably make it faster by
pre-calculating the history events matching the (previously) executed
command in a preexec zsh-hook and then comparing each successor to the
currently typed command instead of repeating all the work every time
BUFFER changes)
With this change my fork is not needed anymore, so switch back to
zsh-users' repo and update it while at it.
This effectively reverts 77b2d63341 ("zsh:autosuggestions: Use own
fork for now").
I find typing `git {rebase,merge,...} --{continue,abort}` a bit
annoying, since it is a lot of typing. I have added an alias for `rebase
--continue` (grc), but the problem remained for the other commands.
Add a script that continues or aborts the ongoing process by detecting
it automatically.
Previously when calling `glog -- file` with a file that was renamed
sometime in the history, the preview would just be empty for all commits
before the rename, since it's path didn't exist.
Fix this by checking for empty output and falling back to the full patch
in that case.
This also heavily refactors the code around `$fzf_preview` to make it
more readable.
TODO: It would be nice if git-show would fail in this case instead of
just printing nothing and returning zero
Previously when the program name had a trailing slash, `conf` would not
find the right file as it would check for filenames that include a slash
(e.g. `prog/rc`). This was especially annoying, since conf's completion
function inserts a slash automatically when subdirectories exists.