Skip to content

Instantly share code, notes, and snippets.

@redguardtoo
Last active September 5, 2022 06:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save redguardtoo/08dc16244a09507b57da to your computer and use it in GitHub Desktop.
Save redguardtoo/08dc16244a09507b57da to your computer and use it in GitHub Desktop.
cygwin.bat
@echo off
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:\cygwin64 goto CYGWIN_D
set _cygwinroot=c:\cygwin64
goto HAVECYGWIN
:CYGWIN_D
if not exist d:\cygwin64 goto CYGWINP_C
set _cygwinroot=d:\cygwin64
goto HAVECYGWIN
:CYGWINP_C
if not exist c:\cygwin-portable\cygwin goto CYGWINP_D
set _cygwinroot=c:\cygwin-portable\cygwin
goto HAVECYGWIN
:CYGWINP_D
if not exist d:\cygwin-portable\cygwin goto NOCYGWIN
set _cygwinroot=d:\cygwin-portable\cygwin
goto HAVECYGWIN
:NOCYGWIN
echo no cygwin installation found on disk C/D
pause
goto EOF
:HAVECYGWIN
set EDITOR=vi
set VISUAL=vi
set LANG=zh_CN.utf8
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment