vim editor and unix command gcc compiler

9
Vim Editor and Unix Command gcc compiler Computer Networks

Upload: travis-benton

Post on 30-Dec-2015

83 views

Category:

Documents


0 download

DESCRIPTION

Vim Editor and Unix Command gcc compiler. Computer Networks. Vim. Vim is a Editor installed in almost every version of the unix-like OS. There are three mode in Vim: Normal, Edit, Command. This overview will cover the simple use of Vim like open file, editing, saving, abort the editing. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Vim Editor and Unix Command  gcc compiler

Vim Editor and Unix Command gcc compilerComputer Networks

Page 2: Vim Editor and Unix Command  gcc compiler

Vim

Vim is a Editor installed in almost every version of the unix-like OS.

There are three mode in Vim: Normal, Edit, Command.

This overview will cover the simple use of Vim like open file, editing, saving, abort the editing.

If you want to know more , you can reference: http://linux.vbird.org/linux_basic/0310vi.php

Page 3: Vim Editor and Unix Command  gcc compiler

Vim – environment setting

Vim can mark the syntax in different colors, which can enhance the efficiency of developing programs dramatically.

You can set the custom color scheme or cursor line in .vimrc file.

cd ~

vim .vimrc

Page 4: Vim Editor and Unix Command  gcc compiler

Vim – environment setting

After typing vim .vimrc , you’ll be able to edit the .vimrc file (if you don’t have one before, the system will create one for you).

If you want the default color scheme , just type “syntax on” in the file and then save the file.

If you want more custom setting, you can reference here :

http://linux.vbird.org/linux_basic/0310vi.php#vim_set

Page 5: Vim Editor and Unix Command  gcc compiler

Vim – file open and save

If you want to save or abort the editing , you have to enter the command mode of the Vim.

If you’re in edit mode , press ESC and then “shift+:”

If you want to save the file , enter wq

If you don’t want to save the file , enter q!

Page 6: Vim Editor and Unix Command  gcc compiler

gcc compiler

gcc is a c compiler to compile the code you develop.

There are a few flags need to take care when you compile code.

If you use the pthread in your server, remermber to add –lpthread after your gcc command.

Ex: gcc –lpthread server.c

Page 7: Vim Editor and Unix Command  gcc compiler

gcc compiler

You can also assign the name of executable file by –o flags

Ex. gcc –o server server.c

Page 8: Vim Editor and Unix Command  gcc compiler

UNIX Command

pwd : show the location you're

ls: list all the file in the current directory

mv [filename] [path] : move the file to the given path

cp [filename] [path] : copy the file to the given path.

mkdir [path] : create a sub directory at the current directory.

Page 9: Vim Editor and Unix Command  gcc compiler

UNIX Command

cd path : change the current location to given path

Ex: cd testDir ,

Note:

1.cd .. means go back to the parent directory

2. cd ~ means go to home directory