Skip to content

feature request: Expand abbreviation when entering a closing parenthesis #6658

Closed
@scooter-dangle

Description

@scooter-dangle

I didn't find this mentioned in any of the issue titles, but it's possible it was brought up tangentially in an issue around abbr.

Generally when I use an abbreviation in a command substitution, the closing ) unambiguously indicates that the token is complete, at which point it would be convenient if the abbreviation were expanded.

For example, I have the follow abbreviation defined for listing modified files:

abbr --add gsmod 'git ls-files --modified'

If I wanted to open all the modified files, I would run

vim (gsmod)

which works as intended, since the )<CR> combination triggers the expansion to

vim (git ls-files --modified)

However, if I wanted to pass any options to vim after the substitution, the following would not expand and would cause an error when entered

vim (gsmod) -O

since I have no function or commands named gsmod.

The workaround I use is to remember to add an extra space prior to the ) in cases where I know I'll be adding more to the command, which results in

vim (git ls-files --modified ) -O

Granted, there could be consequences of supporting additional expansion triggers that I haven't thought of.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions