用mintty作为cygwin的console

cygwin1.7在我的电脑上不能显示中文,已困扰我很久了.

今天才找到解决办法,只要安装mintty即可.

安装后在宽屏显示器上字可能比较小, 参考其手册缩放字体.

以下是我的cygwin.bat,

@echo off
chdir C:\cygwin\bin
set EDITOR=vi
set VISUAL=vi
REM shamelessly copied from git://github.com/justsoso8/dotfile.git
REM mintty installed which supports chinese
REM =======================================
@echo off
rem find cygwin roo directory one by one
rem disk c -> disk d -> disk e

:CYGWIN_C
if not exist c:\cygwin goto CYGWIN_D
set _cygwinroot=c:\cygwin
goto HAVECYGWIN

:CYGWIN_D
if not exist d:\cygwin goto CYGWIN_E
set _cygwinroot=d:\cygwin
goto HAVECYGWIN

:CYGWIN_E
if not exist e:\cygwin goto NOCYGWIN
set _cygwinroot=e:\cygwin
goto HAVECYGWIN

:NOCYGWIN
echo no cygwin installation found on disk C/D/E
pause
goto EOF

:HAVECYGWIN

set LANG=zh_CN.utf8
rem CONSOLE is sure to know this setting
rem and can display chinese very well
rem but look & feel & funcationality are not as good as mintty

REM select terminal one by one
REM mintty -> rxvt -> console

:MINTTY
set _termapp=%_cygwinroot%\bin\mintty.exe
if not exist %_termapp% goto RXVT
start %_termapp% /bin/bash --login -i
rem mintty has it's option to set as zh_CN.utf8
rem ignore the ${LANG} setting
rem and it appends @cjknarrow automatically
rem current solution is to "LANG=zh_CN.utf8 gvim ..."
goto EOF

:RXVT
set _termapp=%_cygwinroot%\bin\rxvt.exe
if not exist %_termapp% goto CONSOLE
set BGCOLOR=Black
set FGCOLOR=White

start %_termapp% -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR% -sr -fn Courier-20 -geometry 80x25 -e /bin/bash --login -i
goto EOF

:CONSOLE
set _termapp=%_cygwinroot%\bin\bash.exe
start %_termapp% --login -i
goto EOF

:EOF
exit
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s