diff options
Diffstat (limited to 'vim')
-rw-r--r-- | vim/after/syntax/mail.vim | 3 | ||||
-rw-r--r-- | vim/autoload/fortune.vim | 59 | ||||
-rw-r--r-- | vim/plugin/fortune.vim | 8 | ||||
-rw-r--r-- | vim/vimrc | 19 |
4 files changed, 8 insertions, 81 deletions
diff --git a/vim/after/syntax/mail.vim b/vim/after/syntax/mail.vim new file mode 100644 index 00000000..77c76f00 --- /dev/null +++ b/vim/after/syntax/mail.vim @@ -0,0 +1,3 @@ +" Don't spellcheck code in mail messages +syntax region mailCode start='`' end='`' keepend contains=@NoSpell +syntax region mailCodeBlock start=' \{4\}' end='$' contains=@NoSpell 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 <silent> <Plug>(Fortune) - \ :<C-U>Fortune<CR> @@ -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 21:38:45 UTC " " │ And I was lifted up in heart, and thought " │ Of all my late-shown prowess in the lists, @@ -325,7 +325,7 @@ filetype plugin indent on " There are a couple of contexts in which it's useful to reload filetypes for " the current buffer, quietly doing nothing if filetypes aren't enabled. " We'll set up a user command named :ReloadFileType to do this, with -" a script-local function backing it. +" an autloaded function backing it. " command! -bar ReloadFileType \ call reload#FileType() @@ -340,10 +340,6 @@ command! -bar ReloadFileType " define the new command wrapper around an autoloaded function that itself " issues a :ReloadFileType command after the vimrc file is sourced. " -" We can't put the actual :source command into the script-local function we -" define here, because Vim would get upset that we're trying to redefine -" a function as it executes! -" command! -bar ReloadVimrc \ call reload#Vimrc() @@ -364,7 +360,7 @@ autocmd vimrc BufWritePost $MYVIMRC \ ReloadVimrc if $MYVIM !=# '' autocmd vimrc BufWritePost $MYVIM/vimrc - \ ReloadVimrc + \ doautocmd vimrc BufWritePost $MYVIMRC endif " If Vim is new enough (v7.0.187) to support the ##SourceCmd event for @@ -375,11 +371,11 @@ endif " <https://github.com/vim/vim/releases/tag/v7.0.187> " if exists('##SourceCmd') - autocmd vimrc SourceCmd $MYVIMRC/vimrc + autocmd vimrc SourceCmd $MYVIMRC \ ReloadVimrc if $MYVIM !=# '' autocmd vimrc SourceCmd $MYVIM/vimrc - \ ReloadVimrc + \ doautocmd vimrc SourceCmd $MYVIMRC endif endif @@ -1548,11 +1544,6 @@ nmap <Leader># \ <Plug>(AlternateFileType) nmap <Leader>3 \ <Leader># -"" Leader,$/4 gives me my fortune -nmap <Leader>$ - \ <Plug>(Fortune) -nmap <Leader>4 - \ <Leader>$ "" Leader,&/7 escapes regex metacharacters map <Leader>& \ <Plug>(RegexEscape) |