Fix automatically setting spellfile when spelllang is set in the modeline
This commit is contained in:
parent
7727b2a8fa
commit
757ad38b85
46
init.vim
46
init.vim
@ -1039,12 +1039,35 @@ augroup END
|
||||
" Add spell checking to LaTeX documents {{
|
||||
let g:spellfile_URL = 'http://ftp.vim.org/vim/runtime/spell'
|
||||
function! SetLanguageSpecificSpellFile()
|
||||
set spellfile=
|
||||
|
||||
" Add the default spelling file
|
||||
if &spelllang =~ '^en'
|
||||
setlocal spellfile+=~/.config/nvim/spell/en.utf-8.add
|
||||
set spellfile+=~/.config/nvim/spell/en.utf-8.add
|
||||
endif
|
||||
if &spelllang =~ '^da'
|
||||
setlocal spellfile+=~/.config/nvim/spell/dk.utf-8.add
|
||||
set spellfile+=~/.config/nvim/spell/dk.utf-8.add
|
||||
endif
|
||||
" zg or 1zg adds a word to the dictionary
|
||||
|
||||
" Add a file specific wordlist for one-off words that shouldn't be part of
|
||||
" the dictionary
|
||||
if &filetype =~ 'tex\|markdown'
|
||||
set spellfile+=oneoff.utf-8.add
|
||||
endif
|
||||
" 2zg adds a word to the dictionary
|
||||
|
||||
" Add a LaTeX specific wordlist for e.g. chktex
|
||||
if &filetype =~ 'tex'
|
||||
set spellfile+=~/.config/nvim/spell/LaTeX.utf-8.add
|
||||
endif
|
||||
" 3zg adds a word to the dictionary
|
||||
|
||||
" Add a Markdown specific wordlist
|
||||
if &filetype =~ 'markdown'
|
||||
set spellfile+=~/.config/nvim/spell/Markdown.utf-8.add
|
||||
endif
|
||||
" 3zg adds a word to the dictionary
|
||||
endfunction
|
||||
augroup spelling
|
||||
au!
|
||||
@ -1061,23 +1084,8 @@ augroup END
|
||||
" Add a file for custom suggestions
|
||||
au FileType tex,markdown setlocal spellsuggest+=file:~/.config/nvim/spell/suggestions
|
||||
|
||||
" Add the default spelling file
|
||||
au FileType tex,markdown execute SetLanguageSpecificSpellFile()
|
||||
" au FileType tex,markdown setlocal spellfile+=~/.config/nvim/spell/en.utf-8.add
|
||||
" zg or 1zg adds a word to the dictionary
|
||||
|
||||
" Add a file specific wordlist for one-off words that shouldn't be part of
|
||||
" the dictionary
|
||||
au FileType tex,markdown setlocal spellfile+=oneoff.utf-8.add
|
||||
" 2zg adds a word to the dictionary
|
||||
|
||||
" Add a LaTeX specific wordlist for e.g. chktex
|
||||
au FileType tex setlocal spellfile+=~/.config/nvim/spell/LaTeX.utf-8.add
|
||||
" 3zg adds a word to the dictionary
|
||||
|
||||
" Add a Markdown specific wordlist
|
||||
au FileType markdown setlocal spellfile+=~/.config/nvim/spell/Markdown.utf-8.add
|
||||
" 3zg adds a word to the dictionary
|
||||
" Add the default spelling files
|
||||
au BufWinEnter * execute SetLanguageSpecificSpellFile()
|
||||
|
||||
" Disable spelling in math environments
|
||||
au FileType markdown syntax match texMath /\$[^$]\+\$/ contains=@NoSpell containedin=markdownBlock,markdownBlockquote
|
||||
|
Loading…
Reference in New Issue
Block a user