

GitHub - junegunn/goyo.vim: Distraction-free writing in Vim
source link: https://github.com/junegunn/goyo.vim
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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 [dimension]
- Turn on or resize Goyo
:Goyo!
- Turn Goyo off
The window can be resized with the usual [count]<CTRL-W>
+ >
, <
, +
,
-
keys, and <CTRL-W>
+ =
will resize it back to the initial size.
Dimension expression
The expected format of a dimension expression is
[WIDTH][XOFFSET][x[HEIGHT][YOFFSET]]
. XOFFSET
and YOFFSET
should be
prefixed by +
or -
. Each component can be given in percentage.
" Width
Goyo 120
" Height
Goyo x30
" Both
Goyo 120x30
" In percentage
Goyo 120x50%
" With offsets
Goyo 50%+25%x50%-25%
Configuration
g:goyo_width
(default: 80)g:goyo_height
(default: 85%)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()
if executable('tmux') && strlen($TMUX)
silent !tmux set status off
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
endif
set noshowmode
set noshowcmd
set scrolloff=999
Limelight
" ...
endfunction
function! s:goyo_leave()
if executable('tmux') && strlen($TMUX)
silent !tmux set status on
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
endif
set showmode
set showcmd
set scrolloff=5
Limelight!
" ...
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
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]
, 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
Recommend
-
1285
A minimalist Vim plugin manager. Pros. Easy to set up: Single file. No boilerplate code required. Easy to use: Concise, intuitive syntax
-
292
fzf vim Things you can do with fzf and V...
-
259
vim-emoji Emoji in Vim. Extracted from vim-github-dashboard. Installation Using
-
9
Distraction-free writing OS Here’s an idea for a cheap alternative to expensive ‘distraction-free’ word processors like the Freewrite (much as I love the idea of the Freewri...
-
14
Distraction free writing in VimI use Vim as a plain text editor for everything. Apart from coding, I write blog posts in vim, create quick notes and draft design documents. Surprisingly, I haven’t customized it a lot and am very lean...
-
10
FeatherQuill - 34+ Hours of Distraction-Free WritingIntroduction: FeatherQuill - 34+ Hours of Distraction-Free Writing
-
9
This distraction-free writing tool is perfect for writers on the go
-
4
Disable Distraction Free Writing Mode and Full Height Editor editor based on a list of post types. · GitHub Instantly share cod...
-
13
Automatic installation Place the following code in your .vimrc before plug#begin() call let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' if empty(glob(data_dir . '/autoload/plug.vim')...
-
6
Freewrite Traveler review: portable, distraction free writin...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK