raghur / vim-ghost

Vim/Nvim client for GhostText - Edit browser text areas in Vim/Neovim
333 stars 13 forks source link

feature-request: configurable temp file extension #19

Closed wizzup closed 4 years ago

wizzup commented 6 years ago

GhostText is the only extension I know that work on site like HackerRank (codemirror editor)

Setting filetype in vim work for syntax highlight but external tools (linter, repl) will refuse to treat a file as source code (in my case is Haskell).

I could do a dirty edit to ghost.py but it would be ugly and only work for single language.

It would be great if temporary file extension is configurable (let ghost_temp_ext=hs, for example)

raghur commented 6 years ago

This is definitely doable... Just need a hash of domain names and corresponding file extensions and create the temp file based on the host name in the incoming url.

Would you mind giving it a shot?

wizzup commented 6 years ago

I might want to use more than one file extension on a domain . I think what I really want is to be able to have command like :GhostSetFileExt ext after server is started. I have no idea how to do that. I know virtually nothing about writing neovim plugin.

I am thinking of how I can do that without server need to be restart because it would require reactivate ghosttex browser extension.

BTW this is what I have so far a46091800e57e425e32878f591dc1908f6281564

raghur commented 6 years ago

I might want to use more than one file extension on a domain .

That might not be feasible to do automatically since we get only so much info from the browser plugin.

command like :GhostSetFileExt ext after server is started.

just set a vimscript variable in the command and you can read the value of the variable when the browser connects. See the setting for ghost port - it can be set on the vim side and read in the python code.

You can change the vimscript var and that's not tied to the server lifetime itself.

jdhao commented 5 years ago

@wizzup I have been using a Windows program called Text Editor Anywhere which let your define extensions and the editors to edit the text area. When you activate this program, it lets you select the extension you want to use and open a temp file inside the editor of your choice (so it can be neovim-qt in my case). After you finished writing the text, the text will be copied to the text area.

You can give a try if you use Windows.

wizzup commented 5 years ago

@jdhao Thank for the info but I don't have any Windows machine and I only trust in opensource software.

fragilelambda commented 4 years ago

+1 for this feature request

jdhao commented 4 years ago

@wizzup @fragilelambda Now we have firenvim that turns text area into a Nvim buffer. You can also specify the buffer filetype on a per-website basis. By far the best experience I get. Try it.

PS: this message is written using firenvim

image .