Skip to content

Instantly share code, notes, and snippets.

@jtrim
Created October 7, 2015 15:10
Show Gist options
  • Save jtrim/ffdd4a6eb257b9fab786 to your computer and use it in GitHub Desktop.
Save jtrim/ffdd4a6eb257b9fab786 to your computer and use it in GitHub Desktop.
Plugin 'junegunn/goyo.vim'
" ===================
" Goyo
" ===================
function! s:goyo_enter()
setlocal wrap linebreak nolist
set virtualedit=
setlocal display+=lastline
noremap <buffer> <silent> k gk
noremap <buffer> <silent> j gj
noremap <buffer> <silent> 0 g0
noremap <buffer> <silent> $ g$
if exists('$TMUX')
silent !tmux set status off
endif
endfunction
function! s:goyo_leave()
setlocal nowrap
set virtualedit=all
silent! nunmap <buffer> k
silent! nunmap <buffer> j
silent! nunmap <buffer> 0
silent! nunmap <buffer> $
if exists('$TMUX')
silent !tmux set status on
endif
endfunction
autocmd User GoyoEnter nested call <SID>goyo_enter()
autocmd User GoyoLeave nested call <SID>goyo_leave()
let g:goyo_width=110
nmap <Leader>z :Goyo<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment