diff options
Diffstat (limited to 'vim/autoload/fortune.vim')
-rw-r--r-- | vim/autoload/fortune.vim | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/vim/autoload/fortune.vim b/vim/autoload/fortune.vim deleted file mode 100644 index 6bbe6b3b..00000000 --- a/vim/autoload/fortune.vim +++ /dev/null @@ -1,46 +0,0 @@ -let s:paths = [ - \ $HOME.'/.fortunes', - \ $HOME.'/.local/share/games/fortunes', - \] - -let s:executables = [ - \ 'fortune', - \ 'timeout', - \] - -function! fortune#() abort - - for executable in s:executables - if !executable(executable) - echoerr 'Missing executable "'.executable.'"' - endif - endfor - - let limit = &columns - 1 - - let command = [ - \ 'timeout', - \ '0.3s', - \ 'fortune', - \ '-s', - \ '-n', - \ limit, - \] - - for path in s:paths - if isdirectory(path) - call add(command, path) - break - endif - endfor - - let fortune = substitute( - \ system(join(command)), - \ '[[:cntrl:][:space:]]\+', - \ ' ', - \ 'g', - \) - - echomsg fortune - -endfunction |