-
-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathfzf-git.fish
More file actions
26 lines (21 loc) · 970 Bytes
/
fzf-git.fish
File metadata and controls
26 lines (21 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function __fzf_git_sh
# Get the absolute path to the parent directory of this script (i.e. the
# parent directory of fzf-git.sh) to use in the key bindings to avoid
# having to modify `$PATH`.
set --function fzf_git_sh_path (realpath (status dirname))
set --function result (SHELL=bash bash "$fzf_git_sh_path/fzf-git.sh" --run $argv | string join ' ')
if status is-command-substitution && test -n "$result"
echo -- $result
else
commandline --insert $result
commandline -f repaint
end
end
set --local commands branches each_ref files hashes lreflogs remotes stashes tags worktrees
for command in $commands
set --function key (string sub --length=1 $command)
eval "bind -M default \cg$key '__fzf_git_sh $command'"
eval "bind -M insert \cg$key '__fzf_git_sh $command'"
eval "bind -M default \cg\c$key '__fzf_git_sh $command'"
eval "bind -M insert \cg\c$key '__fzf_git_sh $command'"
end