From 219c6dbb97f2d26368620dd1a79c687b694f58cf Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 22 Jun 2019 13:39:15 +1200 Subject: Don't throw on startup if no fortune executables --- vim/plugin/fortune.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'vim') diff --git a/vim/plugin/fortune.vim b/vim/plugin/fortune.vim index 6681312a..e800bfee 100644 --- a/vim/plugin/fortune.vim +++ b/vim/plugin/fortune.vim @@ -1,8 +1,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 * - \ if !argc() && line2byte('$') == -1 | Fortune | endif + \ call s:FortuneVimEnter() augroup END -- cgit v1.2.3