aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-22 13:39:15 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-22 13:47:29 +1200
commit219c6dbb97f2d26368620dd1a79c687b694f58cf (patch)
treece1d63f69078825700404d6c0f4b5aa58bb1f7ea /vim
parentFlesh out fortune.vim a little more (diff)
downloaddotfiles-219c6dbb97f2d26368620dd1a79c687b694f58cf.tar.gz
dotfiles-219c6dbb97f2d26368620dd1a79c687b694f58cf.zip
Don't throw on startup if no fortune executables
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