Git Product home page Git Product logo

Comments (7)

whatyouhide avatar whatyouhide commented on May 20, 2024

Even if the README says Ubuntu 12.04 users have to bind keys differently (and I'm on OSX), I found that binding ^[[A and ^[[B works for me.

Closing for now, but you may want to update the README.

from zsh-history-substring-search.

RGBD avatar RGBD commented on May 20, 2024

Same problem with Fedora 21.
Binding ^[[A and ^[[B works.
You may want to update README.md

from zsh-history-substring-search.

sunaku avatar sunaku commented on May 20, 2024

@RGBD done in c4a8356, thanks! 👍

from zsh-history-substring-search.

apjanke avatar apjanke commented on May 20, 2024

This isn't necessarily a platform-dependent problem per se; it depends on whether zsh has been customized to set the cursor keypad to application mode while ZLE is active. The current Oh My Zsh and some Linux distros do so; the default is to not. The terminfo entries for the arrow keys and home/end only apply to their behavior in application cursor mode, not default cursor mode. (See man terminfo.) Those platforms or systems where you're seeing the need to fall back to hardcoded values instead of terminfo entries are those where they have the default zsh behavior of leaving the terminal in normal cursor mode while ZLE is active.

The behavior may also vary depending on what terminal and $TERM value you are using.

from zsh-history-substring-search.

z0rc avatar z0rc commented on May 20, 2024

@apjanke can you point to where OMZ sets mentioned ZLE customization? I don't use OMZ, but want to replicate similar behavior in my dotfiles.

from zsh-history-substring-search.

apjanke avatar apjanke commented on May 20, 2024

Sure. It's done by using echoti smkx/rmkx in zle-line-init and zle-line-finish. This is set up in lib/key-bindings.zsh in the core OMZ code. You'll also need to do a zmodload zsh/terminfo first to make $terminfo available.

if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  function zle-line-init() {
    echoti smkx
  }
  function zle-line-finish() {
    echoti rmkx
  }
  zle -N zle-line-init
  zle -N zle-line-finish
fi

My personal thinking is coming around to the idea that zsh extensions and "plugins" that bind cursor keys (up/down/left/right/home/end) should bind both the $terminfo[kc*] sequence and the corresponding hardcoded xterm normal-mode cursor sequence (^[[A, ^[[B, ^[[C, ^[[D, ^[[H, ^[[F), so they work regardless of whether the user's zsh is configured to use application keypad mode while editing the command line. I haven't tested this much though, so I don't know if there are gotchas in practice.

from zsh-history-substring-search.

z0rc avatar z0rc commented on May 20, 2024

Thanks for detailed explanation, got it working for me.

from zsh-history-substring-search.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.