1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
command! -bar Fortune \ call fortune#() nnoremap <silent> <Plug>(Fortune) \ :<C-U>Fortune<CR> function! s:FortuneVimEnter() abort if !argc() && line2byte('$') == -1 try Fortune catch " Do nothing endtry endif endfunction augroup fortune autocmd! autocmd VimEnter * \ call s:FortuneVimEnter() augroup END