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

vi-mode plugin makes zsh painfully slow in OSX Mavericks #2189

Closed
sammynammari opened this issue Oct 23, 2013 · 51 comments
Closed

vi-mode plugin makes zsh painfully slow in OSX Mavericks #2189

sammynammari opened this issue Oct 23, 2013 · 51 comments

Comments

@sammynammari
Copy link

in .zshrc:

plugins=(vi-mode)

zsh is now extremely slow

plugins=()

zsh now behaves normally

@mlitwiniuk
Copy link

I can confirm - disabling vi-mode made console responsive again.

@lazywei
Copy link

lazywei commented Oct 23, 2013

same here

@adamkaplan
Copy link

Seeing the same behavior. Either of this lines from the vi-mode.plugin will cause the slowdown:

zle -N zle-line-init
zle -N ale-line-finish

@addisonj
Copy link

+1 on this, just discovered this as well.

@poysama
Copy link

poysama commented Oct 24, 2013

Same here. Although I thought it was the theme at first, I commented out ZSH_THEME and its fast again. Then I tried turning off vi-mode and turning on ZSH_THEME and it is still fast. There's something about these two.

@uorbe001
Copy link

Had the same issue, it makes the shell completely unusable with vi-mode enabled

@FlyingDeveloper
Copy link

Did some troubleshooting and found the same as @poymode last night. Looks like the issue happens when calling:

zle reset-prompt

Based on the ZLE docs here, the prompt is redrawn when reset-prompt is called. I found that commenting out zle reset-prompt eliminated the slowness as did commenting out the logic that grabs data from git to display in the prompt. This leads me to think that the calls to git are a bit slower in Mavericks than they used to be causing the prompt rewriting to slow down. Im not certain about this, though. I just don't have the zsh skills to debug this further. Is there anyone that can take this debugging further?

@hamann
Copy link

hamann commented Oct 25, 2013

I updated git to 1.8.4.1 and enabled vi-mode again, seems to fix the responsness for me

@zeeshen
Copy link

zeeshen commented Oct 25, 2013

I removed the git under directory /usr/bin and installed git v1.8.3.2, back to normal now.

Or just comment
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
in vi-mode.plugin.zsh also works.

@sschlesier
Copy link

Same problem here. I did notice that the terminal title switched to xcodebuild during the delay in processing each command.

I have disabled the plugin, and simply put bindkey -v into my .zshrc for now.

@jayzeng
Copy link

jayzeng commented Oct 26, 2013

Same here. Disabling vi-mode plugin does the magic. Any one wants to commit a fix?

@nicowenterodt
Copy link

same here. comment following lines in ~/.oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh to fix this

le -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select

@sschlesier
Copy link

Using an updated git also fixed it for me. The Apple version of git seems to cause the problem, I installed git from homebrew instead.

@adamkaplan
Copy link

Confirmed that it works with upgraded git-1.8.4.1.

@chrismdp
Copy link

👍 installing git from homebrew fixed this. I saw the terminal title flick from xcodebuild to git from time to time. I wonder what Apple's git is doing?

@goldenlove
Copy link

same problem, thanks~

@cseelus
Copy link

cseelus commented Nov 3, 2013

Same problem with vi-mode, but running Git installed from Homebrew (1.8.4.2, symlinked to /usr/local/bin/git).

Also seeing xcodebuild in my Terminals title while executing commands.

@sschlesier
Copy link

@cseelus I would double check that your path leads to homebrew's git before Apple's git

git --version or which git should answer the question

@cseelus
Copy link

cseelus commented Nov 4, 2013

@sschlesier before posting, i did this:

    $ which git
    /usr/local/bin/git

    $ git --version
    git version 1.8.4.2

@lamnk
Copy link

lamnk commented Nov 9, 2013

Switching to homebrew git makes zsh generating new prompt faster but still not quite fast as in the case I remove git / vi-mode plugin

@wmayner
Copy link

wmayner commented Nov 25, 2013

+1, same issue.

@dylanjha
Copy link

+1

@submonkey
Copy link

the output command ls dissapear on dotfiles directory

@bradtse
Copy link

bradtse commented Dec 25, 2013

UPDATE:
Fantastic! It seems like Apple's git was the culprit. I was running 1.8.3.4 when I was having the lag issues. I installed brew git (version 1.8.5.2) and all lag issues have been fixed.

I have run into a similar issue, although I am not using the vi-mode plugin like most other people here. I am using oh-my-zsh with the agnoster theme (although I have tested this with other themes and the same thing happens. I believe the use of git for the prompt is the common factor here). The command line is only very slow when I am inside of a git repo. I have added "bindkey -v" to my own personal vim.zsh file inside of ~/.oh-my-zsh/lib/. Inside of this file I also have this small bit of code that visually shows which mode zle is currently in.

function zle-keymap-select zle-line-init {
# these are used to indicate on the right side of the prompt
RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select

My belief is that git and "zle reset-prompt" are not playing well together. Every time "zle reset-prompt" is called, git is being used again to redraw the prompt, which I believe is the root of all of this lag. Removing "zle reset-prompt" fixes any kind of lag. I'm not sure of a workaround yet but it is quite frustrating because vi mode in zsh is a pain in the ass to use without some kind of visual indicator of the current mode.

I am currently trying to install a newer version of git and will report back with any changes.
Note: I'm on Maverick 10.9.1

@gnapse
Copy link

gnapse commented Dec 28, 2013

I'm on Mavericks 10.9.1 too, using vi-mode as well, and I had this issue. I was originally using Apple's git, and I can confirm that just by switching to homebrew's git fixed the issue.

@chaitanyav
Copy link

had to comment out the following line in my antigen.conf

antigen-bundle vi-mode

zsh is super fast now. BTW, this is on Mavericks 10.9.1.

@cburyta
Copy link

cburyta commented Feb 27, 2014

brew install git fixed it for me, it did have to do with the git version bundled with my mac.

@yosida95
Copy link

yosida95 commented Mar 1, 2014

I'm on OS X 10.9.2, using vi-mode plugin, using git plugin, displaying git_prompt_info on RPROMPT, and using Apple's git.

I encountered this issue. Updating git to v1.9.0 via brew install git fixed it. Thanks!

@fijimunkii
Copy link

removed vi-mode
added bindkey -v

that fixed it for me

@SephVelut
Copy link

@bradtse Having the same issue. Commenting out reset prompt removed the problem lag when inside a git repo. Current GIT version is 1.9.1 but the unfortunately the problem still exists.

@jamesmartinduffy
Copy link

Still an issue.

Apple's git on my machine was version 1.8.5.2 (Apple Git-48), so it seems to be an xcode thing, not strictly a version thing.

Did brew install git (installed version 1.9.2) and changed my path so /usr/local/bin comes before /usr/bin. Now vi-mode works with no delay.

@markson
Copy link

markson commented Jul 12, 2014

Same thing here, even a simple bindkey -v make the shell really sluggish.

git version: 2.0.1
OSX: 10.10 dp3

@georgetony
Copy link

On OSX 10.9.4, using zsh and Git (git version 1.8.5.2 (Apple Git-48)). The following fixed the slow down:
Edit .oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh
On line 13, comment out zle reset-prompt.

I only have git and vi-mode as plugins in .zshrc

@zfogg
Copy link

zfogg commented Oct 9, 2014

+1 for updating Git! I just ran brew install git && exit, opened up a new iTerm2 window, and it was fixed.

@hookdump
Copy link

+1, updated Git and now... it's awesome.

@ghost
Copy link

ghost commented Oct 22, 2014

I didn't have this issue on OS X 10.9 (Mavericks); but I am seeing it after upgrading to OS X 10.10 (Yosemite).
Doing a brew install git and making sure /usr/local/bin is in the PATH before /usr/bin fixed it for me.

@AdamBrodzinski
Copy link

+1 for Yosemite and the Apple Git 1.9.3. Installing Git with brew fixes the sluggishness.

@jamesmartinduffy
Copy link

Perhaps someone should close this issue and edit the original post to contain the fix? After solving this problem months back and forgetting about it, I just got set up on a new imac and was dealing with the painful slowness again. Googled and found this issue again – brew install git is the solution.

Including this information in the first post will save future googlers the effort of reading the first half of this thread and the "me too"s before someone suggests the correct solution.

@cscheib
Copy link

cscheib commented Dec 20, 2014

+1 more confirmation that the brew version of git fixes slowness on Yosemite

@robbyrussell
Copy link
Member

If you hit this...

brew install git

@mdentremont
Copy link

OMG, forgot about this and it was driving me nuts on a laptop I just configured :)

@Leland
Copy link

Leland commented May 13, 2015

Switching to homebrew's Git resolved this for me as well, but I'm curious why. Anyone have an idea as to why Mac's pre-rolled version of Git is giving ZSH so much trouble?

@hugofcampos
Copy link

Tested in Yosemite (10.10.3), installing git 2.4.3 with brew, same great results 👍

@crunk1
Copy link

crunk1 commented Jul 24, 2015

+1 to installing git 2.4.3 homebrew.

@stuartcarnie
Copy link

Same problem in 10.11 too; don't use Apple's version of git

@danihodovic
Copy link

Experienced the same issue in El Capitan 10.11. Installing git using brew solved the problem.

@AndersDJohnson
Copy link

+1 Fixed on OS X 10.9.5 Mavericks by replacing native Apple Git 1.9.3 with Git 2.5.1 from homebrew.

@dariuszlesniak
Copy link

+1 Fix for brew install git

@hank
Copy link

hank commented Nov 26, 2015

This also fixed my issue, but wouldn't it be better to add a command to zsh that would allow the functionality for vi-mode but not reset every plugin in the process (eg. git)?

@longlinht
Copy link

longlinht commented Jun 26, 2016

I also encounter same problem, my environment is

Yosemite 10.10.5
Git 2.3.2 (Apple Git-55)

I only use git and vi-mode plugin, I fixed it by comment a line in .oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh

zle reset-prompt

@Adrian-Grimm
Copy link

I also encounter same problem, my environment is

Yosemite 10.10.5
Git 2.3.2 (Apple Git-55)

I only use git and vi-mode plugin, I fixed it by comment a line in .oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh

zle reset-prompt

not perfect but 100% faster switch between the vi-modes...
(under WSL Ubuntu on Windows 10 1809)

@ohmyzsh ohmyzsh locked as resolved and limited conversation to collaborators May 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests