]> git.phdru.name Git - dotfiles.git/commitdiff
.vimrc: Automatically run `mkspell` when saving spell `.add` files
authorOleg Broytman <phd@phdru.name>
Fri, 19 Jul 2019 17:22:07 +0000 (20:22 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 19 Jul 2019 17:22:07 +0000 (20:22 +0300)
.vimrc

diff --git a/.vimrc b/.vimrc
index a5314d40b1bd0d4d6504fe794bbcf9b52dfc68a2..4bb96bc4ba1914ff8461dd3f50d67f58d5a8911d 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -772,6 +772,15 @@ if has("spell")
       endif
    endfunction
    autocmd BufReadPost * call SetupSpell()
+
+   function! SaveSpell()
+      if expand('%') == expand('~/.vim/spell/en.ascii.add')
+         mkspell! -ascii %
+      else
+         mkspell! %
+      endif
+   endfunction
+   autocmd BufWritePost ~/.vim/spell/*.add call SaveSpell()
 endif