• Stars
    star
    328
  • Rank 128,352 (Top 3 %)
  • Language
    Python
  • Created about 7 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vim/Nvim client for GhostText - Edit browser text areas in Vim/Neovim

Vim Ghost

Edit browser textarea content in Vim/Neovim!

demo
  1. Install this firefox addon or this Chrome extension

  2. Add this plugin

    " Vim-plug
    Plug 'raghur/vim-ghost', {'do': ':GhostInstall'}
  3. Ensure you have a vim/neovim instance open. Run :GhostStart to start the server.

  4. On any textarea, click the ghost icon - switch to neovim and edit!. Content is sync’ed real time. Works both ways - edits in the browser window are pushed to neovim as well.

  5. When done, just delete the buffer with :bd! - you’ll be disconnected

Configuring filetype

Whenever a buffer is connected, a User event vim-ghost#connected is raised. Here’s a quick sample of setting filetype to markdown if the textarea was on github or reddit

function! s:SetupGhostBuffer()
    if match(expand("%:a"), '\v/ghost-(github|reddit)\.com-')
        set ft=markdown
    endif
endfunction

augroup vim-ghost
    au!
    au User vim-ghost#connected call s:SetupGhostBuffer()
augroup END

Requirements

additional requirements for vim

" Only enabled for Vim 8 (not for Neovim).
Plug 'roxma/nvim-yarp', v:version >= 800 && !has('nvim') ? {} : { 'on': [], 'for': [] }
Plug 'roxma/vim-hug-neovim-rpc', v:version >= 800 && !has('nvim') ? {} : { 'on': [], 'for': [] }

Auto switching to vim:

Optional, but highly recommended - Switching focus to Neovim
  • Linux: The xdotool command - if available, will be used to focus the nvim window. Works in console, tmux or guis like neovim-qt

    • On Ubuntu, you can install it with sudo apt-get install xdotool

  • macOS: Set the g:ghost_darwin_app variable to the name of your app (see docs).

  • Windows: If pywinauto (https://github.com/pywinauto/pywinauto) is available, it will be used to bring the neovim-qt to foreground.

    # Ensure that you install this module for the version of python
    # that is loaded in neovim
    pip install pywinauto

    Limitations: Currently, on windows, the processname is hardcoded to nvim-qt If you use any of the other GUIs for neovim (OniVim, gonvim etc) then this will not work.

Rationale

With Firefox moving to webextensions, It’s all text is dead. Typing in text areas is a royal PITA and I was looking for a replacement. Came across GhostText - but the vim addon seems dead and uses tcl :ugh:

My vimscript fu is pretty limited - so I thought I’d write a python plugin for neovim.

TODOS

PR’s welcome. Some areas:

  • vim compatibility - DONE

Love it or just find it as useful as I do? Star this repo to let me know

More Repositories

1

mermaid-filter

Pandoc filter for creating diagrams in mermaid syntax blocks in markdown docs
JavaScript
408
star
2

fruzzy

Freaky fast fuzzy finder for (denite.nvim/CtrlP matcher) for vim/neovim
Python
110
star
3

easyblogger

Python client for Blogger platform. Write blog posts in Markdown or asciidoc and publish them on Blogger.
Python
47
star
4

TomatoKetchup

Save a copy of FreshTomato router WebUI to local disk as a backup
JavaScript
19
star
5

vuejs2-typescript-starter

VueJS2 starter with Typescript, Webpack, code-splitting, unit tests (karma) & code coverage with ASP.NET Core 2.0 server
Vue
9
star
6

hey.py

Dead simple reminder CLI tool for linux; Reminders are shown on Web and Mobile using your own Telegram bot
Python
5
star
7

powertool

Tool to wake up or suspend machines remotely by name
Python
5
star
8

zsh-arduino

zsh plugin for arduino build, upload and monitor
Shell
5
star
9

vimfiles

My vim/neovim configuration
Lua
4
star
10

eventstore-bench

Eventstore on Azure Container Services - benchmarking file storage vs local pod storage
JavaScript
4
star
11

github_commit_mailer

Python script to recieve Github.com post recieve hook and send emails with diffs
Python
3
star
12

rest-websocket-sample

Sample code for RESTful service (using Jersey) and a websocket client (Jetty/CometD)
Java
3
star
13

cxf-junit-jetty

Sample code for writing a Junit test for a restful service using CXF
Java
3
star
14

qbittorrent.py

Python client for qbittorrent REST api
Python
1
star
15

fuzzy-denite

Only for archival - see raghur/fruzzy for something that actually works well
Go
1
star
16

dotfiles

Perl
1
star
17

gitlab-cf-le-autossl

Automatically renew Gitlab Pages SSL certs using DNS challenge (Let'sEncrypt & CloudFlare). This is a mirror of
Shell
1
star
18

Eventstore.Utils

C#
1
star