The ramblings of Chad Humphries

Posts Tagged ‘zsh

Getting your keys tied and bound in ZSH

leave a comment »

Let’s take a little trip down to shell-ville. It’s a small town down on the coast where the locals still like to know the nitty gritty details of how their operating systems work.

Today we are going to visit Bind Key park. It’s said you can make almost anything happen there with just a keystroke or two. Why what’s this? It seems a local orator is giving a speech on the parks heritage.

To clear the line you must press Control-K.

bindkey '^K'

Lost at the end of the line? Go to the beginning with Control-A

bindkey "^A"

Having the opposite issue? Go to the end of the line with Control-E

bindkey "^E"

What’s more, you can search through your history backwards using Control-R!

bindkey "^R"

Not enough for you, how about just pressing Down?

bindkey "[B": history-search-forward

Fine, not easily impressed eh? Up will search your history back in time?

bindkey "[A": history-search-backward

Hmm, he does seem convincing. I’ve recorded the most informative bits in this post for all to see. If you wish to use this knowledge carefully inscribe it into your .zshrc file.

Written by spicycode

October 21, 2008 at 7:56 pm

Posted in programming

Tagged with

Type the project name to change to it’s directory in ZSH

Inspired by Muness I decided to implemented lazy project aliases in ZSH.  It’s a two step process.

1) Set your cd path

export CDPATH=~/programming/mine:~/programming/work:~/

2) Enable auto cd for directory names

setopt auto_cd

3) Profit?

Written by spicycode

August 7, 2008 at 6:43 pm

Posted in programming

Tagged with

globzilla – destroyer of subversion

At the office today Nick and I tried an experiment. It was a failed one, but who said all news has to be good news? Here’s how it breaks down.

Step 1: Optimal Optimism

Be lazy enough that you don’t want to use one of the plentiful svn add scripts on the net.

Step 2: Arbitrary Assumptions

Decide, hey, I can make that happen with fewer characters!

Step 3: Shiny Shells

Try to run the following in your sleek zsh shell:

svn add **/* So, this step is awesome! It adds all the new files, while not re-adding existing files. It also has the added benefit of scrolling so much text in your console you have time to get a refreshing drink.

Step 4: Reversion Regret

However, the last step has the added benefit of adding svn ignored files by calling them as explicit targets. This gives us a wonderful experience of learning how to selectly svn revert everything our nuclear svn add option just did.

Step 5: Bowing Back

So what have we learned? Sometimes globs do not solve all problems. Most perhaps, but definitely not all. Also, I’d like to give a shout out to my friend subversion, who enabled me to rollback this mess of a command.

Written by spicycode

May 3, 2007 at 5:49 pm

Posted in programming

Tagged with ,