Giter Club home page Giter Club logo

Comments (4)

hlissner avatar hlissner commented on August 22, 2024 3

^[[3~ is the escape code for the delete key. In zsh, this key doesn't delete-forward as I would expect. Instead, it acts as if I've pressed ~e in command mode (or g~e in vim), which flips the case of the word after the cursor.

Not sure if that's a quirk of zsh's vi mode, but I manually bound delete to delete-char to fix it.

^[3;5~ is actually a typo. It's supposed to be ^[[3;5~, which is the escape code for ctrl + delete. There's also ^[[3;2~ for shift-delete. I don't think either is necessary though. I'll likely remove that.

If you're wondering how I got those codes, I ran cat, then pressed the key I wanted, and it prints out the escape code, e.g.

$ cat
^[[3~

Hope that helps!

from dotfiles.

kutsan avatar kutsan commented on August 22, 2024 3

So much thanks! You and man {terminfo,infocmp,zshzle} (those were not just for this topic) helped me a lot. Here is what I learned. As I understand, there is no quirk here. ZLE applies everything it receives. In this case it's ^[[3~:

  1. ^[ It's escape character, so switches to normal mode.
  2. [ Since it's undefined-key, so ZLE doesn't know what to do with.
  3. 3~ Flips the next 3 letters.

I tested it with other undefined-keys like FN + RightArrow. cat outputs ^[[4~ for that key sequences. It exactly flips the next 4 letters like I said above.

I ran cat, then pressed the key I wanted, and it prints out the escape code, e.g.

cat trick is nice but I assume we can achieve the same result with pressing C-v and hitting a key, or sed -n l.

Thanks again. <3

from dotfiles.

hlissner avatar hlissner commented on August 22, 2024 2

That makes perfect sense! It hadn't occurred to me that the escape code was being evaluated literally. The sed trick was new to me too.

In any case, thank you for sharing and I'm happy it helped!

from dotfiles.

snowman avatar snowman commented on August 22, 2024

Yeah, Tha's why iTerm2 map key cmd+← to hex code: 0x1B 0x08 or 0x17

$ echo -n '^[^H' | xxd
00000000: 1b08                                     ..

$ echo -n '^W' | xxd
00000000: 17                                       ..

from dotfiles.

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.