Luc Hermitte's Cygwin configuration | Monday 12th June 2006 |
[ main ] | [ vim ] | [ mutt ] | [ cygwin ] | [ resume ] |
.inputrc
What follows are files and some configuration aspects from my cygwin installation. Everything here have been tested with Cygwin 1.3.12-4 on a MsWindows Millenium equiped PC, and since then with Cygwin 1.5.10 on MsWindows XP Pro SP1.
The Cygwin Project is a port of the popular tools GNU development tools for MicrosoftWindows operating systems.
The cygwin *NIX emulation layer completly changes the way the paths are
managed. All the cygwin hierarchy appears under the «/
» : new
root directory as on unices.
Unfortunately, MsWindows native tools (i.e. not using the cygwin
layer) can't understand paths expressed in the UNIX way.
In order to convert *NIX (i.e. cygwin)-paths into plain
MsWindows-paths, we can use: 'cygpath -w
'.
But, Cygwin also permits many nice things like symbolic links -- try
'man ln
'. Unfortunately, cygpath
seems (at
this time) unable to follow these links and to return the exact
MsWindows-path to the linked-files.
Moreover, I had many headaches with the management of spaces on MsWindows 9x series when using command line invocation of native win32 tools.
So here is cyg-wrapper.sh
, a shell script that fixes
all these problems. It permits to launch native win32 applications from
command-line (or even from Mutt) with any kind of
pathnames passed as parameters.
cyg-wrapper.sh |
cyg-wrapper v2.18. Requires cygUtils to run and more precisally realpath . Cygutils-Package is also distributed as an official part of the cygwin net-release. To get help on the way to use cyg-wrapper ,
try a 'cyg-wrapper.sh --help | less' or look
at the aliases in my .profile .
|
cyg-wrapper-1.1.sh |
cyg-wrapper v1.1. Does not require cygUtils to run. It is slower and provide less options than the version 2.x. |
It enables us to do things like:
gvim /etc/profile -c /PS1 -c "echo 'correctly opened'" # or even: cd ~/tmp ; ln -s ~/bin/cyg-wrapper.sh gvim -d http://hermitte.free.fr/cygwin/cyg-wrapper.sh cyg-wrapper.sh explorer -e explorer "$vim" explorer http://hermitte.free.fr/
Last note, cygstart
(from cygUtils) and
cyg-wrapper
are similar but behave slightly
differently. cyg-wrapper
permit to pass arguments and
more files on the command line to any program ;
cyg-wrapper
can also follow symbolic links, handle
binary options, and convert or unset environment variables.
Related excerpt from my .profile
#================================================= # Definitions (excerpt from my .profile) #================================================= ## Program Files cprograms="C:\Program Files" # $ucprograms used to build $PATH ; transformation needed with older # versions of Cygwin ucprograms=`cygpath -u "$cprograms"` # Note, in order to change_directory (/...) to $cprograms, as the space # within the pathname causes troubles, use double-quote around the # environment variable: # > cd "$cprograms" # =================================================================== ## VIM vim="${cprograms}\Edition\vim" # $uvim used to build $PATH uvim=`cygpath -u "$vim"` # PATH="${PATH}:${uvim}/vim63" # The following syntax concerns cyg-wrapper 2.0.+ alias vi= 'cyg-wrapper.sh "C:/Progra~1/Edition/vim/vim63/gvim.exe" --binary-opt=-c,--cmd,-T,-t,--servername,--remote-send,--remote-expr' ## Little trick for LaTeX-Suite: # If one of the parameters is a (La)TeX file, then we declare the # servername to be «LATEX». gvim() { opt='' if [ `expr "$*" : '.*tex\>'` -gt 0 ] ; then opt='--servername LATEX ' fi cyg-wrapper.sh "F:/Progra~1/Edition/vim/vim63/gvim.exe" --binary-opt=-c,--cmd,-T,-t,--servername,--remote-send,--remote-expr --cyg-verbose --fork=2 $opt "$@" } ## Some other windows programs alias explorer='cyg-wrapper.sh "explorer" --slashed-opt' alias mplayer='cyg-wrapper.sh "c:/Progra~1/Window~1/mplayer2.exe"' # =================================================================== ## Aliases and Environnement for external viewers needed when using LaTeX # Yap alias xdvi='cyg-wrapper.sh yap' # Ghostview PATH="${PATH}:${ucprograms}/Edition/Ghostgum/gsview" alias gv='cyg-wrapper.sh gsview32 --slashed-opt'' GSPATH="$ucprograms/Edition/gs/gs7.04" PATH="${PATH}:${GSPATH}/bin:${GSPATH}/lib" # Acrobat Reader PATH="${PATH}:${ucprograms}/Edition/Adobe/Acrobat 5.0/Reader" alias xpdf='cyg-wrapper.sh "AcroRd32.exe"' alias acroread='cyg-wrapper.sh "AcroRd32.exe"'
Related Links
Soren Andersen's scripts for running gvim.
Some generic aliases I use
#================================================= ### Aliases (excerpt from my .profile) #================================================= ### List directory contents alias ls='ls -F --color' alias l='ls -altr ' #With tcsh: alias ll='\ls -altr $* | less ' ll() { \ls -aFltr --color $* | less -R } LESS="-B -c -h4 -i -M -q -x4" # Display the $PATH in a human acceptable way alias PATH="echo $PATH | tr ':' '\n'" ### Directories pushing ; Very handy!!! # Shortcuts + better presentation of the directories pushed. ## Display the directories pushed d() { \dirs \ | awk '{gsub(/ ~/, "!~"); gsub(/ \//, "!/") ; n=split($0,arr,"!") ; for (i=1;i<=n;++i) print (i-1)" -> "arr[i] }' } alias dirs=d # Note: We can not directly write «dirs() { \dirs | ... }» as it would # end in an infinite loop. Hence the declaration of «d(){}» and dirs as # an alias for d. ## Push a directory p() { if [ -z "$*" ] ; then # If no parameter, we do not want to push the current directory \pushd > /dev/null else # The quotes in «"$*» permit to write «p $vim» \pushd "$*" > /dev/null fi # List the directories pushed d } ## Move to a pushed directory alias p1="p +1" alias p2="p +2" alias p3="p +3" alias helpcommand=winhlp32
.inputrc
If you find cygwin limited regarding accentuated characters, delete key not
properly working, etc., did you configured your keyboard ?
Have a look at Anne Baretta's
«Consistent Backspace & Delete Configuration» web page.
For more help, check 'man bash
' (and search for
readline
/inputrc
) and 'man
readline
'.
Otherwise, here is as a result my .inputrc
. I
haven't tested RXVT rebindings, but console ones work very well. I've
redefined the <Del>
key to
erase the character before the cursor, <Home>
, <End>
to their usually expected behavior,
<C-U>
to erase the whole
line ; accentuated characters can be hit ; functions keys have been
binded to become some handy (to me) shortcuts.
Just a little note about how to run Mutt on MsWindows 9x systems.
If you try to install the Mutt release found on Cygwin distributions, you will quickly experience many troubles related to file-locks. Indeed, this release expects the OS to support different things that are only supported by the MsWindows-NT series (NT, 2000 & XP).
The other solution available is to use a win32 native compilation of Mutt.
Check for instance «Mutt on Windows».
Unfortunately, the classical win32 release of VIM (that can be found on sourceforge and VIM mirrors) is
not usable at all with the win32 version of Mutt.
Indeed, win32-Vim is always forking, and running 'gvim -f
'
won't change anything. This is not suitable for Mutt. The only way Vim does
not fork is when it is launched from Cygwin.
So, I've finally ended up to recompile Mutt, on Cygwin. Now, I don't
have any locking issues, and Mutt is correctly waiting for Vim termination.
For those interrested, I got some patches available from «Mutt on Windows»
(patch-1.2.5.uen.edit_threads.2.txt
, and
patch-1.4.uen.smtp.1.txt
), and recompiled Mutt with:
gzip -cd mutt-1.4.tar.gz | tar xf - cd mutt-1.4 patch -p1 < ../patch-1.2.5.uen.edit_threads.2.txt patch -p1 < ../patch-1.4.uen.smtp.1.txt make configure ./configure --enable-pop --enable-imap --with-ssl --enable-imap-edit-threads \ --enable-external-dotlock --with-regex --enable-pgp --enable-smtp make make install
Little excerpt from my .muttrc
Note: I use Hamster on my local host as an IMAP and SMTP server.
# Set the path to where you want all your mail files kept set folder = "$HOME/Mail" account-hook . 'unset imap_user ; unset imap_pass ; unset tunnel' account-hook imap://localhost/ 'set imap_user="Luc" ; set imap_pass="the_password"' account-hook imap://imap.free.fr/ 'set imap_user="hermitte" ; set imap_pass="the_password"' # IMAP settings for Hamster ; note: Hamster-Fr V2.1.1.7 seems to require # the user account to have a password... set spoolfile = imap://localhost/ ################ # If patch SMTP set sendmail = 'builtin' set smtp_serv = "localhost" set smtp_user = "Luc" # log on to $smtp_serv as $smtp_user # set smtp_pass = "" # use ESMPT and "AUTH LOGIN" # Warning: password is sent as plain text (base64 encoded. no encyption) set envelope_from = yes # envelope_from is required in order to use an address recognized by the # real smtp server (ie, not Hamster). ################ ... set editor = "cyg-wrapper.sh gvim '+/^$'" # editor to use when composing messages # Note: cyg-wrapper is required on my Cygwin system to find the real file. # Indeed, Mutt is compiled for Cygwin while Vim is compiled for MsWindows only.
Related Links
Sven
Guckes's «Mutt on MsWindows (cygwin)» site.
My .muttrc and a
presentation I gave (in French only at this time).
Back to the Home Page | hermitte@free.fr |