aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/plugin/fortune.vim8
1 files changed, 7 insertions, 1 deletions
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