Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A few lines in my vimrc for controlling the distraction-free environment Goyo.
" WordProcessor Mode / Goyo
let g:goyo_width=65
let g:wp_mode_is_on = 0
function! ToggleWPMode()
if g:wp_mode_is_on
set formatoptions=tcq
set nowrap nolinebreak expandtab
silent! nunmap <buffer> k
silent! nunmap <buffer> j
silent! nunmap <buffer> 0
silent! nunmap <buffer> $
silent! iunmap <buffer> k
silent! iunmap <buffer> j
silent! iunmap <buffer> 0
silent! iunmap <buffer> $
let g:wp_mode_is_on = 0
else
set formatoptions=ant1
noremap k gk
noremap j gj
noremap 0 g0
noremap $ g$
set wrap linebreak nolist noexpandtab
set formatprg=par
set spell spelllang=en_us
let g:wp_mode_is_on = 1
endif
endfunction
nnoremap <Leader>g :Goyo<CR>:call ToggleWPMode()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.