gitmyhub

goyo.vim

Vim Script ★ 4.7k updated 6mo ago

:tulip: Distraction-free writing in Vim

Goyo is a Vim plugin that creates a focused, distraction-free writing environment inside the Vim text editor. When you activate it with the :Goyo command, it hides all the surrounding chrome, status bars, and line decorations, and centers your text in a clean window so you can concentrate on writing. Typing :Goyo again toggles it off and restores your normal editing environment.

The name comes from a Korean word meaning quietness or stillness. The README recommends pairing it with another plugin called limelight.vim, which dims all text except the paragraph you are currently working on.

You can control the size and position of the writing window using a dimension expression. This lets you specify width, height, and offsets either as fixed character counts or as percentages. For example, you can set the writing area to 120 characters wide, or center it at 50 percent of the screen width with a 25 percent offset.

Several popular Vim plugins that add status bars or gutter indicators are automatically hidden while Goyo is active, including vim-airline, lightline.vim, vim-gitgutter, and vim-signify. For anything not handled automatically, Goyo provides two callback events, GoyoEnter and GoyoLeave, that let you run custom Vim script when the mode turns on and off.

The README also includes a FAQ addressing a common issue: if you have custom color tweaks in your Vim config, exiting Goyo can reset them. The solution is to apply your color customizations inside a ColorScheme autocmd rather than directly in the config file.

The plugin is licensed under MIT.