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

Makes history-substring-search use term specific up and down buttons. #2511

Merged
merged 2 commits into from Apr 19, 2014
Merged

Makes history-substring-search use term specific up and down buttons. #2511

merged 2 commits into from Apr 19, 2014

Conversation

FlorianFranzen
Copy link
Contributor

Fixes #2089 and problems with some linux distributions and/or terminals.

@thuandt
Copy link
Contributor

thuandt commented Mar 13, 2014

@robbyrussell : pls merge this commit to fix history-substring-search plugin broken after merge #1355

@EspadaV8
Copy link
Contributor

This fixes #2614 for me as well.

@FlorianFranzen
Copy link
Contributor Author

@robbyrussell: We have three testers here and it is a no-brainer fix. Furthermore $terminfo should be used by default throughout oh-my-zsh (as #2614 and other have show), so I am not sure what you are waiting for. Please merge this!

@ncanceill
Copy link
Contributor

#2634 was merged two days ago, and terminfo is now used for all OMZ key-bindings. Did that not solve the issue?

@EspadaV8
Copy link
Contributor

The history substring search plugin uses keybindings that weren't changed in #2634

@ncanceill
Copy link
Contributor

Oh yes, you are right. Though maybe you could add checks with if statements similar to #2634.

👍 anyway

@barraponto
Copy link

🍰 yay, it fixes it for me too!

@barraponto barraponto mentioned this pull request Mar 24, 2014
@mcornella
Copy link
Member

Hi, $terminfo has shown to be unreliable between different setups, as you can see in #2608 and #2614. A PR was submitted to check for valid $terminfo values as seen here and here, maybe you should add that too.
I realize now I'm saying the same as @ncanceill, but I already wrote that so I'll say it anyway :)

@FlorianFranzen
Copy link
Contributor Author

Alright, I added the check all of you have been asking for. I am not sure why in all of the examples you linked to never was a default key binding one would fallback to in the case terminfo is not available. Never the less these patches seemed to have been merged upstream, so I guessed it is ok if I do it the same way, even if it is just for the sake of simplicity and consistency.

@mcornella
Copy link
Member

Adding a fallback is definitely a work to be done, but right now it doesn't seem easy to figure out which keycode to use.. Either way, it should be the same in this file as well as in lib/key-bindings.zsh, so it works as expected.

@freiden
Copy link

freiden commented Mar 25, 2014

This fix works for me +1 (tested on ubuntu 12.04 and OSX 10.8.5)

@derhasi
Copy link

derhasi commented Mar 26, 2014

This fixes #1433 also for me, using Mac OS X ... +1

@mgol
Copy link

mgol commented Mar 26, 2014

I wanted to test it but it no longer merges cleanly with master. Can you rebase?

@mgol
Copy link

mgol commented Mar 26, 2014

I checkouted this PR and it still doesn't work for me. I'm on OS X 10.9.2, system zsh (zsh 5.0.2 (x86_64-apple-darwin13.0)); also:

