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

Feature request: eval motion #113

Closed
devth opened this issue Mar 24, 2019 · 13 comments
Closed

Feature request: eval motion #113

devth opened this issue Mar 24, 2019 · 13 comments

Comments

@devth
Copy link

devth commented Mar 24, 2019

IcedEvalVisual and friends are nice but would be really nice if I could eval a motion. I'm basically trying to replicate some of fireplace's cp.. mappings since that's what I've used for years, so e.g. cpaw would eval around word, or cpab would eval around parens.

@liquidz
Copy link
Owner

liquidz commented Mar 24, 2019

@devth vim-iced has a <Plug>(iced_eval) action already.
https://liquidz.github.io/vim-iced/vim-iced.html#vim-iced-evaluating

So could you try the following mapping?

nmap <buffer> cp <Plug>(iced_eval)

@devth
Copy link
Author

devth commented Mar 25, 2019

Amazing! Thank you!!

@devth devth closed this as completed Mar 25, 2019
@devth
Copy link
Author

devth commented May 2, 2019

Would it be possible to eval motion and also print the result to stdout buffer?

@liquidz
Copy link
Owner

liquidz commented May 3, 2019

@devth How about the combination of eval motion and :IcedPrintLast command?
https://liquidz.github.io/vim-iced/vim-iced.html#%3AIcedPrintLast
Default key mapping is <Leader>ep.

@devth
Copy link
Author

devth commented May 3, 2019

That's what I was thinking but I'm not sure how to combine them. Here was one attempt:

    autocmd FileType clojure nmap <buffer> c! <Plug>(iced_eval)<Plug>(iced_print_last) 

I think <Plug> can't be combined this way. Do you know what it would look like?

@liquidz
Copy link
Owner

liquidz commented May 5, 2019

@devth Sorry!
Because eval motion works asynchronously, the combination won't work well.
I'm considering to add a motion for evaluating and printing.

@liquidz
Copy link
Owner

liquidz commented May 12, 2019

@devth I added <Plug>(iced_eval_and_print) to dev branch.
https://vim-iced-nightly.netlify.com/vim-iced.html#%3CPlug%3E%28iced_eval_and_print%29

Could you try this motion?
If it works, I'll release 0.10.4!

@devth
Copy link
Author

devth commented May 13, 2019

@liquidz works great! Thanks!

@liquidz
Copy link
Owner

liquidz commented May 13, 2019

@devth Thanks!
I released 0.10.4 ! #120

@liquidz liquidz closed this as completed May 13, 2019
@devth
Copy link
Author

devth commented Sep 9, 2019

Hi @liquidz, what do you think about a command similar to <Plug>(iced_eval_and_print) but instead of printing it tap>s it? This would be nice in combination with https://github.com/Lokeh/punk, which I'm starting to use. Or maybe it would both print and tap>.

@liquidz
Copy link
Owner

liquidz commented Sep 9, 2019

@liquidz
Copy link
Owner

liquidz commented Sep 10, 2019

@devth I added <Plug>(iced_eval_and_tap).
https://vim-iced-nightly.netlify.com/vim-iced.html#%3CPlug%3E%28iced_eval_and_tap%29
Could you try dev branch?

@devth
Copy link
Author

devth commented Sep 10, 2019

@liquidz thanks! I'm using it now - works great so far.

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