GithubHelp home page GithubHelp logo

surround about dotfiles HOT 5 CLOSED

hlissner avatar hlissner commented on May 28, 2024
surround

from dotfiles.

Comments (5)

hlissner avatar hlissner commented on May 28, 2024

Have you enabled vi mode with bindkey -v (should be before any of your keybindings)?

I haven't gotten ys to work, but cs, ds and S (in visual mode) work fine.

This should be all you need to get it to work:

bindkey -v
autoload -Uz surround
zle -N delete-surround surround
zle -N add-surround surround
zle -N change-surround surround
bindkey -a cs change-surround
bindkey -a ds delete-surround
bindkey -a ys add-surround
bindkey -M visual S add-surround

Hope that helps!

from dotfiles.

justmytwospence avatar justmytwospence commented on May 28, 2024

Yep I'm using bindkey -v. Those lines of code (the ones in the source of surround.zsh), are what I'm using also, but I enter insert mode as soon as I press cs.

Here's the relevant lines in my config: https://github.com/justmytwospence/dotfiles/blob/master/home/.zsh/keybinds.zsh#L41-L49. Not that I expect you to debug my problem, just in case something obvious is apparent.

from dotfiles.

hlissner avatar hlissner commented on May 28, 2024

Not a problem! I took a look and zeroed in on the issue, it's export KEYTIMEOUT=1 in zshenv. My tests show that if KEYTIMEOUT is <= 8, surround immediately aborts into insert mode. On top of that, if <= 10, ys fails in the same way (mine was set to 10).

Setting it to 15 makes all these problems disappear. Very odd.

Not sure if those numbers will apply to you exactly, but I hope it steers you in the right direction!

NOTE: I'd recommend bindkey -M viins 'jk' vi-cmd-mode if the delay bothers you. It certainly bothered me!

from dotfiles.

justmytwospence avatar justmytwospence commented on May 28, 2024

Wow I'm glad I asked, I would never have figured that out.

My magic numbers are slightly different. 23 for ys and like 11ish for the others. I've noticed another strange thing: there is another pair of magic numbers that are lower, but don't work immediately. The lower pair of magic numbers only works the first time if I go really really fast. After that first time, I don't have to go really fast anymore. Super weird.

Anyways, thanks a bunch! I wonder if this is an issue that should be reported?

from dotfiles.

hlissner avatar hlissner commented on May 28, 2024

Glad I could help!

I wonder if this is an issue that should be reported?

Good question. It may well be, I've never been on the zsh mailing list before though.

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.