/vim-cloud-buffer

Save your buffers remotely

Primary LanguageVim ScriptMIT LicenseMIT

vim-cloud-buffer

CloudBuffer is a plugin developed to store and retrieve buffers in a MongoDB Simple Http Rest endpoint.

Highly inspired by gist-vim, it's indented to be used as a mean to centralise "work in progress" documents in the cloud. If you just want to instantly share code, notes, and snippets, gist-vim will suit you best.

Features

  • Lists your most recently updated buffers at the top giving you an immediate context of what you are working on
  • Remembers buffer filetype and jumps to the last modified position in the buffer upon retrieval
  • Prevents losing buffer contents by accident by issuing soft deletes
  • Allows you to search historical buffers using regular expressions

Let me show you a glimpse:

vim-cloud-buffer

Usage

Save current buffer remotely:

:CloudBuffer -s

List your remote buffers:

:CloudBuffer
:CloudBuffer -l
" add bang(!) to include deleted buffers
:CloudBuffer!
:CloudBuffer! -l
" Hit enter to retrieve a buffer in the list

:CloudBuffer also retrieves a specific buffer when issued from a line containing an embedded buffer id with the following format:

BufferId:56403ab4e4b09256a23f49d8

List buffers matching a criteria:

:CloudBuffer -re regexp
" add bang(!) to include deleted buffers
:CloudBuffer! -re regexp

Delete a buffer

:CloudBuffer -d
" add bang(!) to remove a buffer permanently
:CloudBuffer! -d

Requirements

Installation

Plugin managers

The most common plugin managers include vim-plug, NeoBundle, Vundle and pathogen.vim.

With pathogen.vim, just clone this repository inside ~/.vim/bundle:

git clone https://github.com/jbgutierrez/vim-cloud-buffer.git ~/.vim/bundle/vim-cloud-buffer
git clone https://github.com/mattn/webapi-vim.git ~/.vim/bundle/webapi-vim

With the other plugin managers, just follow the instructions on the homepage of each plugin. In general, you just have to add a line to your ~/.vimrc:

" vim-plug
Plug 'jbgutierrez/vim-cloud-buffer'
Plug 'mattn/webapi-vim'
" NeoBundle
NeoBundle 'jbgutierrez/vim-cloud-buffer'
NeoBundle 'mattn/webapi-vim'
" Vundle
Plugin 'jbgutierrez/vim-cloud-buffer'
Plugin 'mattn/webapi-vim'

Manual installation

Copy the contents of each directory in the respective directories inside ~/.vim.

You need to install webapi-vim also:

http://www.vim.org/scripts/script.php?script_id=4019

If you want to use latest one:

https://github.com/mattn/webapi-vim

Setup

This plugin has been tested using mongolab hosting service. Sign up for a 500Mb free account and follow these steps if you lack a MongoDB Simple Http Rest endpoint.

Just declare the following two variables in your .vimrc

let g:vim_cloud_buffer_url = "https://api.mongolab.com/api/1/databases/vim-cloud-buffer/collections/buffers"
let g:vim_cloud_buffer_api_key = "SECRET"

Bugs

Please report any bugs you may find on the GitHub issue tracker.

Contributing

Think you can make CloudBuffer better? Great!, contributions are always welcome.

Fork the project on GitHub and send a pull request.

License

CloudBuffer is licensed under the MIT license. See http://opensource.org/licenses/MIT

Happy hacking!

Note: Did you find this plugin useful? Please star it and share with others.