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

Feature Request: implement Vimium-style insert mode #656

Closed
gibfahn opened this issue Jan 21, 2018 · 10 comments
Closed

Feature Request: implement Vimium-style insert mode #656

gibfahn opened this issue Jan 21, 2018 · 10 comments

Comments

@gibfahn
Copy link

gibfahn commented Jan 21, 2018

First off, thanks for this extension, it has a laundry list of features that I haven't found in any other addon.

It would be really useful to have something like the i insert mode mapping in Vimium. It's similar to the disable plugin hotkey, but it's more useful in websites that already have good keyboard shortcuts.

The difference is that it that it's implemented as a mode, so:

  • It's faster
  • It doesn't persist between pages on the same domain, or if you reload the tab.
  • You can see that you're in Insert mode (from the status bar).
  • You can disable it with Esc, so you can always use Esc to get back to Normal mode.

For example in YouTube or Gmail, I want to always start with SurfingKeys on, but easily drop into the web-page keyboard shortcuts when I want to use the Keyboard Mappings for the media controls, or the email selection. The Insert analogy works well because it's similar to wanting to edit a textbox.

Some discussion of how the feature is used at philc/vimium#314 (although the issue isn't actually about that).

@brookhong
Copy link
Owner

You could keep only specified keys from Surfingkeys on specified sites as below,

// only keep E, R and T from Surfingkeys for gmail.com and twitter.com
unmapAllExcept(['E','R','T'], /gmail.com|twitter.com/);

In that way, you need not enter any mode to use wanted short-cuts both from Surfingkeys and the page itself.

You could use your own regex for the second parameter to extend sites.

#547

@gibfahn
Copy link
Author

gibfahn commented Jan 22, 2018

Yeah, I've tried that, problem is that there are loads of hotkeys used in both. Also it doesn't scale when you have a large number of pages that you'd need to manually update.

Gmail:

image

Youtube:

image

@brookhong
Copy link
Owner

Alt-s to toggle Surfingkeys, actually does what you proposed.

It's faster

Yes, only Alt-s.

It doesn't persist between pages on the same domain, or if you reload the tab.

This is a little different, the switch persists on same domain, but another Alt-s will bring Surfingkeys back.

You can see that you're in Insert mode (from the status bar).

Yes, it is actually a mode (called Disabled), another Alt-s will exit from it. The difference here is that Surfingkeys does not show it in status bar by default, it grays the Surfingkeys icon in toolbar.

You can disable it with Esc, so you can always use Esc to get back to Normal mode.

The difference here is Surfingkeys uses Alt-s rather than Esc.

@gibfahn
Copy link
Author

gibfahn commented Jan 23, 2018

Alt-s to toggle Surfingkeys, actually does what you proposed.

I agree there's not a huge difference, but I would argue that it's significant (I'm currently using Alt-s).

It's faster
Yes, only Alt-s.

Let's forget speed for now, it's not that much slower, and maybe it's just my imagination 😁 .

This is a little different, the switch persists on same domain, but another Alt-s will bring Surfingkeys back.
The difference here is Surfingkeys uses Alt-s rather than Esc.

Yes, the fact that it's per-domain, and the fact that it's toggled, make it much harder to use in my experience.

Here's my flow with Vimium:

  • Switch to tab
  • Press Escape a couple of times
  • Ready (I know I'm in Normal mode and not visual or insert)

Here's my flow in SurfingKeys:

  • Switch to tab
  • Press Escape a couple of times (I could be in Visual on insert mode)
  • Try the thing I want to do, it doesn't work because I'm in disabled mode
  • Check the icon to see whether it's blue or grey (hard to tell in my browser)
    image
    image
  • Press Alt-s
  • If I got it wrong I've now disabled SurfingKeys, so I have to check and press Alt-s again.
  • Ready

My ideal would be a non-persistent disabled mode that is per-tab, and that can be turned off (not toggled) with Esc. For me Vim is fast because you don't need to check your status, you just press Esc and go.

@brookhong
Copy link
Owner

Alt-i to enter PassThrough mode to temporarily suppress SurfingKeys.

New mode PassThrough exported for this since 0.9.25.

@gibfahn
Copy link
Author

gibfahn commented Jan 29, 2018

Wow, that completely meets my needs, and is better than the Vimium equivalent, thanks a lot!

gibfahn added a commit to gibfahn/dot that referenced this issue Feb 7, 2018
The SurfingKeys maintainer straight-up implemented exactly the feature I
asked for within days, so now this can be used directly.

Might change the Ctrl-S shortcut at some point.

Refs: brookhong/Surfingkeys#656
gibfahn added a commit to gibfahn/dot that referenced this issue Feb 13, 2018
The SurfingKeys maintainer straight-up implemented exactly the feature I
asked for within days, so now this can be used directly.

Uses p for PassThrough mode.

Refs: brookhong/Surfingkeys#656
@jbyler
Copy link

jbyler commented May 30, 2018

I like PassThrough mode, thanks @brookhong! I agree that I prefer it to the Alt-s disable.

I would even like to take it one step further, and have a command to enable PassThrough mode for just a single keystroke. This is like vim's r command (for "replace") which is like "[s]ubstitute" mode but for just a single character. I would bind the command to r and use it for accessing a site's built-in keyboard shortcuts without disabling anything, i.e. re on GitHub to edit a file, or r. in Jira or Bitbucket to open the commands menu.

@gibfahn
Copy link
Author

gibfahn commented Jun 5, 2018

I would even like to take it one step further, and have a command to enable PassThrough mode for just a single keystroke. This is like vim's r command (for "replace") which is like "[s]ubstitute" mode but for just a single character.

Yeah I have it bound to p.

map('p', '<Alt-i>'); // Map p to toggle passthrough mode.

@aspiers
Copy link
Contributor

aspiers commented Jan 22, 2019

@gibfahn I'm not 100% sure but I think @jbyler was not talking about shortening the keyboard shortcut for passthrough mode, but instead suggesting a different way of enabling a passthrough mode which is non-sticky, i.e. it automatically quits after passing a single keystroke through to the page. @jbyler is that right? If so, I think it's a great idea and recommend submitting a separate issue for that feature request.

@jbyler
Copy link

jbyler commented May 14, 2019

@aspiers Yes, your paraphrase matches my intent: a non-sticky passthrough, which only passes a single keystroke and then quits. I filed issue #964 to track this idea.

Thanks again for making a great extension!

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

No branches or pull requests

4 participants