Execute current line in Bash from Vim

后端 未结 7 1886
误落风尘
误落风尘 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:45

    Add this mapping to your .vimrc file,

    nmap E yyp:.!csh
    

    Explanation:

    1. yy Yank current line
    2. p Paste yanked line below (and the cursor goes to this next row)
    3. :.!csh Execute (using csh) this newly pasted line in place. The output of this line replaces this current line, thus before executing the line was yanked and pasted below.

提交回复
热议问题