mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Tweak git completion for aliases/stashes
Use the new `read -z` flag to complete git aliases better. This approach won't break if an alias contains a newline. Also fix stash completion, which was broken on BSD sed.
This commit is contained in:
parent
c64f38f0bf
commit
a9c8b75599
1 changed files with 12 additions and 2 deletions
|
@ -84,11 +84,21 @@ function __fish_git_stash_not_using_subcommand
|
|||
end
|
||||
|
||||
function __fish_git_complete_stashes
|
||||
command git stash list --format=format:"%gd:%gs" | sed 's/:/\t/'
|
||||
set -l IFS ':'
|
||||
command git stash list --format=%gd:%gs | while read -l name desc
|
||||
echo $name\t$desc
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_git_aliases
|
||||
command git config --get-regexp '^alias\.' | sed -n "s/^alias\.\([^ ]*\).*/\1/p"
|
||||
set -l IFS \n
|
||||
command git config -z --get-regexp '^alias\.' | while read -lz key value
|
||||
begin
|
||||
set -l IFS "."
|
||||
echo -n $key | read -l _ name
|
||||
echo $name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_git_custom_commands
|
||||
|
|
Loading…
Reference in a new issue