Save and run at the same time in Vim

前端 未结 12 538
悲哀的现实
悲哀的现实 2021-01-30 03:13

I do a lot of Python quick simulation stuff and I\'m constantly saving (:w) and then running (:!!). Is there a way to combine these actions?

Maybe a "save and run&qu

12条回答
  •  被撕碎了的回忆
    2021-01-30 03:57

    This is what I put in my .vimrc file and works like a charm:

    nnoremap r :w:!!
    

    Of course you need to run your shell command once before this, so it knows what command to execute.

    Example:

    :!node ./test.js
    

提交回复
热议问题