Scratch.vim: quick text buffer window

The intent of a vim scratch buffer is to provide a temporary area to store or edit text which gets discarded when you exit vim. The buffer will be retained as long as the vim session is on. Even if you are a heavy user of vim copy paste registers, the scratch buffer comes in handy to deal with reminders or code snippets you want to refer to later. There was a old plugin that does this. However, it’s not being maintained for 4 years (at the time of writing).

scratch.vim is a new vim plugin inspired by the original project and adds some nice features:

  • Auto-hide on inactivity.
  • Mappings for note taking and selection pasting directly into the scratch buffer.

Usage in vim

  • :Scratch opens the scratch buffer window using top 20% of the screen (configurable via g:scratch_height and g:scratch_top). The window automatically closes when inactive. The contents will be available the next time it is opened during the same session.
  • gs in normal mode opens the scratch window and enters insert mode. The scratch window closes when you leave insert mode. This is especially useful for quick notes.
  • gs in visual mode pastes the current selection (character-wise, line-wise or block-wise) into the scratch buffer.
  • gS in normal/visual mode clears the scratch buffer before opening it.
  • :help Scratch shows detailed list of configuration options.

Auto-closing features require hidden to be set (and can be disabled via the g:scratch_autohide option).

Installation

Install pathogen.vim (required)

$ mkdir -p ~/.vim/autoload ~/.vim/bundle && \
$ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

Install scratch.vim

$ cd ~/.vim/bundle
$ git clone https://github.com/mtth/scratch.vim

Webpage: scratch.vim

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s