tags:

views:

159

answers:

4

I have the following code in my .Zshrc

function google; {
             $VIEW "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
     }

I get

google masi                                         
google:1: no such file or directory: http://www.google.com/search?q='url-encode masi'

How can you get Google Search to work in Zsh?

+1  A: 

What's the value of $VIEW?

Set it to the path of a web browser or downloader.

Anonymous
I accept the answer, since it suggests that the problem is in the value of $VIEW.
Masi
+1  A: 

Masi, if you're going to cut and paste things into zshrc then ask for help, you need to at least tell us where you got them.

Matthew Flaschen
-1 for adding to uselessness.
jim
I don't think it's unreasonable to expect some context for questions asked here.
Matthew Flaschen
@Matthew, this isn't an answer - it should have been left as a comment. Still, a -1 is harsh for that, I'd prefer to leave a comment explaining why it's a bad idea (like this one). If your rep was 2000, I'd be less forgiving :-)
paxdiablo
Fair enough, Pax.
Matthew Flaschen
@Matthew: The source is SO at http://stackoverflow.com/questions/171563/whats-in-your-zshrc/187853#187853
Masi
+1: for the idea that sources must be used.
Masi
Thank you, Masi. I think it makes it much easier for people to figure things out when they can see the big picture. In this case, jkramer mentioned that VIEW was meant to be set to the browser.
Matthew Flaschen
+1  A: 

Don't know anything about zsh but looks like you've got a problem with your quotes.

Looks like it evaluates the url to being

http://www.google.com/search?q='url-encode masi'

Which probably isn't what you were after. (url encoded version of 'masi') ?

jim
@Lou: True. I had initially a problem with smart quotes. Your quotation is also better than the original.
Masi
+4  A: 

The following solves the problem in Mac

function google; {
             open "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
     }

and in Ubuntu

function google; {
             gnome-open "http://www.google.com/search?q='url-encode "${(j: :)@}"'"
     }
Masi