From 8e0e07990d29ef9c52fa91159ea725c2258e0091 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 1 Jun 2020 18:56:27 +1200 Subject: Remove fortune.vim plugin Fun idea but not really that useful. --- vim/autoload/fortune.vim | 59 ------------------------------------------------ vim/plugin/fortune.vim | 8 ------- vim/vimrc | 7 +----- 3 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 vim/autoload/fortune.vim delete mode 100644 vim/plugin/fortune.vim 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 diff --git a/vim/plugin/fortune.vim b/vim/plugin/fortune.vim deleted file mode 100644 index be4abdff..00000000 --- a/vim/plugin/fortune.vim +++ /dev/null @@ -1,8 +0,0 @@ -if exists('loaded_fortune') || &compatible - finish -endif -let loaded_fortune = 1 -command! -bar Fortune - \ call fortune#() -nnoremap (Fortune) - \ :Fortune diff --git a/vim/vimrc b/vim/vimrc index f59fbc25..91e9e9fb 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -2,7 +2,7 @@ " Tom Ryder (tejr)’s Literate Vimrc " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ " -" Last updated: Sun, 24 May 2020 10:00:15 UTC +" Last updated: Mon, 01 Jun 2020 06:56:18 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -1548,11 +1548,6 @@ nmap # \ (AlternateFileType) nmap 3 \ # -"" Leader,$/4 gives me my fortune -nmap $ - \ (Fortune) -nmap 4 - \ $ "" Leader,&/7 escapes regex metacharacters map & \ (RegexEscape) -- cgit v1.2.3