completions: [git] Use builtin git truncation

This commit is contained in:
George Christou 2018-04-02 21:51:07 +01:00 committed by Fabian Homborg
parent c6e7b7ef00
commit 6c0f31d622

View file

@ -6,16 +6,14 @@ function __fish_git_commits
# This allows filtering by subject with the new pager! # This allows filtering by subject with the new pager!
# Because even subject lines can be quite long, # Because even subject lines can be quite long,
# trim them (abbrev'd hash+tab+subject) to 73 characters # trim them (abbrev'd hash+tab+subject) to 73 characters
command git log --pretty=tformat:"%h"\t"%s" --all --max-count=1000 2>/dev/null \ command git log --pretty=tformat:"%h"\t"%<(64,trunc)%s" --all --max-count=1000 2>/dev/null
| string replace -r '(.{73}).+' '$1…'
end end
function __fish_git_recent_commits function __fish_git_recent_commits
# Like __fish_git_commits, but not on all branches and limited to # Like __fish_git_commits, but not on all branches and limited to
# the last 50 commits. Used for fixup, where only the current branch # the last 50 commits. Used for fixup, where only the current branch
# and the latest commits make sense. # and the latest commits make sense.
command git log --pretty=tformat:"%h"\t"%s" --max-count=50 2>/dev/null \ command git log --pretty=tformat:"%h"\t"%<(64,trunc)%s" --max-count=50 2>/dev/null
| string replace -r '(.{73}).+' '$1…'
end end
function __fish_git_branches function __fish_git_branches