Skip to content

[limitation] ​global abbreviations do not support leading and/or trailing whitespace #169

Description

@5A6F65

Is there an existing issue for this?

  • I have searched the existing issues

Update the issue title

  • I have updated the title

Expected Behavior

​Global abbr with space prefixes should indeed expand, as user abbr with space prefixes expand correctly; their behaviors ought to be consistent.​
I'm unsure whether this is a bug or the intended behavior. However, since I'm working on supporting f-sy-h highlighting of multi-word abbreviations, this behavior directly affects how I should handle global abbreviations. Therefore, I've opened an issue to inquire about this matter.
If it's determined to be a bug, I may attempt to open a pr to fix it after completing my current work.

Actual Behavior

​Global abbr with space prefixes cannot be expanded.

Steps To Reproduce

abbr 'test0'='Test0'
abbr ' test1'='Test1'
abbr -g 'test2'='Test2'
abbr -g ' test3'='Test3'

test0[Space]     # expands to `Test0`
 test0[Space]    # expands to ` Test0`
test1[Space]     # does not expand
 test1[Space]    # expands to `Test1`
test2[Space]     # expands to `Test2`
 test2[Space]    # expands to ` Test2`
test3[Space]     # does not expand
 test3[Space]    # does not expand, but should expand to `Test3`

test && test0[Space]     # does not expand
test &&  test0[Space]    # does not expand
test && test1[Space]     # does not expand
test &&  test1[Space]    # does not expand
test && test2[Space]     # expands to `test && Test2`
test &&  test2[Space]    # expands to `test &&  Test2`
test && test3[Space]     # does not expand
test &&  test3[Space]    # does not expand, but should expand to `test && Test3`

Environment

zsh-abbr version 6.2.1
zsh 5.8.1 (x86_64-ubuntu-linux-gnu)
OSTYPE linux-gnu

Installation method

Plugin manager

Installation method details

zdharma-continuum/zinit v3.14.0

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status
    Nice To Have

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions