aboutsummaryrefslogtreecommitdiff
path: root/vim/autoload
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-06-01 18:56:27 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-06-01 18:56:27 +1200
commit8e0e07990d29ef9c52fa91159ea725c2258e0091 (patch)
treebf8fa0b7713bcd83582054f0bb65e9273c939f9f /vim/autoload
parentUse three dashes for em-dash (diff)
downloaddotfiles-8e0e07990d29ef9c52fa91159ea725c2258e0091.tar.gz
dotfiles-8e0e07990d29ef9c52fa91159ea725c2258e0091.zip
Remove fortune.vim plugin
Fun idea but not really that useful.
Diffstat (limited to 'vim/autoload')
-rw-r--r--vim/autoload/fortune.vim59
1 files changed, 0 insertions, 59 deletions
diff --git a/vim/autoload/fortune.vim b/vim/autoload/fortune.vim
deleted file mode 100644
index da6e2fa3..00000000
--- a/vim/autoload/fortune.vim
+++ /dev/null
@@ -1,59 +0,0 @@
-" Declare paths to check for fortune files
-let s:paths = [
- \ $HOME.'/.fortunes',
- \ $HOME.'/.local/share/games/fortunes',
- \]
-
-" List of executables for which we need to check
-let s:executables = [
- \ 'fortune',
- \ 'timeout',
- \]
-
-" Entry point for plugin
-function! fortune#() abort
-
- " Check we have all of the executables we need
- for executable in s:executables
- if !executable(executable)
- echoerr 'Missing executable "'.executable.'"'
- endif
- endfor
-
- " Maximum length of fortunes is the width of the screen minus 1; characters
- " wider than one column will break this
- "
- let limit = &columns - 1
-
- " Some implementations of fortune(6) thrash the disk if they can't meet the
- " length limit, so we need to rap this invocation in a timeout(1) call
- let command = [
- \ 'timeout',
- \ '0.3s',
- \ 'fortune',
- \ '-s',
- \ '-n',
- \ limit,
- \]
-
- " Find a path for custom fortunes and add it on to the command if found
- for path in s:paths
- if isdirectory(path)
- call add(command, path)
- break
- endif
- endfor
-
- " Run the command and condense any control or space character groups into
- " just one space
- let fortune = substitute(
- \ system(join(command)),
- \ '[[:cntrl:][:space:]]\+',
- \ ' ',
- \ 'g',
- \)
-
- " Show the fortune message!
- echomsg fortune
-
-endfunction