Skip to content

whoizit/goyo.vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 

Repository files navigation

goyo.vim (고요)

Distraction-free writing in Vim.

(Color scheme: seoul256)

Installation

Use your favorite plugin manager.

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

Usage

:Goyo [width]

You might map this to a key combo in your .vimrc like so:

"" Map Goyo toggle to <Leader> + spacebar
nnoremap <Leader><Space> :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)
  • g:goyo_callbacks ([before_funcref, after_funcref])

adding by atommixz

try it:

let goyo_width = 80
let goyo_margin_top = 0
let goyo_margin_bottom = 0

or it:

let goyo_width = 0
let goyo_margin_left = 45
let goyo_margin_right = 0
let goyo_margin_top = 0
let goyo_margin_bottom = 0

Callbacks

By default, vim-airline, vim-powerline, powerline, lightline.vim, 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 define before and after callbacks as follows in your .vimrc.

function! s:goyo_before()
  silent !tmux set status off
  set noshowmode
  set noshowcmd
  " ...
endfunction

function! s:goyo_after()
  silent !tmux set status on
  set showmode
  set showcmd
  " ...
endfunction

let g:goyo_callbacks = [function('s:goyo_before'), function('s:goyo_after')]

More examples can be found here: Customization

(If you get the error Unknown function: s:goyo_before, define the callback functions as globals. e.g. g:goyo_before)

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

About

Distraction-free writing in Vim

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 100.0%