打開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,並且放棄剛纔編輯的內容