mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
abbr: Bail early when the abbr already exists
This speeds up the common case of `abbr -a` calls in config.fish by about 90% - from 900ms to 90ms for 100 calls.
This commit is contained in:
parent
89206d8654
commit
585bdf45c8
1 changed files with 3 additions and 0 deletions
|
@ -72,6 +72,9 @@ function abbr --description "Manage abbreviations"
|
||||||
|
|
||||||
switch $mode
|
switch $mode
|
||||||
case 'add'
|
case 'add'
|
||||||
|
# Bail out early if the exact abbr is already in
|
||||||
|
# This depends on the separator staying the same, but that's the common case (config.fish)
|
||||||
|
contains -- $mode_arg $fish_user_abbreviations; and return 0
|
||||||
set -l key
|
set -l key
|
||||||
set -l value
|
set -l value
|
||||||
__fish_abbr_parse_entry $mode_arg key value
|
__fish_abbr_parse_entry $mode_arg key value
|
||||||
|
|
Loading…
Reference in a new issue