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

opp in prezto #9

Open
dvcrn opened this issue Jul 3, 2014 · 4 comments
Open

opp in prezto #9

dvcrn opened this issue Jul 3, 2014 · 4 comments

Comments

@dvcrn
Copy link

dvcrn commented Jul 3, 2014

Hello,

I am not sure if this is a issue in opp.zsh or how to debug it.
I am using prezto as my zsh framework. I created a module for opp.zsh and packed it into the module/ directory. My init script is simply sourcing opp.zsh like this

source "${0:h}/external/opp.zsh"
source "${0:h}/external/opp/surround.zsh"
source "${0:h}/external/opp/textobj-between.zsh"

However when trying to use a vim motion provided by this (for example ciw), the cursor simply jumps to the beginning of the line. (When not activated, it does nothing).

When I manually source the files after prezto finished loading, everything seems to work fine.

Prezto loads modules as the last thing during init

# Load Prezto modules.
zstyle -a ':prezto:load' pmodule 'pmodules'
pmodload "$pmodules[@]"
unset pmodules

opp is the last module to be loaded, zprezto is sourcing the file correctly. All pathes are correct, yet I am having this misbehavior. Any ideas about this?

@hchbaw
Copy link
Owner

hchbaw commented Jul 3, 2014

Hi, @dabido ! Thank you for your reports!

Ugh... my zsh codes do not play nice with prezto out-of-the-box.
Fortunately, it will work if you choose to use opp-zcompile to produce the initialization function as opp-install autoloadable file, and then if you use it.

How about using below snippets as the ~/.zprezto/modules/opp/init.zsh?

if [[ ! -f ${0:h}/functions/opp.zwc ]] ||
   [[ ! -f ${0:h}/functions/opp-install.zwc ]]; then
  (
    . "${0:h}/external/opp.zsh"
    . "${0:h}/external/opp/surround.zsh"
    . "${0:h}/external/opp/textobj-between.zsh"
    opp-zcompile "${0:h}/external/opp.zsh" ${0:h}/functions
  )
  fpath+=${0:h}/functions
  . ${0:h}/functions/opp-install
  autoload opp
fi
opp-install

It works here. (I don't test this much, though.)

@dvcrn
Copy link
Author

dvcrn commented Jul 3, 2014

This seems to work just fine, thanks for the hint! I added some pipes into /dev/null to suppress output.

if [[ ! -f ${0:h}/functions/opp.zwc ]] ||
   [[ ! -f ${0:h}/functions/opp-install.zwc ]]; then
  (
    . "${0:h}/external/opp.zsh"
    . "${0:h}/external/opp/surround.zsh"
    . "${0:h}/external/opp/textobj-between.zsh"
    opp-zcompile "${0:h}/external/opp.zsh" ${0:h}/functions > /dev/null
  )
  fpath+=${0:h}/functions > /dev/null
  . ${0:h}/functions/opp-install
  autoload opp
fi
opp-install

What do you think about submitting this into prezto core as a module? For me (and probably a lot of other vim users), vim without text objects just doesn't feel right.

@hchbaw
Copy link
Owner

hchbaw commented Jul 3, 2014

It seems ok (though I'm quite new to pretzo), please go ahead and do as you.

@dvcrn
Copy link
Author

dvcrn commented Jul 4, 2014

Here we go sorin-ionescu/prezto#636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants