/vim-redrum

🗡 All work and no play makes Jack a dull boy.

Primary LanguageVim ScriptMIT LicenseMIT

Redrum

Introduction

A novelty plugin that uses vim's conceal feature to show a buffer as if all its non-whitespace characters were repetitions of the iconic phrase "All work and no play makes Jack a dull boy" from "The Shining".

It is obviously of little utility.

Try inserting in a document with this plugin enabled: The experience of typing out your own words, only to see them come out as if you're Jack Nicholson (or Jack Torrance), is disorienting and mildly entertaining.

Note: This plugin doesn't actually change any buffer's contents, merely how they're shown.

Usage

:Redrum

Toggle redrum on and off.

:Redrum!

Turn redrum off.

Options

Options don't immediately take effect: If you change an option while redrum is on, you'll need to turn redrum off and on again to see any change.

Options can be configured for an individual buffer by prefixing them with b: instead of g:.

g:redrum_message

  • Type: String
  • Default: 'All work and no play makes Jack a dull boy. '

This is the message that will repeat over and over again, in the shape of your text.

Some alternatives:

  " Lorem ipsum
  let g:redrum_message = 'Lorem ipsum dolor sit amet, consectetuer adipiscing
    \ elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis
    \ natoque penatibus et magnis dis parturient montes, nascetur ridiculus
    \ mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,
    \ sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel,
    \ aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut,
    \ imperdiet a, venenatis vitae, justo.'

  " Metasyntatic variable soup
  let g:redrum_message = 'foo bar quuz corge quux foo quuz garply bar qux
    \ waldo foo quuz grault bar fred thud quuz bar thud garply plugh bar
    \ garply xyzzy corge garply waldo quux quuz'

g:redrum_match_pattern

  • Type: String (see :syn-pattern)
  • Default: '"."'

A match of this pattern in your buffer will be replaced by a character in the redrum_message.

Some alternatives:

  " Only replace non-whitespace characters
  let g:redrum_match_pattern = '"\w"'

g:redrum_skip_pattern

Type: String (see :syn-pattern) Default: '"^\s*\|\s\{4,}"'

A match of this pattern in your buffer will display as usual, and the next match of match_pattern will be replaced with next non-blank character of the message.

If something in your document isn't matched by this pattern or match_pattern, the message will reset at the next match_pattern.

Some alternatives:

  " Leave all whitespace alone
  let g:redrum_skip_pattern = '"\s"'

Inspirations