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).


Install pathogen.vim (required)

$ mkdir -p ~/.vim/autoload ~/.vim/bundle && \
$ curl -LSso ~/.vim/autoload/pathogen.vim

Install scratch.vim

$ cd ~/.vim/bundle
$ git clone

Webpage: scratch.vim

Leave a Reply

Your email address will not be published. Required fields are marked *