How to execute the contents of a buffer?

前端 未结 2 559
南旧
南旧 2020-12-25 11:41

I have a vim script I\'m developing in my current buffer and I want to execute it. Is there a simple way to do it?

After a long search I have only found two related

相关标签:
2条回答
  • 2020-12-25 11:58

    An autocmd to source the file whenever you save might help:

    autocmd BufWritePost <buffer> source %
    
    0 讨论(0)
  • 2020-12-25 12:18

    Use:

    :%y"                      (alternatively: ggyG)
    :@"
    

    It will copy whole buffer into default register and then run it.

    See :help :y and :help :@ (and also :help range maybe).

    0 讨论(0)
提交回复
热议问题