on > zsh mac terminal
if i type c and get the autocompletion suggestion as clear
To accept that suggestion i need to hit right arrow key and then press enter to run it.
I want to change the right arrow key to something else for example ` OR '
Plese help on finding a way to change this behaviour.
You can change bindkey for autosuggest-accept widget.
bindkey '`' autosuggest-accept
Note that this will disable your ability to type ` character directly though.
If you want to execute the autosuggest immediately after hitting `, change autosuggest-accept to autosuggest-execute.
To make this change permanent, add the bindkey line to your ~/.zshrc
If you also want to disable arrow key, you can remove the widget from ZSH_AUTOSUGGEST_ACCEPT_WIDGETS array.
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=("${(#)ZSH_AUTOSUGGEST_ACCEPT_WIDGETS:#forward-char}")
As a more out-of-the-box solution, I just found out here that you can use:
CTRL+E
instead of the right arrow, and it will accept the autosuggestion.
In the link they refer to it as "end-of-line in emacs mode", but I didn't configure anything of the sort, so I guess it just works.
Related
In zsh-autosuggestions the TAB key accepts the suggestion but then also tries providing more suggestions, which is a difference in behaviour from fish-shell.
In fish if you Tab it completes the word and doesn't offer anything else until you start typing something more (ie suggestions aren't triggered on whitespace).
In zsh-autosuggestions, you can only get this behaviour by using the → key.
So how can I remap the → to behave like Tab (or alternatively how can I remap Tab to behave like →).
Thanks
from the docs:
bindkey '^ ' autosuggest-accept
my setting, which binds ctrl+space to accept then execute the suggestion:
bindkey '^ ' autosuggest-execute
I am in the Edit Command mode Shortcuts dialog and things seem reasonable ..
But the actual behavior is a different story
When using the Option modifier (plus a non-modifier key) it just ends up printing a high-ascii character value in the add shortcut area .. and then when I refresh the page it has gone away.
I can not get Command modifier (plus a non-modifier key) to work at all. It is jus ignored.
The Control modifier (plus any key) is completely ignored.
So there is a basic usability misunderstanding here. Advice appreciated.
I added 'Ctrl-Q' as a shortcut to restart kernel and run all the cells. You can see the picture below. It is working fine. In the 'Ctrl-Q', 'Q' was just lowercase and it ran successfully.
While willing to write ↩a as a new shortcut for the run all cells above command I could not find how to specify the return symbol in Jupyter Notebook.
Writing return-a or ↩-ain the Edit Command Mode does not work and the modifier is not specified in the help dialog.
Any idea?
Return is not a modifier so shortcut like ↩-a make little sens (pressing enter and A at the same time. ↩,a meaning Return key followed by A key make more sens, but Enter is so pervasive for many actions that it is not usable in user shortcuts. I would suggest you to open an issue on jupyter/notebook on GitHub to ask for return to be added as a convenient way to map to ↩ , though even if we do that we can't guaranty that it will work. If you are willing to try to code that yourself, have a look at keyboard.js, the mapping from enter to displaying ↩ is already done in quickhelp.js, for mac at least.
My .zshrc file contains the line
bindkey -v
I'm attempting to bind ^q or \M-q to push-line, e.g.
bindkey "^q" push-line
but for some reason it isn't working.
Running `bind key -v' confirms
"^Q" push-line
But it doesn't actually do anything. Other control- mappings, such as ^r, work fine.
I can successfully map "push-line" to "\eq", but I don't like this behavior. First of all, I never use esc- type bindings, and secondly doing so binds it to control, meta, and escape, which is overkill. (Incidentally, shouldn't it only bind all of them like that with `bindkey -m'? I never set that in my .zshrc?)
So, anybody have any idea what's going on here?
These shortcuts are used by Software flow control (wikipedia)
Ctrl+S and Ctrl+Q are used to stop and resume the output of a program.
To try it:
Run while (true) ; do echo $RANDOM ; sleep 1 ; done
Press Ctrl+S, the output stop.
Press Ctrl+Q, the output resume.
(I'm not sure the program is stopped like with Ctrl+Z, i think it is stuck by lack of outputting. Ctrl+C to kill the program.)
These shortcuts take over your shortcuts, but if you disable this flow control feature, it could work.
You can learn how to disable it in How to unfreeze after accidentally pressing Ctrl-S in a terminal? - Unix and Linux.
Try it and tell us.
I have completion menu configured in my zsh. It works great, no problem.
Now I want to make my zsh act like that:
Let's say there are 3 files in a directory:
somefile_first
somefile_second
somefile_third
Now when I press [TAB], I get completion menu with the first file placed in the command line.
But I want zsh to complete the common part of file names (in this example it would be somefile_), do not place anything else after the common part, and let me navigate through completion menu.
How do I do that?
I realize this question is old but I stumbled upon it when looking for the same answer. Here is what I found out.
AFAIK when using completion menu zsh will always place highlighted completion in the command line. However you can make it less hasty.
unsetopt menucomplete
setopt automenu
Changes the behaviour so
first TAB completes the common part
second lists completions without changing command line
third starts the menu and completes command line with highlighted completion
If you prefer no command line changes than fancy menu unset automenu too:
unsetopt menucomplete automenu
That gives bash-like completion. Only common part is completed and propositions are listed.