Skip to content
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

How to *not* choose the abbreviation #11

Open
c0deaddict opened this issue Apr 30, 2020 · 8 comments
Open

How to *not* choose the abbreviation #11

c0deaddict opened this issue Apr 30, 2020 · 8 comments

Comments

@c0deaddict
Copy link

I like the idea of this plugin a lot and want to move change all my aliases to this. However, i'm stuck with one use case. Say i have an abbrev defined like this:

abbrev-alias -g gs="git status"

Typing gs<SPACE> or gs<ENTER> will expand the abbreviation, wonderful. But what if I want to run the command gs (ghostscript)? Is there a binding that will cancel the attempt to abbreviate?

@momo-lab
Copy link
Owner

momo-lab commented May 1, 2020

try to <C-x><SPACE> or <C-x><ENTER>

@c0deaddict
Copy link
Author

That works! Thank you :)

@jetm
Copy link

jetm commented Feb 12, 2021

@momo-lab <C-x><SPACE> or <C-x><ENTER> doesn't work for me. Is there another alternative to avoid expanding an abbreviation?

@momo-lab
Copy link
Owner

Please tell me the execution result of the bindkey command.
It may be overwriting the settings created by this plugin.

# bindkey | grep "\^X" 
"^X^B" vi-match-bracket
"^X^F" vi-find-next-char
"^X^J" vi-join
"^X^K" kill-buffer
"^X^M" accept-line    # <- Need this line
"^X^N" infer-next-history
"^X^O" overwrite-mode
"^X^R" _read_comp
"^X^U" undo
"^X^V" vi-cmd-mode
"^X^X" exchange-point-and-mark
"^X " __abbrev_alias::no_magic_abbrev_expand    # <- Need this line
"^X*" expand-word
"^X=" what-cursor-position
"^X?" _complete_debug
"^XC" _correct_filename
"^XG" list-expand
"^Xa" _expand_alias
"^Xc" _correct_word
"^Xd" _list_expansions
"^Xe" _expand_word
"^Xg" list-expand
"^Xh" _complete_help
"^Xm" _most_recent_file
"^Xn" _next_tags
"^Xr" history-incremental-search-backward
"^Xs" history-incremental-search-forward
"^Xt" _complete_tag
"^Xu" undo
"^X~" _bash_list-choices

@momo-lab momo-lab reopened this Feb 13, 2021
@jetm
Copy link

jetm commented Feb 13, 2021

It seems I have the two lines, but I still unable to avoid the expand

$ bindkey | grep "\^X"
"^X^M" accept-line
"^X^R" _read_comp
"^X^S" prepend-sudo
"^X " __abbrev_alias::no_magic_abbrev_expand
"^X." fzf-tab-debug
"^X?" _complete_debug
"^XC" _correct_filename
"^Xa" _expand_alias
"^Xc" _correct_word
"^Xd" _list_expansions
"^Xe" _expand_word
"^Xh" _complete_help
"^Xm" _most_recent_file
"^Xn" _next_tags
"^Xt" _complete_tag
"^X~" _bash_list-choices

@momo-lab
Copy link
Owner

There seems to be no problem with the definition of bindkey.

Since abbrev-alias also registers alias gs ='git status' at the same time, the command equivalent to git status is executed even if gs<C-x><Enter>.
This technique only suppresses prompt expanding.

If you want to suppress the registration of alias, there are currently the following workarounds.

abbrev-alias gs ='git status'
unalias gs

@momo-lab
Copy link
Owner

If <C-x><Enter> key expands to the prompt, I can't think of a cause.
Sorry...

@jetm
Copy link

jetm commented Feb 13, 2021

The problem with unalias gs is gs expand to git status when a press Enter or Space

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants