New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature request: Expand abbreviation when entering a closing parenthesis #6658
Comments
This is easy: bind ')' self-insert expand-abbr I'm gonna have to think some about whether it makes sense as a default. |
A similar issue applies to the other statement terminators |
So good news is we only expand the abbreviation if the cursor is at the end of it. That means if we bind ')' et al to expand them, this only applies if you type e.g. something (smth) and not something (smth )
Tbh I always hated how execute expands abbrs, because that makes using abbrs with the same name as commands (like Tho now that we can bind ctrl-space it's possible to bind that to inserting space without expanding, so it's possibly not as bad. |
I didn't mean Good point, I think Edit: nevermind, we already do this. |
Oh, sorry, missed that!
It is expanded? Unless there's been a super recent change, I've been running 3.1 for a bit now. |
No, it will only be expanded in execute if the token left of the cursor is in command position. $ abbr -g echo echo 123
$ echo $version
^
123 3.1.0
$ echo $version
^
3.1.0 |
Okay, so I made it so that ctrl-space enters a space without expanding abbreviations, and made ")" and alt-enter expand abbreviations. |
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:
If I wanted to open all the modified files, I would run
which works as intended, since the
)<CR>
combination triggers the expansion toHowever, 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 inGranted, there could be consequences of supporting additional expansion triggers that I haven't thought of.
The text was updated successfully, but these errors were encountered: