此问题是类似的Vim:执行当前文件,而是执行的电流?文件我想只执行当前行。
This question is similar to Vim: execute current file? but instead of executing the current file I want to execute only the current line.
这可能吗?
更新:理想情况下,我找它可以在外壳副作用的解决方案。例如,假设我有以下行:
Update: Ideally, I am looking for solutions which can have side effects in the outer shell. For example, suppose I have the following line:
alias foo=bar在vim运行命令,如果我开始与后壳:SH ,别名富可用,但如果我不干 VIM 使用:q ,然后别名不再
After running the command in vim, if I start a shell with :sh, the alias foo is available, but if I quit vim using :q, then the alias is no longer available.
推荐答案没问题,你可以写当前文件的任何内容到另一个程序的标准输入:
Sure thing, you can 'write' any content of the current file into the stdin of another program:
:.w !bash下面。(W前面的部分)是指你正在写行的范围和。是仅当前行。然后,可以使用!庆典来写那些行抨击。
Here . (the part before w) refers to the range of lines you are writing, and . is only the current line. Then you use !bash to write those lines to bash.
更多推荐
从VIM庆典执行当前行
发布评论