mirror of
https://github.com/junegunn/goyo.vim.git
synced 2025-11-08 11:23:51 -05:00
ae04751e0967ee337f072982ae0f32f0db1f3f25
goyo.vim (고요)
Distraction-free writing in Vim.
(Color scheme: seoul256)
Best served with limelight.vim.
Installation
Use your favorite plugin manager.
- vim-plug
- Add
Plug 'junegunn/goyo.vim'to .vimrc - Run
:PlugInstall
- Add
Usage
:Goyo- Toggle Goyo
:Goyo [width]- Turn on or resize Goyo
:Goyo!- Turn Goyo off
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])
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! GoyoBefore()
silent !tmux set status off
set noshowmode
set noshowcmd
set scrolloff=999
Limelight
" ...
endfunction
function! GoyoAfter()
silent !tmux set status on
set showmode
set showcmd
set scrolloff=5
Limelight!
" ...
endfunction
let g:goyo_callbacks = [function('GoyoBefore'), function('GoyoAfter')]
More examples can be found here: Customization
Inspiration
Pros.
- Works well with splits. Doesn't mess up with the current window arrangement
- Works well with popular statusline plugins
- Prevents accessing the empty windows around the central buffer
- Can be closed with any of
:q[uit],:clo[se],:tabc[lose],:bd[elete], or:Goyo - Can dynamically change the width of the window
- Adjusts its colors when color scheme is changed
- Realigns the window when the terminal (or window) is resized or when the size of the font is changed
- Correctly hides colorcolumns and Emojis in statusline
- Highly customizable with callbacks
License
MIT
Languages
Vim Script
100%
