Vincent
Vincent

Reputation: 17725

Vim: map GNU Screen command

Apologies if this has been asked before, but I feel overwhelmed with the Vim docs and I can't seem to figure this out.

I want to map the F5 key in Vim to accomplish the following actions:

  1. Yank text from the visual selection in Vim.

  2. Execute the yanked portion of the text in another GNU Screen session named ipython.

The second portion could be achieved by issuing the following command line argument (via :!), if only I was able to find a way to paste the register content between the double quotes of that line (but I can't figure out how):

map <F5> :!screen -x ipython -X stuff "[REGISTER 0 CONTENT]"<CR><CR>

Any help would be much appreciated!

Upvotes: 1

Views: 485

Answers (3)

Paul Ivanov
Paul Ivanov

Reputation: 2024

Given the nature of your question - I encourage you to take a look at vim-ipython. Using this plugin, you can send lines or whole files for IPython to execute, and also get back object introspection and word completions in Vim, like what you get with: object?<enter> and object.<tab> in IPython.

If you follow that github link, there are a few screencasts demonstrating what you can do with it. It requires IPython 0.11 or later, though, with ZeroMQ enabled.

Upvotes: 1

romainl
romainl

Reputation: 196496

Here I copy my previous answer:

Maybe one of these two plugins is what you need:

Upvotes: 1

Neil
Neil

Reputation: 55382

For the second part, you can use

:execute "!screen -x ipython -X stuff " . shellescape(@0)

Upvotes: 2

Related Questions