editing textareas in Firefox with vim

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

editing textareas in Firefox with vim

Eli the Bearded
This is really a Firefox issue, but I figure this list might have a
better set of people to tackle it than mozilla.support.firefox.

At one time, Firefox had a wide open (read: slow and security issue
prone) extensions API. At that time I could use an extension called
"It's All Text". With one very short shell script and one line of
config, I had Firefox configured to open an xterm running vim with the
contents connected to a textarea in the page just by pushing a button
in the webpage. The browser would update on every ":w". It worked
very well and reliably. Then the API was removed.

Now extensions do not have permissions to launch external programs. To
get this kind of functionality, websocket connections to a second
separately run program are used. I know of two implementations:

withExEditor / withExEditorHost
https://addons.mozilla.org/addon/withexeditor/
https://github.com/asamuzaK/withExEditorHost

I got this working shortly after the cutoff for the old API. It's
slightly different in that it also let you edit one line text inputs,
which seems a bit overkill, but okay. I have had a lot of trouble
keeping it working, however. At present withExEditor tells me it is
"connected" to the host, but the host version is incompatible. I'm
pretty sure I have both up to date, though.

GhostText / Ghost Text Vim
https://addons.mozilla.org/en-US/firefox/addon/ghosttext/
https://github.com/falstro/ghost-text-vim

I just learned of this one this week. The vim component is using gvim,
I'm not sure if that's important or just the preference of the author.
Anyway, I installed gvim for the test rather than my preferred
vim-in-xterm setup.  It is apparently using some sort of client / server
interface with vim that aims for two way communication between the
textarea in the browser and the editor; updated when not in "insert
mode". As proof of concept, I did get it to work, but not well. On my
test page[*], it opened about twenty gvim windows, only one of which was
connected to the browser.

[*] https://qaz.wtf/ta/
    It's about as simple HTML as the URL is short.

Have people here on vim-users found another method? Or have tips for
getting one of these two to work?

Elijah

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

tony-2
> Have people here on vim-users found another method? Or have tips for
> getting one of these two to work?
>

We're on the same wavelength, Elijah

Sadly I do not have much to offer as my search started after Waterfox https://www.waterfoxproject.org/en-US/waterfox/new/ upgraded and broke It's All Text! https://github.com/docwhat/itsalltext :-(

I did try installing QuteBrowser https://www.qutebrowser.org/ but could not get it working with gvim as I use vim in the terminal though there is a thread https://www.reddit.com/r/qutebrowser/comments/780u6a/how_to_set_vim_as_qutebrowser_editor/ It allows an insert mode with an external editor like vim. YMMV

So right now, I just use "+p and "+y for accessing the system clipboard (+clipboard compiled) http://vim.wikia.com/wiki/Accessing_the_system_clipboard as I am tired of all the workarounds just to edit in vim.

Welcome to 2018!

Best,
tony

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

Michael Henry-5
I've been using "textern" for this, though I don't use it
heavily.  It's working for me on Ubuntu 16.04 with Firefox
61.0.1 and GVim 8.1.290.  Here are the steps I followed to
install:

- Install URL:
  https://addons.mozilla.org/en-US/firefox/addon/textern/

- References:
  https://github.com/jlebon/textern

- Bring down native app::

    cd ~/build
    git clone --recurse-submodules https://github.com/jlebon/textern
    cd textern

- Install native app::

    make native-install USER=1

- In Firefox preferences for textern:

  - Set "External Editor" to ``["gvim", "--nofork"]``.

- Press Ctrl-Shift-E to bring up editor.

Michael Henry

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

John Little-4
On Saturday, August 25, 2018 at 11:25:19 PM UTC+12, Michael Henry wrote:
> I've been using "textern" for this...

Fantastic, I didn't know about this option.  I'm typing this in gvim using the add-on.

>...
> - Press Ctrl-Shift-E to bring up editor.

It defaulted to Ctrl-Shift-D.

Regards, John Little

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

Michael Henry-5
On 08/26/2018 02:02 AM, John Little wrote:

