1 2 3 4 5 6 7 8 9 10 11 12 13 14
command! -bar Fortune \ call fortune#() function! s:FortuneVimEnter() abort if !argc() && line2byte('$') == -1 try | Fortune | catch | endtry endif endfunction augroup fortune autocmd! autocmd VimEnter * \ call s:FortuneVimEnter() augroup END