问题
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:
Yank text from the visual selection in Vim.
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!
回答1:
Here I copy my previous answer:
Maybe one of these two plugins is what you need:
- slime is screen-based.
- tslime is a tmux-based version of slime.
回答2:
For the second part, you can use
:execute "!screen -x ipython -X stuff " . shellescape(@0)
回答3:
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.
来源:https://stackoverflow.com/questions/8014905/vim-map-gnu-screen-command