1995eaton / chromium-vim

Vim bindings for Google Chrome.
https://chrome.google.com/webstore/detail/cvim/ihlenndgcmojhcghmfjfneahoeklbjjh
MIT License
2.25k stars 325 forks source link

Support of . (dot) repeating a command? #104

Open ghost opened 10 years ago

ghost commented 10 years ago

Would it be possible to be able to use the dot to repeat a command? I use that a LOT in pentadactyl on firefox and it's probably one of the last things I can think of that I'm missing vs cVim.

Example usages: gT . . . . to go back 5 tabs. Because I could just hit g5T but I'm lazy and like to look through each tab as I flip through them and the period command is excellent for laziness. Same with (half page down, for me), and then just using the period to scroll down

1995eaton commented 10 years ago

Added. Check out the repeatCommand mapping in the :help page. Let me know how this works out for you.

ghost commented 10 years ago

I've just spent some time playing with it, it's pretty good so far!

I had to put map . repeatCommand inside my configuration for the . command to work, but no biggie. I also found out that the dot command doesn't seem to work with mappings I've made myself that contain the : key. For instance, I mapped d to closing a tab because that's the mapping in pentadactyl but the dot command doesn't work with that. The dot command also doesn't seem to work with h/j/k/l but works fine with G or gg.

And on an unrelated note, the : key is now practically impossible for me to use on a google web page because it always focuses the typing area no matter how much I click out or hit the escape key first.

1995eaton commented 10 years ago

That's strange. Which version of cVim are you using? I fixed an issue just like this in a recent commit, so I'd try pulling the latest changes if you're using the GitHub version. If that doesn't work, try removing set noautofocus from your cvimrc.

I'll have to play with the repeatCommand mappings to see if I can spot the first bug you mentioned.

ghost commented 10 years ago

I just pulled the latest changes from GitHub and I don't seem to need a "map ." key for anything to work anymore.

The "d" to close a tab is still broken, however, yet I fixed it in an interesting way (which seems to confirm the bug).

  1. map d :quit<CR> is broken with the dot repeatCommand
  2. map d x works just fine
  3. unmap d x unmaps d but not x
  4. unmap x before map d x doesn't work, as expected.
  5. unmap x after map d x works just fine, and d keeps its behavior while x is correctly unmapped. I do believe vim has its mappings recursive so it doesn't matter what order the mappings are at, but this is a minor issue to me.
  6. set noautofocus had no effect on any of the above, nor on the inability to hit : on a google search page.

All of this seems to point towards the issue being that the repeatCommand doesn't like things with a : in them.

As for the : key not working on a google web page, that's still an issue.

This is my full cVimrc for reference, all I left out were my let qmark letter = "url" mappings.