Create new file with vi
Purpose: create new blank file to start edit
Description: vi file_name
Example: vi hello.c
hello.c
/*
* =====================================================================================
*
* Filename: hello.c
*
* Description:
*
* Version: 1.0
* Created: 01/22/2013 11:22:07 AM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Company:
*
* =====================================================================================
*/
Close file with vi
Purpose: Close the current editing file
Using:
If you are in Inserted Mode, press Escape to jump into Visual Mode
If you are in Visual Mode, type:
:q for quiting
:q! for force quiting (no save the current file)
:wq quit with save file
Have another way to exit from vi:
ctrl +Z : quit without save file
shift +ZZ: quit with save file
Compile with vi
gcc -o filename filename.c
./filename
Example :
gcc -o hello hello.c
./hello