Archive

Posts Tagged ‘cygwin’

Cygwin .bash_profile

May 21st, 2010 No comments

This file will put a more standard Linux prompt on your Cygwin login shell (file should be ~/.bash_profile):

#!/bin/bash

# Custom prompt
PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h:\[\e[33m\]\w\[\e[0m\]$ '
Categories: Uncategorized Tags:

Fixing box drawing in Midnight Commander

May 21st, 2010 No comments

Launching MC in rxvt showed all the box drawing characters replaced with strange looking accented characters… What?

Turns out none of the Windows fonts support box drawing characters (from what I’ve read, it seems that they don’t have the characters in the expected positions in the character table)…

The easiest solution is to tell MC to use non box drawing characters to draw boxes with the -a switch. The other solution is to get the Lucida ConsoleP Font. (254), and set rxvt to use it (as suggested by this guide).

How do you set the fonts? You could set them with command line switches, or use a .XResources file in your Cygwin home directory (base file from here)):

rxvt.font:             Lucida Console-14
rxvt.boldFont:         Lucida Console-14
rxvt.scrollBar:        True
rxvt.visualBell:       True
rxvt.loginShell:       True
rxvt.background:       Black
rxvt.foreground:       White
rxvt.saveLines:        3000
rxvt.cursorColor:      Green
rxvt.scrollBar_right:  True

If you want to use the box drawing font (you have to install it on the system first):

rxvt.font:             Lucida ConsoleP-14
rxvt.boldFont:         Lucida ConsoleP-14
rxvt.scrollBar:        True
rxvt.visualBell:       True
rxvt.loginShell:       True
rxvt.background:       Black
rxvt.foreground:       White
rxvt.saveLines:        3000
rxvt.cursorColor:      Green
rxvt.scrollBar_right:  True

If you use the standard DOS terminal for Cygwin, you may want to change the code page setting in the batch file (original file is in this post) to:

set CYGWIN=codepage:oem
Categories: Uncategorized Tags:

Fun with Portable Cygwin

May 19th, 2010 No comments

UPDATE: For solutions to box drawing issues, see this post.

I just spent a good 30 minutes trying to figure out why the portable Cygwin installation (I haven’t really tested the portable part yet) I was working on refused to set my custom prompt automatically.

Turns out that bash doesn’t look for .bashrc for login shells, but instead looks for .bash_profile, which is what I’m used to using. For more info, see this nice page.

As far as making Cygwin itself portable, it seems to be as simple as this article suggests, however, there are some invalid and possibly unneeded (still worked when I removed them) commands in the batch files.

Here’s the batch file I use to start rxvt (I fixed some invalid options and removed some stuff):

@echo off

for /F %%A in ('cd') do set WD=%%A
set path=%WD%bin;%WD%usr\X11R6\bin;%path%
set SHELL=/bin/bash
set CYGWIN=codepage:437
set HOME=/home/user

:: Custom font for box drawing issues (not used atm)
:: bin\run rxvt -sl 1500 -bg black -fg gray -sr -fn 'Lucida ConsoleP-13' -tn rxvt-cygwin-native -e /bin/bash --login -i

:: Normal font
bin\run rxvt -sl 1500 -bg black -fg gray -sr -tn rxvt-cygwin-native -e /bin/bash --login -i
Categories: Uncategorized Tags: , ,