Code Monkey home page Code Monkey logo

vim-stay-fresh's Introduction

Vim Stay Fresh

This is a Vim plugin which simply makes a silent curl request to localhost:7700/reload whenever Vim emits a BufWritePost autocmd event. The idea is that you can then install the corresponding Chrome extension, chrome-stay-fresh, which listens for those requests and triggers a reload in whichever Chrome tabs are configured to respond.

For those interested, the vim-hooks plugin generalizes on this concept and allows you to hook any script into any Vim autocmd event. A one-line script which simply ran curl localhost:7700/reload on BufWritePost events is one specific example that would be functionally the same as installing this plugin, though you can no doubt imagine many other sorts of scripts, or sets of scripts, which could be used to achieve more complicated ends.

Installation

If you don't have a preferred installation method, I recommend installing pathogen.vim, and then simply copy and paste:

cd ~/.vim/bundle
git clone https://github.com/ahw/vim-stay-fresh.git

Of course in order for anything interesting to happen, you must also install chrome-stay-fresh, and detailed instructions on how to do so are available at that link.

Local Use

vim-stay-fresh just makes HTTP requests to localhost:7700, which the native host process is already listening to. So, no further set up is required. Click the extension's icon in the browser toolbar to toggle whether or not that tab reacts to reload requests.

Remote Use (SSH)

The command ssh your.server.com -R 7700:localhost:7700 will enable remote port forwarding, which means that all requests made to port 7700 on your.server.com will be sent through an SSH tunnel to your client machine, which will then just forward that request to the client's localhost:7700. Voila. You can set up your ~/.ssh/config file as follows in order to avoid having to remember to add the remote port forwarding argument all the time.

Host your.server.com
  HostName 12.34.56.78
  User sarah
  RemoteForward 7700 localhost:7700

vim-stay-fresh's People

Contributors

ahw avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.