-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support query keyword in activateBookmark. #4591
base: master
Are you sure you want to change the base?
Support query keyword in activateBookmark. #4591
Conversation
This is a cool feature. I've tested your PR and it works. However, I'm realizing that one can't pass a query with a space in it using the This feature is still useful, because the query Before merging this and documenting the feature, I think we'll need a syntax for encoding spaces in options passed to commands with FYI @UncleSnail since you've been working on command syntax recently. |
We do this to allow us to have a syntax to open a query in the vomnibar with spaces within it.
Good point, I'd not noticed that. So, if we wanted to just do a quick substitution of the parsed options we could do the following for options[parse[0]] = parse.length === 1 ? true : parse[1].replace("%20", " "); Also, while messing around with that, I noticed that the unit tests are broken. I fixed them in a commit, which I'm gonna push to this branch (might be cleaner to split it off into it's own PR, but I'm not sure how you want to do things for this) Actually while I"m at it I'm also gonna push a commit and test for changing |
4164184
to
9e346f2
Compare
@mijoharas Ack, sorry about the unit test breakage. That was a subtle breakage (make.js still exits successfully...). I've pushed a fix in bf0bdda. I'm not sure %20 is a good solution for how to handle spaces; it's just one thing that I tried. If we decode %20 in option values, does that mean we decode every other escape sequence? Supporting some kind of quoting around option values is another solution. I haven't used Vim in years, but I think .vimrc supports triple backslash for escaping spaces, and also surrounding option values with single quotes, for instance. Let's see if anyone else chimes in with an opinion. |
yeah, I don't particularly think that |
Thank you for pinging me on this @philc. I was thinking the same as you suggested here. I need to escape spaces in bash nearly every day, and while I occasionally write the bash command (if it's short) like:
It is usually easier to use:
For the average user, I believe this would be the easiest and most understandable solution. If we want an option with spaces, just write it in double quotes:
None of the options that are currently supported are likely to have double quotes in them, except potentially URLs, which are likely to have the encoding instead, so I don't think there would be a big issue with breaking existing configs. I personally think it's better to solve this by escaping double quotes like The vim script way seems to lean more towards escaping spaces like The benefit of using something like %20 is that we don't even need to use a find and replace, we can get all the encodings for free just using At first glance, it seems like we could just ignore spaces until we reach an "optionName=" but since we support unnamed options like
This would make the options list become Again, I personally prefer the "quote multi-word options" design, but there are other options. |
Also, if you do decide to go with quoting out multi-word options, I'd be willing to write the parser changes if you would like. |
Description
I would like to create a shortcut that lets me browse a specific folder in my bookmarks. To do this I would like to prefill a query into the
Vomnibar.activateBookmark
command.What I want is to have:
To allow me to browse the links folder of my bookmarks.
It turns out that those options already get parsed into the keyregistry, and the activate command already accepts these options, so the only thing to needed would be to add this extra argument to the content script (similarly to the
Vomnibar.activate
above) as is done in the PR.