Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow shortcuts without parameters #329

Merged
merged 1 commit into from
Mar 3, 2017

Conversation

rti
Copy link
Contributor

@rti rti commented Mar 2, 2017

This change provides a simple way to allow calling shortcuts without parameters.

I see several positive effects:

Navigate to your favourite pages via shortcuts

Without necessarily going to search there but check the news feed or what so ever.

Compromise for #284

You could now do:

shortcut-add w=https://en.wikipedia.org/wiki/Main_Page
shortcut-add ws=http://en.wikipedia.org/wiki/Special:Search?search=$0

So you would have to define two shortcuts, but basically it allows the workflow @aksr requested.

Compromise for #181

Say you set a duckduckgo short via:

shortcut-add du=https://duckduckgo.com/?q=$0

You can now :open du some search string as usual. But you can also just :open du which will bring you to the duckduckgo front page featuring search suggestions. Several search engines I tested send you to the search front page if the url query was empty. So it's a way to rapidly access search suggestions without vimb implementing it :) Maybe it helps the workflow of @257

What do you think?

src/main.c Outdated
@@ -252,8 +252,8 @@ gboolean vb_load_uri(Client *c, const Arg *arg)
rp = realpath(path, NULL);
uri = g_strconcat("file://", rp, NULL);
free(rp);
} else if (strchr(path, ' ') || !strchr(path, '.')) {
/* use a shortcut if path contains spaces or no dot */
} else if (!strchr(path, '.')) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed for the parameter free shortcuts? I've added the strchr(path, ' ') to allow to search for something containing dots like "document.activeElement". This would not work without the check for space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right, my bad. I misinterpreted the condition. I will update the commit.

@rti rti force-pushed the shortcuts_without_parameters branch from 813a9c8 to 4860da8 Compare March 3, 2017 07:24
@rti
Copy link
Contributor Author

rti commented Mar 3, 2017

Updated, not removing the check for space anymore.

@fanglingsu fanglingsu merged commit 4860da8 into fanglingsu:webkit2 Mar 3, 2017
@fanglingsu
Copy link
Owner

Tank you!

@aksr
Copy link

aksr commented Mar 3, 2017

Could be this also merged into master branch?

fanglingsu added a commit that referenced this pull request Mar 3, 2017
@fanglingsu
Copy link
Owner

@aksr I've applied the changes to the master branch too.

@aksr
Copy link

aksr commented Mar 3, 2017

Thank you.

@rti rti deleted the shortcuts_without_parameters branch April 17, 2017 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants