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

Paste multi-line clipboard content in cling interpreter #186

Open
choucavalier opened this issue Aug 3, 2018 · 1 comment
Open

Paste multi-line clipboard content in cling interpreter #186

choucavalier opened this issue Aug 3, 2018 · 1 comment

Comments

@choucavalier
Copy link

I like the workflow of

  1. having my code opened with Vim on a tmux pane on the left
  2. having the intepreter opened on a tmux pane on the right
  3. editing some code in Vim
  4. pasting it with the awesome vim-slime plugin to the interpreter

I can do this with ipython but I'm currently unable to reproduce this with cling for multi-line pastes.

When I paste some multi-line code to cling, each line is executed individually.

So, of course, the following c++ code

#include <iostream>
using namespace std;
for (int i = 0; i < 10; ++i)
{
  cout << "hello" << endl;
}

when pasted to cling does not work:

[cling]$ #include <utility>
[cling]$ #include <iostream>
[cling]$ using namespace std;
for (int i = 0; i < 10; ++i)
{
  cout << "hello" << endl;
}
[cling]$ for (int i = 0; i < 10; ++i)
{
  cout << "hello" << endl;
}
[cling]$ {
[cling]$ ?     cout << "hello" << endl;
}
[cling]$ ?   }
hello

Is there an already existing solution to this?

@jarmitage
Copy link

Multi-line commands work via

{
? #include <iostream>
? using namespace std;
? for (int i = 0; i < 10; ++i)
? {
?   cout << "hello" << endl;
? }
}

So you could probably make a macro to do this?

See https://root.cern.ch/root/htmldoc/guides/users-guide/Cling.html

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