> On Saturday, August 25, 2018 at 11:25:19 PM UTC+12, Michael Henry wrote:
>> I've been using "textern" for this...
>
> Fantastic, I didn't know about this option. I'm typing this
> in gvim using the add-on.
>
>> ...
>> - Press Ctrl-Shift-E to bring up editor.
>
> It defaulted to Ctrl-Shift-D.

Thanks for pointing this out; my instructions were missing one
step, so I've updated my notes accordingly::

- Set Shortcut to ``Ctrl+Shift+E``.

I should probably have left that out of my email, since it's
just a personal preference.  I'd gotten used to Ctrl-Shift-E
from a previous plugin, so I change the shortcut for
convenience.  It also better matches the ``Ctrl-E`` shortcut
used by the "External Editor" Thunderbird plugin I use for
composing emails using Vim, making it easier for me to remember.

Michael Henry

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

Eli the Bearded
In reply to this post by Michael Henry-5

Michael Henry wrote:
> I've been using "textern" for this, though I don't use it
> heavily.  It's working for me on Ubuntu 16.04 with Firefox
> 61.0.1 and GVim 8.1.290.  Here are the steps I followed to
> install:
>
> - Install URL:
>   https://addons.mozilla.org/en-US/firefox/addon/textern/

This sounds great. Clear instructions, simple install. Nothing happens.
I even watched stdout / stderr from Firefox, no warnings or errors or
anything at all.

Textern thinks something is happening, though. If I hit <ctrl-shift-D>
a second time, it tells me the textarea is already being edited. But ps
says otherwise. :-(

Elijah

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

Michael Henry-5
On 08/27/2018 12:37 AM, Eli the Bearded wrote:

>
> Michael Henry wrote:
>> I've been using "textern" for this, though I don't use it
>> heavily.
>
> This sounds great. Clear instructions, simple install. Nothing happens.
> I even watched stdout / stderr from Firefox, no warnings or errors or
> anything at all.
>
> Textern thinks something is happening, though. If I hit <ctrl-shift-D>
> a second time, it tells me the textarea is already being edited. But ps
> says otherwise. :-(

I'm not familiar with the innards of textern, so all I can
suggest are a few debugging ideas:

- Restart everything (Firefox, your login session) and test
  again.

- Verify that you have Python 3.5+ installed on Linux as the
  ``python3`` executable in PATH.

- Test with gedit or another editor.

- Use a script in place of the editor, and within the script
  write to a file to prove the script was launched.

You may well have already tried everything I listed above and
more.  For me, it just works as advertised; hopefully you can
make it work in your environment, too.

Michael Henry

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

Michael Henry-5
Perhaps one last idea for debugging problems with textern; you
might close Firefox, rename ``~/.mozilla`` out of the way, then
restart Firefox to generate a new profile, then see if you can
make textern work.  I recently had to do this myself to solve a
weird Firefox problem I encountered.  I never knew what
incorrect setting or corrupted file in my profile may have been
responsible for the problem, but the new profile fixed it.

Michael Henry

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: editing textareas in Firefox with vim

Eli the Bearded
Michael Henry wrote:
> Perhaps one last idea for debugging problems with textern; you
> might close Firefox, rename ``~/.mozilla`` out of the way, then
> restart Firefox to generate a new profile, then see if you can
> make textern work.  I recently had to do this myself to solve a
> weird Firefox problem I encountered.  I never knew what
> incorrect setting or corrupted file in my profile may have been
> responsible for the problem, but the new profile fixed it.

Thanks for your debugging ideas. I have a somewhat more advanced way to
do that:

alias newfirefox='firefox -ProfileManager -no-remote'

I create new browser profiles regularly for testing things / clearing
settings. I suspect the issue more likely lies in some other aspect of
my system, although I haven't pinpointed what. My personal loathing of
Python is my current stumbling block in trying to add more debugging
output to that script.

(How anyone who grew up using vi's % could like a language with no
matched pairs is beyond me.)

Elijah

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.