Junegunn Choi 9e04ccdb9d Promote the use of User events instead of g:goyo_callbacks
This does not break backward compatibility, g:goyo_callbacks is still
allowed.
2014-08-11 02:16:31 +09:00
2013-12-02 02:59:12 +09:00

goyo.vim (고요)

Distraction-free writing in Vim.

(Color scheme: seoul256)

Best served with limelight.vim.

Installation

Use your favorite plugin manager.

  • vim-plug
    1. Add Plug 'junegunn/goyo.vim' to .vimrc
    2. Run :PlugInstall

Usage

  • :Goyo
    • Toggle Goyo
  • :Goyo [width]
    • Turn on or resize Goyo
  • :Goyo!
    • Turn Goyo off

You might want to define a map for toggling it:

nnoremap <Leader>G :Goyo<CR>

Configuration

  • g:goyo_width (default: 80)
  • g:goyo_margin_top (default: 4)
  • g:goyo_margin_bottom (default: 4)
  • g:goyo_linenr (default: 0)

Callbacks

By default, vim-airline, vim-powerline, powerline, lightline.vim, vim-signify, and vim-gitgutter are temporarily disabled while in Goyo mode.

If you have other plugins that you want to disable/enable, or if you want to change the default settings of Goyo window, you can set up custom routines to be triggered on GoyoEnter and GoyoLeave events.

function! s:goyo_enter()
  silent !tmux set status off
  set noshowmode
  set noshowcmd
  set scrolloff=999
  Limelight
  " ...
endfunction

function! s:goyo_leave()
  silent !tmux set status on
  set showmode
  set showcmd
  set scrolloff=5
  Limelight!
  " ...
endfunction

autocmd! User GoyoEnter
autocmd! User GoyoLeave
autocmd  User GoyoEnter call <SID>goyo_enter()
autocmd  User GoyoLeave call <SID>goyo_leave()

More examples can be found here: Customization

Inspiration

Pros.

  1. Works well with splits. Doesn't mess up with the current window arrangement
  2. Works well with popular statusline plugins
  3. Prevents accessing the empty windows around the central buffer
  4. Can be closed with any of :q[uit], :clo[se], :tabc[lose], :bd[elete], or :Goyo
  5. Can dynamically change the width of the window
  6. Adjusts its colors when color scheme is changed
  7. Realigns the window when the terminal (or window) is resized or when the size of the font is changed
  8. Correctly hides colorcolumns and Emojis in statusline
  9. Highly customizable with callbacks

License

MIT

Description
🌷 Distraction-free writing in Vim
Readme MIT 276 KiB
Languages
Vim Script 100%