dbalatero / VimMode.spoon

Adds vim keybindings to all OS X inputs
688 stars 30 forks source link

Can´t get it to work with docs.google.com #71

Open bdiebold opened 3 years ago

bdiebold commented 3 years ago

Thanks for your awesome spoon - using it in a lot of apps.

Unfortunately, I have not yet managed to get it run with google docs. Whenever i enter normal mode, either it does not recognize further keystrokes or switches automatically back to insert mode.

Any idea - or is this a general problem ? image

dbalatero commented 3 years ago

Hey @bdiebold,

There are a lot of problems with rich input fields like Google Docs. What should be happening is that you enter fallback Vim mode, but it appears that it is actually trying to use the accessibility API + advanced mode here.

It's very odd because it's doing the right thing on my machine. Can you git pull the latest code for the plugin and reload Hammerspoon?

This is the logic that determines whether to try to use advanced mode: https://github.com/dbalatero/VimMode.spoon/blob/f1c740cb18afe6232b450b288832d60544ac6c6b/lib/accessibility_buffer.lua#L137-L145

It's possible this detection is broken/not complete in all cases:

https://github.com/dbalatero/VimMode.spoon/blob/f1c740cb18afe6232b450b288832d60544ac6c6b/lib/utils/ax.lua#L13-L27

dbalatero commented 3 years ago

Would something like a URL list be handy?

You could set up URL regexes to set which mode this plugin operates in?

I can get the current URL in Chrome with

tell application "Google Chrome" to return URL of active tab of front window

Safari with

tell application "Safari" to return URL of current tab of window 1

And Firefox appears to just be blowing it: https://bugzilla.mozilla.org/show_bug.cgi?id=516502

d8b887ab-63f8-4e62-9966-d6e02ed906ff commented 3 years ago

Same here. Exits normal after one keystroke in both docs.google.com and Gmail compose.

10.15.7 / Chrome 88.0.4324.96

diff --git a/lib/vim.lua b/lib/vim.lua
index 9237d4e..9db6eb0 100644
--- a/lib/vim.lua
+++ b/lib/vim.lua
@@ -307,7 +307,8 @@ function VimMode:exitModalAsync()
 end

 function VimMode:canUseAdvancedMode()
-  return AccessibilityBuffer:new(self):isValid()
+  --return AccessibilityBuffer:new(self):isValid()
+  return false
 end
dbalatero commented 3 years ago

@d8b887ab-63f8-4e62-9966-d6e02ed906ff

Does this work for you if you enforce fallback mode for docs.google.com as outlined here? https://github.com/dbalatero/VimMode.spoon#enforce-fallback-mode-with-url-patterns

dbalatero commented 3 years ago

I apologize for the inconsistencies, apps, particularly browsers, have some pretty wild behavior that's really hard to tame easily.

d8b887ab-63f8-4e62-9966-d6e02ed906ff commented 3 years ago

@d8b887ab-63f8-4e62-9966-d6e02ed906ff

Does this work for you if you enforce fallback mode for docs.google.com as outlined here? https://github.com/dbalatero/VimMode.spoon#enforce-fallback-mode-with-url-patterns No

It does work—albeit intermittently—in a freshly-created Chrome profile. Same for a page with just <html><body><textarea></textarea></body></html>.

Thanks for looking into it