Comments (5)
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.
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.
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.
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.
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)
- Upon moving to the new `hey`/`flake` based system, ZGEN_SOURCE broken
- Help needed...installation instructions possibly outdated HOT 4
- How to user personal package in the config? HOT 2
- nix-darwin
- Suggestion: kvantum theme HOT 3
- multi arch management (RPI ? ) HOT 1
- fup? fup!
- unnecessary type definition either str path HOT 1
- How are you managing doom-emacs? HOT 5
- Make bin/hey a separate flake HOT 1
- Dwm on nix HOT 2
- Suggestion: Update quickstart section in README HOT 3
- Shiro external monitor HOT 1
- mkEnableOption expects string instead of bool HOT 1
- HEYYEYAAEYAAAEYAEYAA links do not match
- `countAttrs` doesn't work as expected
- error: ipython-8.4.0 not supported for interpreter python3.7
- .zshrc still references ZGEN_SOURCE HOT 1
- Regarding nixpkgs.lib.nixosSystem.specialArgs HOT 5
- Can't access default lib modules after extending nixpkgs.lib HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotfiles.