Vim: map GNU Screen command

 ̄綄美尐妖づ 提交于 2019-12-13 20:00:24

问题


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!


回答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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!