IPython-like termination for zsh?

I wonder if there is a way to use ipython-like termination in zsh?

I mean that in ipython you can enter several characters and then scroll through the history of commands, but this will only affect those commands that begin with the characters that you typed in the first place.
If your story looks like this:

token = 'something blah blah'    
import os
token.split()

.. and then you type tokenand iterate over the history in ipython, you will get only the 1st and 3rd lines.

So, is there a way to get zsh to work this way?

+4
source share
1 answer

history-beginning-search-backward history-beginning-search-forward. , bindkey.

bindkey "^[[5~" history-beginning-search-backward
bindkey "^[[6~" history-beginning-search-forward

^[[5~ - [[6~ . .

cat -v . terminfo zsh/terminfo ( , . zshmodules(1) zshbuiltins(1) zsh), knp ( ) kpp ( ):

if (( ${+terminfo[knp]} )) && (( ${+terminfo[kpp]} )); then
     bindkey "${terminfo[kpp]}" history-beginning-search-backward
     bindkey "${terminfo[knp]}" history-beginning-search-forward
fi

, , , ( , ipython ), .

+2

Source: https://habr.com/ru/post/1533009/


All Articles