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

cVim command for running JS scripts. #658

Closed jankaifer closed 6 years ago

jankaifer commented 6 years ago

I would really appreciate a new command eg. "script" or "js" that could be used to call JS from cVim scripts (possibly with jQuery). I'd use it because I want to have all my startup scripts in one file (cVim config) and because it can be used to create pretty powerfull cVim commands. With jQuery I can do almost everything on one line so that shouldn't be a problem.

For example, I want to have a keybinding for upvoting on stack overflow.

michaelhood commented 6 years ago

I might be misunderstanding, but can't you do this already with the {{ }} syntax in cvimrc?

cvTestAlert() -> {{
  alert("hi");
  console.log(self);
}}

map tA :call cvTestAlert<CR>
jankaifer commented 6 years ago

I have overlooked that in documentation. Should read more carefully. Anyway thanks for pointing out that feature out.

michaelhood commented 6 years ago

No problem. I missed it early on too. Really opens up more potential once you realize. :)