Changing the practice of quiting and opening vi (vim) editor?

后端 未结 5 685
灰色年华
灰色年华 2021-02-11 07:05

One of the primary distinction betweeen vi (vim) and emacs, is emacs is designed and supposed to be run at times without quitting, where as given the quick load time of vim, it

5条回答
  •  长情又很酷
    2021-02-11 07:16

    Just use the :! command to run stuff in a shell. It mixes great with :cd and % expansion

    bash> vim path/to/ex.c
    ...
    :cd %:h. " move to path/ex/
    :!gcc -o %:r % && %:r " compile ex.c into ex and run it
    

    You can also mix it with :read if you want to put the output of a command in the current buffer:

    :read !ls " read in the names of all the files in the current directory
    

提交回复
热议问题