Presentation is loading. Please wait.

Presentation is loading. Please wait.

作業系統實習課 助教:鄧執中 Email:steven1991@ares.ee.nchu.edu.tw.

Similar presentations


Presentation on theme: "作業系統實習課 助教:鄧執中 Email:steven1991@ares.ee.nchu.edu.tw."— Presentation transcript:

1 作業系統實習課 助教:鄧執中

2 Cygwin 介紹: Cygwin是許多自由軟體的集合,用於各種版本的Microsoft Windows上,執行類UNIX系統。Cygwin的主要目的是通過重新編譯,將POSIX系統上的軟體移植到Windows上。

3 安裝流程 1.官網載點: 2.點擊setup.exe開始安裝

4

5 3.選擇要安裝的自由軟件包: 1.vim 2.gcc

6 3.wget

7 4.SNV版本控制系統

8 變數名稱:CYGWIN 變數值:ntsec tty
4.設定環境變數: 變數名稱:CYGWIN 變數值:ntsec tty 在Path的變數值後面 加上; c:\cygwin64\bin

9 cd .. 向上移動一層目錄 cd ~ 回到登入的目錄 (C/cygwin64/home/使用者名稱) cd /…../…… 移動到指定目錄
vi ….. 編輯檔案,沒檔案就創建一個新檔 我們要使用Vi創建一個C可編譯檔:vi main.c

10 w: 存檔(write)。注意在編輯過程中所有內容只存在暫存器裡,必須在 c- mode 下了這個「:w」指令才會存檔。
Vi文字編輯器的三種模式: 1. Normal mode (指令模式 command mode,以下簡稱 c-mode): 進入 vi 時處於 c-mode,只能下按鍵指令,不能輸入文字。 h: 向左一個字元 x: 刪除游標所在的字元 l: 向右一個字元 x: 刪除從游標開始的連續七個字元(含游標所在處) k: 向上一行 X: 刪除游標前一個字元 j: 向下一行 X: 刪除游標前連續四個字元(不含游標所在處) a: 由游標後開始插入文字 2. Insert mode (輸入模式 i-mode): 在 c-mode 下按 a,  i  等指令就會進入 i-mode,此時才可以鍵入文字編輯檔 案,a是 append,由游標後方開始編輯,i 是 insert,由游標前方開始編輯 ,按 Esc 又會回到 c-mode。 3. Ed mode (命令列模式 command-line mode,e-mode): 在 c-mode 下按冒號「:」就會進入 e-mode,左下角會有一個冒號:出現 可下ed指令。 w: 存檔(write)。注意在編輯過程中所有內容只存在暫存器裡,必須在 c- mode 下了這個「:w」指令才會存檔。 e: 重新編輯(edit)。 q: 退出(quit)

11 5.5 更新難用的vim編輯器 $ svn --force export /bin/ (類似git clone) $chmod +x /bin/apt-cyg (確保apt-cyg可執行) $apt-cyg install vim (使用apt-cyp指令來下載並安裝最新的vim編輯器)

12 將以下的文字複製起來到Terminal按滑鼠中鍵貼上,並存檔退出。(輸入:wq)
新增vi環境設定檔:$vi ~/.vimrc (“ ~ ”為家目錄之意 ,一般來說是C:\Cygwin64\home\Administrator) 將以下的文字複製起來到Terminal按滑鼠中鍵貼上,並存檔退出。(輸入:wq) if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" set fileencodings=utf-8,latin1 endif set nocompatible " Use Vim defaults (much better!) set bs=indent,eol,start " allow backspacing over everything in insert mode "set ai " always set autoindenting on "set backup " keep a backup file set viminfo='20,\"50 " read/write a .viminfo file, don't store more " than 50 lines of registers set history=50 " keep 50 lines of command line history set ruler " show the cursor position all the time " Only do this part when compiled with support for autocommands if has("autocmd") augroup redhat " In text files, always limit the width of text to 78 characters autocmd BufRead *.txt set tw=78 " When editing a file, always jump to the last cursor position autocmd BufReadPost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif augroup END endif if has("cscope") && filereadable("/usr/bin/cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif " Switch syntax highlighting on, when the terminal has colors " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif if &term=="xterm" set t_Co=8 set t_Sb=[4%dm set t_Sf=[3%dm endif 更新之後的vim只要進入i-mod就會像記事本一樣,是我們熟悉的輸入法了!

13 6.使用gcc編譯main.c成可執行檔: 指令:gcc 文件名 –o 執行檔文件名 7.輸入: ./ 執行檔名 8.找助教檢查並結束這回合


Download ppt "作業系統實習課 助教:鄧執中 Email:steven1991@ares.ee.nchu.edu.tw."

Similar presentations


Ads by Google