Execute current line in Bash from Vim

后端 未结 7 1893
误落风尘
误落风尘 2020-12-12 11:58

This question is similar to Vim: execute current file?, but instead of executing the current file I want to execute only the current line.

Is this possible?<

7条回答
  •  心在旅途
    2020-12-12 12:40

    If I have a command on a line of text within vi/Vim like this"

    ls -la

    Position the cursor anywhere on the line and do ":.!!" and press return.

    That is: colon dot bang bang return

    That will execute the text in that line in the current shell from within vi/Vim and have the output inserted within the text file.

    I'm thinking that is what you were asking? It's like magic.

提交回复
热议问题