mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-30 14:53:11 +00:00
completions/git: Shorten alias descriptions
I have an alias called "lg" for log --color --graph --pretty=format:\'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\' --abbrev-commit --first-parent Having that in my completions ensures that git commands essentially always use one column at most. That's not great, so we now shorten it to 35 chars (plus an annoying 2 for ".." because I can't be bothered to check for unicode support - an argument for a "string ellipsize", I guess?)
This commit is contained in:
parent
2eae563b82
commit
fcbd9730de
1 changed files with 3 additions and 2 deletions
|
@ -732,8 +732,9 @@ function __fish_git_aliases
|
||||||
begin
|
begin
|
||||||
set -l name (string replace -r '^.*\.' '' -- $key)
|
set -l name (string replace -r '^.*\.' '' -- $key)
|
||||||
# Only use the first line of the value as the description.
|
# Only use the first line of the value as the description.
|
||||||
set -l val (printf '%s\n' $value)[1]
|
# Also shorten it to 35 chars.
|
||||||
printf "%s\t%s\n" $name "Alias for $val"
|
set -l val (printf '%s\n' $value | string replace -r '^(.{0,35}).+' '$1..')[1]
|
||||||
|
printf "%s\t%s\n" $name "Alias: $val"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue