打开terminal终端,然后输入 vim test.c
按“a”进入insert模式
输入如下程序:
#include<stdio.h>
void main()
{
printf("hello world\n");
}
按“ESC”离开insert 模式,
然后按shift键+“:”,再输入wq,存盘并退出
使用gcc test.c编译该程序
使用./a.out 输出该程序
PS:
:wq表示存盘并退出
:q!表示离开vi,并且放弃刚才编辑的内容