zquestz / s

Open a web search in your terminal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Duckduckgo !bangs with a leading `!`?

krompus opened this issue · comments

Great program!

I used Duckduckgo as my only primary engine (with !bangs to search other websites/search engines if necessary (example: !i poo party to search Google Images for "poo party").

I have noticed that !bangs work, but only if the exclamation point (the !bang) is placed after the letter string, not before. Example: s !w giraffe sends "weechat giraffe" to DDG, whereas s w! giraffe searches wikipedia for "giraffe", as intended. In the browser, either works.

I've been using !bangs with the exclamation point before the string for three years, and it will be difficult to retrain my muscle memory. Would it be possible to implement this feature, or might there be a way to hack it in?

For the time being, I'll try to get used to putting the ! after the string.

Thanks!

You just need to escape the !, your shell is expanding it.

s -p duck \!bangme

Looking into ways we can ignore this behavior in the shell. Kinda annoying to escape that.

setopt nobanghist in ~/.zshrc

@variadico you are awesome.

alias s="setopt nobanghist && s"

Cool, the backslash escape works! I'm using bash though (yeah, I know, I'm not one of the cool zsh-ers; I've been meaning to switch).

I've already aliased alias s="s -p duckduckgo"; it seems my options are:

s w! birthday
s \!w birthday

The backslash is kinda cumbersome in comparison, so I think I'll just keep using the exclamation point after the string if there's no way to setopt nobanghist in bash. Perhaps this is an example of why zsh is better? I haven't found anything regarding it in man bash. :P

K going to close this. Glad we got some resolution!