MinGW+MSYS+gVim的搭建

來源:互聯網
上載者:User
1.安裝MinGW
安裝到:c:/MinGW下,最好到mingw上下載自動安裝版

2. 安裝MSYS到MinGW的首頁下載MSYS的最新版本: URL::http://www.mingw.org/download.shtml
下載列表中的 Current - MSYS 即為 MSYS 的安裝程式,下載其二進位版本(bin),並將其安裝到C:/msys/1.0 下。中途需要指定MinGW的位置。

3. 修改MSYS設定檔
修改 /etc/profile (Windows路徑為 C:/msys/1.0/etc/profile),在其末尾添加如下幾行:
export PS1='[/u@msys /W]$ '
export PS2='> '
export PS4='+ '
export LANG=en
alias l='/bin/ls --show-control-chars --color=tty'
alias la='/bin/ls -aF --show-control-chars --color=tty'
alias ll='/bin/ls -alF --show-control-chars --color=tty'
alias ls='/bin/ls --show-control-chars -F --color=tty'

然後修改 C:/msys/1.0/msys.bat,找到 :startrxvt 一節,修改為如下:
if "x%MINGW32BGCOLOR%" == "x" set MINGW32BGCOLOR=Black
if "x%MINGW32FGCOLOR%" == "x" set MINGW32FGCOLOR=White
最後修改:
start rxvt -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr -fn "MS Gothic"-24 -tn msys -geometry 90x30 -e /bin/sh --login -i
exit
注意:不要帶-backspacekey ^H,這樣會使得shell不能退格...

4.配置環境變數:
PATH C:/MinGW/bin;
LIBRARY_PATH C:/MinGW/lib
C_INCLUDED_PATH C:/MinGW/include
CPLUS_INCLUDE_PATH C:/MinGW/include/c++/3.4.5

5.sh內建的vim不好用,用gVim,下載gVim71.exe安裝後
:e $myvimrc
添加:
set number
set filetype=c
colorscheme torte
set guifont=lucida_console:h16 等等
具體參見:http://edyfox.codecarver.org/html/_vimrc.html
一點小技巧是可以通過在_vimrc中寫cd使得一開啟gvim就進入程式目錄,
如我gvim安裝目錄為的是D:/gVim/Vim/vim71,
而程式目錄為D:/Ubuntu/program(方便在Ubuntu中編程共用)
添加:
cd ..
cd ..
cd ..
cd /Ubuntu/program.
同理,Ubuntu中的vimrc中也可添加相應語句,設到/Ubuntu/program下,則會省去很多切換目錄的時間

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.