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

Does not support Pry.editor proc #4

Closed
felixbuenemann opened this issue Mar 7, 2013 · 8 comments
Closed

Does not support Pry.editor proc #4

felixbuenemann opened this issue Mar 7, 2013 · 8 comments

Comments

@felixbuenemann
Copy link
Contributor

The code doesn't handle the code where Pry.editor is not a simple path but a proc, eg.:

Pry.editor = proc { |file,line|
  "mvim -f -c 'au VimLeave * !open -a iTerm' #{file} +#{line}"
}

The code should check if editor.is_a? Proc and then use editor.call(filename, 1).

I'll try to make a PR once I find some time.

(If anyone's curious, the above code focuses iTerm after closing MacVim started from Pry.)

@tpope
Copy link
Owner

tpope commented Mar 7, 2013

Definitely interested. Out of curiosity, is there a reason you can't use a
string in this particular case?

On Wed, Mar 6, 2013 at 8:05 PM, Felix Buenemann notifications@github.comwrote:

The code doesn't handle the code where Pry.editor is not a simple path but
a proc, eg.:

Pry.editor = proc { |file,line|
"mvim -f -c 'au VimLeave * !open -a iTerm' #{file} +#{line}"}

The code should check if editor.is_a? Proc and then use editor.call(filename,
1).

I'll try to make a PR once I find some time.

(If anyone's curious, the above code focuses iTerm after closing MacVim
started from Pry.)


Reply to this email directly or view it on GitHubhttps://github.com//issues/4
.

@felixbuenemann
Copy link
Contributor Author

It's required so pry knows how to supply the line number, see this url for details:

https://github.com/pry/pry/wiki/Editor-integration#wiki-Set_editor

@tpope
Copy link
Owner

tpope commented Mar 7, 2013

But right here is a very liberal regex that should correctly figure it out, no?

@felixbuenemann
Copy link
Contributor Author

Yes, you are right, that should be sufficient. I guess I looked at the documentation and not the source when I added that line to my .pryrc ;-)

@felixbuenemann
Copy link
Contributor Author

Btw. why not hook directly into pry to invoke the editor? That way the code would not be duplicated. There's a public method Pry::Editor.invoke_editor(file, line, blocking).

@tpope
Copy link
Owner

tpope commented Mar 7, 2013

I'm not sure that that existed back when I first wrote pry-editline. But yeah, it sounds like the way to go (so long as irb compatibility is maintained).

@felixbuenemann
Copy link
Contributor Author

Ah, yes there's still people using that. I'll give it a shot.

@felixbuenemann
Copy link
Contributor Author

Btw. big ❤️ for all the great vim plugins!

@tpope tpope closed this as completed Mar 7, 2013
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