-
Notifications
You must be signed in to change notification settings - Fork 2k
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] Place the cursor at a given place after an abbr #2287
Comments
Thanks for the kind words :) Is the idea that you want to have the cursor inside the closing quotes. That makes a lot of sense, and is something that global aliases definitely could not do. Do you have ideas for what the syntax for this could be? Also, what would you like or expect to happen if you press return after typing the abbreviation but before it expands? Today that expands and then executes it; maybe it should just expand it. |
If I may interject - Today, I can't see a way to execute something called |
@faho that is what happens today for abbreviations, and I think everyone likes that. But the idea here is a new mode, a sort of "abbreviation template," that expands and then puts the cursor somewhere for you to edit (in this case, presumably a table name). So the command doesn't make sense to run on its own. Here's another (not fully formed) idea: maybe abbreviations should just be functions:
and now the abbreviation itself takes an argument: This also would let us use tab completion with abbreviations. This means abbreviations are starting to look just like functions - well, maybe that's a good thing. |
It's not.
That's just what alias does, isn't it? Or do you want it do be expanded when you enter it interactively? In that case, the function would need to be parsed for a "$argv" - and how would that work with multiple occurences of it? Instead, I'd rather have a "special token" for abbr, like
or, considering find and xargs as prior art "{}" - though of course there's a bug about that. If that token occurs, after expansion the cursor is placed at that position (with the token removed). The underlying assumptions are of course that the token will be reasonably uncommon (since it would need to be masked if it were to occur) and that there isn't much more functionality to add to abbr, so it makes sense not to generalize it much more. |
Hi,
I see it like this : Case their is no $CURSOR (or something else) defined and user press enter Case their is no $CURSOR (or something else) defined and user press space Case their is a $CURSOR defined and user press enter Case their is a $CURSOR defined and user press space |
Hope this will be integrated to fish. We plan to work with "GitFlow" git workflow and I'll set some abbreviations. But for some abbreviations, I need to place the cursor inside the command:
This would allow typing quickly:
|
Sorry that I replied that stupid message. |
I think you didn't understand my message ^^ I never talked about Fish workflow ;) |
I am sorry that I didn't understand your message. I know what you mean now. I think you can just:
For example, abbr In addition, I think you can also create a function to just |
I'm also interested in creating abbreviations where you can define the final caret position. My use case is similar to what @pickfire describes above (need to get rid of the space after expanding). |
If I define an abbr like |
Hey @cmarqu, in the particular case of placing cursor between the quotes, you may be interested in using pisces plugin (I'm the author), then you can define your alias like For the issue in general, there is a plugin with similar functionality: oh-my-fish/plugin-expand, it's like |
any progress on this? |
Nobody is working on this AFAIK |
I came across this while looking for a way to expand one of my abbreviations without having the extra whitespace added at the end. It seems that isn't possible right now, and this proposal would make that (and more) possible. Is there an appetite for a smaller scoped "expand without whitespace" feature in lieu of this one being implemented? |
This would be super useful for pasting URLs on various commands.
|
Paste it inside of single-quotes: curl ' then paste. This will escape all |
I would really like such an option, actually (lets denote it # I sometimes need to call binaries from /usr/local/bin/
abbr -X -a -- ul /usr/local/bin/ Or to construct abbreviations for programs that require an single argument without any spaces: # search bibliography based on either author or title
abbr -X -a -- pla 'pubs list author:'
abbr -X -a -- plt 'pubs list title:' |
You can use a key binding, let's say Alt+AAlt+U |
Another use case: when using fish's |
Is anyone working on this, either the |
I am not aware of anyone working on it. |
this is now implemented by the new |
Hi,
I love abbreviation, it always show me the right command.
But sometimes I need to put the cursor at a given place, is it possible to do that ?
Example :
and so, after typing "describe" I would like to have my cursor at $CURSOR
Thank you for this awesome shell ;)
The text was updated successfully, but these errors were encountered: