Archive

Archive for the ‘Cygwin’ Category

Cygwin, zsh & rebaseall

November 7th, 2012 No comments

If you happen knowingly or unknowingly upgrade your zsh you may run into the dreaded “cannot create fork” “dll overlapping” problem not even ls will work. It happens rarely enough that when it occurs I panic thinking that my entire Cygwin environment is corrupt, but phew it just needs a rebaseall.

Now rebaseall must be run with Cygwin shutdown and here’s the kicker and Cygwin services such as sshd must be stopped in Windows services. The easiest way I know then to run the rebaseall command is directly from Windows Run box or from a Dos prompt

\cygwin\bin\dash -c ‘/usr/bin/rebaseall’

 

and hey presto your Cygwin will be fine.

Categories: Cygwin, zsh Tags:

Vim, Cygwin, docx2txt, catdoc and antiword view Microsoft Word Documents as Text

October 10th, 2011 No comments

I wanted to quickly compare two versions of a Word document and realized I didn’t know how to do it. A quick Google revealed that catdoc was available with Cygwin (and I guess elsewhere) .

> catdoc report1a.doc > report1a.txt
> catdoc report1b.doc > report1b.txt
> diff report1*.txt

Alternatively use antiword
place the following 4 lines in your .vimrc file

” use antiword to allow VIM to view the text of a Word Document
autocmd BufReadPre *.doc set ro
autocmd BufReadPre *.doc set hlsearch!
autocmd BufReadPost *.doc %!antiword “%”

> vim -d report1a.doc report1b.doc

Remember neither catdoc or antiword allow you to update your word documents.

catdoc also works with PowerPoint etc.

Just found out that these don’t work with the XML based docs eg report.docx for these you need Perl based docx2txt

Categories: Cygwin, vim, windows Tips Tags:

Wonderful bindkey : assign anything to any key

February 11th, 2011 No comments

I have been working on a laptop a lot recently but it was bugging me that I didn’t have the * key on its own key as you do on a full size keyboard. I realized that I wasn’t using the function keys F1 to F12 at the shell level but didn’t know how to configure. Now my situation is a little complicated as I’m using zsh on cygwin on a Windows 7 PC.

Now I’m used to using bindkey to launch widgets eg control-O to duplicate previous word on the command line , and control-L the hyper-useful suspend current command line entry to allow execution of a single command ie do a quick ls or change a permission etc.
here they are:-

bindkey -M viins ‘^O’ copy-prev-shell-word # copy previous shell word

bindkey ‘^L’ push-line # push current command into a buffer,
These use built-in widgets however the really clever amongst can develop their own.

Anyway I just wanted to reprogram the function keys to output another character or string. I posted a question into the zsh newsgroup and quickly got a reply. I needed the -s option

What you have to do, type the following at your prompt yes actually type Control-V followed by F7

> bindkey -s “^vF7” “ls -l” # replace the ls -l with whatever you like

Now heres the rub, what you actually see generated is (will vary from system to system)
bindkey -s “^[[18~” ‘ls -l’

this is what you must copy and paste into your shell startup file

This is actually simple enough for me to type these from the CLI for a short-term use. Boy am I going to enjoy using bindkey!

Categories: Cygwin, shell tips Tags:

Great Tip : Opening Multiple Instances of an Application from the Windows Taskbar

April 25th, 2010 No comments

Tip 1:-
I always need several Cygwin Windows open so I was very frustrated by Windows 7 only allowing me to open one Cygwin from the Windows 7 Taskbar. This is because once you click on an icon it disappears from the Taskbar! This is different to the behavior of the previous XP or Vista Taskbar and often prompts users to select the Vista Taskbar compatibility. There is fortunately a work around depress the SHIFT button and then click the existing open icon on the taskbar and voila you will spawn a application window!

Tip 2:-
The Properties Tab is HIDDEN on the Windows 7 Taskbar and had me hating it until I found it. Rightmouse click the relevant Application Icon on the Taskbar then hover over the revealed tab and Right Mouse Click this and there magically is the Properties Tab!!