$ infocmp
#   Reconstructed via infocmp from file: /usr/share/terminfo/78/xterm-256color
xterm-256color|xterm with 256 colors,
    am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
    colors#256, cols#80, it#8, lines#24, pairs#32767,
    acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
    bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
    clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
    csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
    cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
    cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
    cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
    dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
    flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
    ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
    ind=^J, indn=\E[%p1%dS,
    initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
    invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~,
    kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D,
    kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H,
    kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
    kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
    kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
    kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
    kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
    kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
    kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
    kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
    kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
    kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
    kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
    kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
    kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
    kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
    kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
    kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
    kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
    kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
    kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
    kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
    kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
    memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
    rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
    rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
    rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
    setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
    setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
    sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
    sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
    smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
    smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
    u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

@karlhungus
Copy link

This didn't work for me

{23:20}~ ➭ zsh --version
zsh --version
zsh 5.0.5 (x86_64-apple-darwin13.0.0)

fwiw

{23:20}~ ➭ infocmp
infocmp
#   Reconstructed via infocmp from file: /usr/share/terminfo/78/xterm
xterm|xterm terminal emulator (X Window System),
    am, bce, km, mc5i, mir, msgr, npc, xenl,
    colors#8, cols#80, it#8, lines#24, pairs#64,
    acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
    bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
    clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
    csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
    cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
    cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
    cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
    dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
    flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
    ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
    ind=^J, indn=\E[%p1%dS, invis=\E[8m,
    is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~, kEND=\E[1;2F,
    kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~,
    kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H, kcbt=\E[Z,
    kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
    kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
    kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
    kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
    kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
    kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
    kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
    kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
    kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
    kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
    kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
    kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
    kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
    kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
    kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
    kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
    kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
    kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
    kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
    kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
    kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
    memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
    rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
    rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
    rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
    setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
    setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
    setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
    sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
    sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
    smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
    smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
    u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

@mcornella
Copy link
Member

@mzgol and @karlhungus: type Ctrl+V, then press Up arrow and post the output. Do the same with Down arrow

@karlhungus
Copy link

Here you go (Up arrow followed by Down arrow)

{8:33}~ ➭ ^[OA
AAzsh: command not found: ^[OA
{8:33}~ ➭ ^[OB

@mufasa71
Copy link

I confirm that this PR is fixes problemn with UP and DOWN keys on st + zsh terminal

@neeravkumar
Copy link

Thanks, works for me too.

@mpaltun
Copy link

mpaltun commented Apr 4, 2014

works for me, too

@fabn
Copy link

fabn commented Apr 4, 2014

Works for me on Ubuntu 12.04

@wildjcrt
Copy link

wildjcrt commented Apr 7, 2014

Nice! works for me.
Mac OSX 10.9

@AndrewGuenther
Copy link

Works for me on Ubuntu 13.10

robbyrussell added a commit that referenced this pull request Apr 19, 2014
Makes history-substring-search use term specific up and down buttons.
@robbyrussell robbyrussell merged commit 5eb5f71 into ohmyzsh:master Apr 19, 2014
@vbajpai
Copy link

vbajpai commented Apr 20, 2014

This merge broke history-substring-search capability for me. I am using OS X 10.9.2 with default terminal declared as xterm-256 color.

% echo $TERM
xterm-256color

# CTRL-V + <up key> and CTRL-V + <down key>
% ^[[A^[[B

If I instead declare the terminal as rxvt, the capability is back.

% echo $TERM
rxvt

# CTRL-V + <up key> and CTRL-V + <down key>
% ^[[A^[[B

@mcornella
Copy link
Member

@vbajpai, can you post the output of infocmp with both TERM=xterm-256color and TERM=rxvt ?

@ahal
Copy link

ahal commented Apr 25, 2014

This merge broke history-substring-search for me as well (on Fedora 20). Here's the output you requested:
https://gist.github.com/ahal/11291519

@beeender
Copy link

This broke for me on gnome-terminal 3.12.0

# CTRL-V + <up key> and CTRL-V + <down key>
% ^[[A ^[[B
# echo "$terminfo[kcuu1]"
% A
# echo ${terminfo[kcud1]}
% B

@CoreyWinkelmann
Copy link

I am having the same issue as @vbajpai and the same output as @beender. If I remove the code merged in and use the bindkey that existed before it works again for me.

bindkey '\e[A' history-substring-search-up
bindkey '\e[B' history-substring-search-down

@bsiegel
Copy link
Contributor

bsiegel commented May 2, 2014

This also broke for me. I'm on OS X 10.9.2. My $TERM is screen-256color. It looks like screen-256color and xterm-256color both set kcud1=\EOB, ..., kcuu1=\EOA, (rather than kcud1=\E[B, ..., kcuu1=\E[A, which is how they're set for rxvt).

Here's my infocmp:

#       Reconstructed via infocmp from file: /usr/share/terminfo/73/screen-256color
screen-256color|GNU Screen with 256 colors,
        am, km, mir, msgr, xenl,
        colors#256, cols#80, it#8, lines#24, ncv#3, pairs#32767,
        acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
        clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M,
        csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
        cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
        cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
        cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
        dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0,
        flash=\Eg, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@,
        il=\E[%p1%dL, il1=\E[L, ind=^J, initc@, is2=\E)0, kbs=^H,
        kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
        kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
        kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
        kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
        khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
        nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O,
        rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m,
        rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7,
        setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
        setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
        sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
        sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h,
        smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g,

And for reference, with rxvt:

#       Reconstructed via infocmp from file: /usr/share/terminfo/72/rxvt                                                                                                                            [53/101]
rxvt|rxvt terminal emulator (X Window System),
        am, bce, eo, mir, msgr, xenl, xon,
        colors#8, cols#80, it#8, lines#24, ncv@, pairs#64,
        acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l,
        clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M,
        csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
        cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
        cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
        dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K,
        enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H,
        hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
        il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l,
        is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l,
        kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kIC=\E[2$, kLFT=\E[d,
        kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, ka1=\EOw, ka3=\EOy,
        kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, kcub1=\E[D,
        kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~,
        kel=\E[8\^, kend=\E[8~, kent=\EOM, kf0=\E[21~, kf1=\E[11~,
        kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~,
        kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~,
        kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~,
        kf21=\E[23$, kf22=\E[24$, kf23=\E[11\^, kf24=\E[12\^,
        kf25=\E[13\^, kf26=\E[14\^, kf27=\E[15\^, kf28=\E[17\^,
        kf29=\E[18\^, kf3=\E[13~, kf30=\E[19\^, kf31=\E[20\^,
        kf32=\E[21\^, kf33=\E[23\^, kf34=\E[24\^, kf35=\E[25\^,
        kf36=\E[26\^, kf37=\E[28\^, kf38=\E[29\^, kf39=\E[31\^,
        kf4=\E[14~, kf40=\E[32\^, kf41=\E[33\^, kf42=\E[34\^,
        kf43=\E[23@, kf44=\E[24@, kf5=\E[15~, kf6=\E[17~,
        kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~,
        khome=\E[7~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
        kslt=\E[4~, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
        rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>,
        rmso=\E[27m, rmul=\E[24m,
        rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H,
        rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h,
        s0ds=\E(B, s1ds=\E(0, sc=\E7, setab=\E[4%p1%dm,
        setaf=\E[3%p1%dm,
        sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;,
        sgr0=\E[m\017, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h,
        smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g,
        u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c,
        vpa=\E[%i%p1%dd,

And xterm-256color:

#   Reconstructed via infocmp from file: /usr/share/terminfo/78/xterm-256color
xterm-256color|xterm with 256 colors,
    am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
    colors#256, cols#80, it#8, lines#24, pairs#32767,
    acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
    bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
    clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M,
    csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
    cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
    cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
    cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM,
    dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K,
    flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG,
    ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L,
    ind=^J, indn=\E[%p1%dS,
    initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\,
    invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kDC=\E[3;2~,
    kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D,
    kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, kb2=\EOE, kbs=^H,
    kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA,
    kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~,
    kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q,
    kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~,
    kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~,
    kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~,
    kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S,
    kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~,
    kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~,
    kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q,
    kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~,
    kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~,
    kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~,
    kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q,
    kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~,
    kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~,
    kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~,
    kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~,
    kf8=\E[19~, kf9=\E[20~, khome=\EOH, kich1=\E[2~,
    kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
    kri=\E[1;2A, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El,
    memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM,
    rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l,
    rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m,
    rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7,
    setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
    setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
    sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
    sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h,
    smir=\E[4h, smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m,
    smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n,
    u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd,

@naegelejd
Copy link

There are a lot of people using vi-mode who can't use the history-substring-search plugin after this merge. Please see #2735. Does anyone have any advice on the best way to fix this? The simplest fix I've found is using BOTH the hardcoded values for up/down keys and the $terminfo key lookup:

--- a/plugins/history-substring-search/history-substring-search.zsh
+++ b/plugins/history-substring-search/history-substring-search.zsh
@@ -167,9 +167,18 @@ zmodload zsh/terminfo
 if [[ -n "$terminfo[kcuu1]" ]]; then
   bindkey "$terminfo[kcuu1]" history-substring-search-up
 fi
+if [[ -n "$terminfo[cuu1]" ]]; then
+  bindkey "$terminfo[cuu1]" history-substring-search-up
+fi
 if [[ -n "$terminfo[kcud1]" ]]; then
   bindkey "$terminfo[kcud1]" history-substring-search-down
 fi
+if [[ -n "$terminfo[cud1]" ]]; then
+  bindkey "$terminfo[cud1]" history-substring-search-down
+fi
+
+bindkey '\e[A' history-substring-search-up
+bindkey '\e[B' history-substring-search-down

I'm sorry I don't know more about zsh key-bindings.

ebothmann added a commit to ebothmann/on-good-terms that referenced this pull request Jun 17, 2014
@billcarroll
Copy link

This is broken for me on Mac OS 10.9.3.

The workaround to get this working for me was to add the following to my .zshrc

# bind UP and DOWN arrow keys
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down

@mgol
Copy link

mgol commented Jun 24, 2014

Latest master works fine for me in OS X 10.9.3 without any manual bindings in .zshrc. I reported it being broken even after merging this PR so something must have changed in the meantime.

@vbajpai
Copy link

vbajpai commented Jul 13, 2014

@billcarroll 's solution works for me (running OS X 10.9.3)

john-kurkowski added a commit to john-kurkowski/dotfiles that referenced this pull request Mar 22, 2015
@apjanke
Copy link
Contributor

apjanke commented Jul 7, 2015

@naegelejd: vi-mode appears broken with respect to the terminfo usage this PR introduced. #1533 introduced a logic error in zle-line-init and zle-line-finish that leaves things in the wrong smkx/rmkx mode so the terminfo bindings don't work. See discussion under #2735.

@mcornella mcornella removed the Status: testers needed Pull Requests that are waiting for testers to merge label Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: plugin Issue or PR related to a plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

history-substring-search should use term specific up and down buttons: