hlissner / zsh-autopair

Auto-close and delete matching delimiters in zsh
MIT License
509 stars 37 forks source link

autopair doesn't work with prezto #6

Closed laughingman-hass closed 8 years ago

laughingman-hass commented 8 years ago

Hi there,

I recently changed from oh-my-zsh to prezto, and noticed that autopair stops working. I use zgen to manage plugins. Below is a copy of my .zshrc

# load zgen
source "${HOME}/.zgen/zgen.zsh"

# check if there's no init script
if ! zgen saved; then
  echo "Creating a zgen save"

  # # theme
  zgen prezto prompt theme 'sorin'

  # # plugins
  zgen prezto
  zgen prezto git
  zgen prezto tmux
  zgen prezto homebrew

  zgen load hlissner/zsh-autopair 'autopair.zsh'
  zgen load zsh-users/zsh-completions
  zgen load felixr/docker-zsh-completion
  zgen load zsh-users/zsh-syntax-highlighting
  zgen load zsh-users/zsh-history-substring-search

  zgen save
fi

it works once after zgen reset and zgen save, but if i reload the shell or start another it stops working. Seen no problems with oh-my-zsh

hlissner commented 8 years ago

This is very odd. I'll do some testing today and get back to you!

hlissner commented 8 years ago

I've discovered the cause. Prezto's Editor module is resetting the keybinds and zgen initializes Prezto's modules last (regardless of zgen load order), thus removing zsh-autopair's bindings.

I don't know how to fix it internally, so you'll have to do this:

source "${HOME}/.zgen/zgen.zsh"

# Add this
AUTOPAIR_INHIBIT_INIT=1

if ! zgen saved; then
  zgen prezto
  #...
  zgen load hlissner/zsh-autopair 'autopair.zsh'
  #...
  zgen save
fi

# And this
autopair-init
hlissner commented 8 years ago

I'll close this issue for now. Feel free to reopen if this doesn't fix it for you.

laughingman-hass commented 8 years ago

👍 Thank you!