Vim: execute current file?

后端 未结 6 2119
庸人自扰
庸人自扰 2021-01-30 03:34

If I have a file with a shebang line (e.g. #!/bin/bash) open in Vim and the file has execute permissions (i.e. chmod +x) I know I can type this to exec

6条回答
  •  感动是毒
    2021-01-30 04:25

    :!%:p
    

    ,without the spaces, is shorter.

    If you want an even shorter shortcut, you can create a custom mapping:

    nnoremap  :!%:p
    

    or the more "mnemonic":

    nnoremap r :!%:p
    

提交回复
热议问题