diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2022-05-09 16:39:21 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2022-05-09 16:56:43 +1200 |
commit | d4818329bf021e015ea92705b7bb417e78edbdef (patch) | |
tree | 52471ee5b5990bebb40b7d555676e5a56a6b3fc7 /after/ftplugin/html/spelllang.vim | |
download | vim-html-spelllang-d4818329bf021e015ea92705b7bb417e78edbdef.tar.gz vim-html-spelllang-d4818329bf021e015ea92705b7bb417e78edbdef.zip |
Commit first versionv0.1.0
Diffstat (limited to 'after/ftplugin/html/spelllang.vim')
-rw-r--r-- | after/ftplugin/html/spelllang.vim | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/after/ftplugin/html/spelllang.vim b/after/ftplugin/html/spelllang.vim new file mode 100644 index 0000000..8f44384 --- /dev/null +++ b/after/ftplugin/html/spelllang.vim @@ -0,0 +1,33 @@ +" html/spelllang.vim: Attempt to detect 'spelllang' from HTML buffers + +" Don't load if running compatible or too old +if &compatible || v:version < 802 + finish +endif + +" Don't load if already loaded +if exists('b:did_ftplugin_html_spelllang') + finish +endif + +" Flag as loaded +let b:did_ftplugin_html_spelllang = 1 +let b:undo_ftplugin .= '|unlet b:did_ftplugin_html_spelllang' + +" Set up hooks for divining 'spelllang' from lang= attributes +augroup html_spelllang + if exists('##TextChanged') + autocmd TextChanged * + \ if &modified + \| call html#spelllang#Set() + \|endif + else + autocmd InsertLeave * + \ if &modified + \| call html#spelllang#Set() + \|endif + endif +augroup END +call html#spelllang#Set() +let b:undo_ftplugin .= '|execute ''autocmd! html_spelllang''' + \ . '|augroup! html_spelllang' |