Reputation: 1854
By default, vim spell checker is code aware, so it doesn't spell-check code parts of the file. In effect, in markdown it considers (pandoc multiline) tables to be codes and thus doesn't spell-check their contents.
Is it possible to override this? Or enable spell-check for the entire file including code.
Upvotes: 9
Views: 3283
Reputation: 32926
In that case I would contact the maintainer of the markdown syntax file and ask him/she if (s)he could fix this issue.
Upvotes: 1
Reputation: 335
I created bash script fixing syntax files. IT IS NOT PERFECT BUT IT IS GOOD. It can be reversed by running it again. It adds contains=@Spell
to syn match
and syn region
definitions in all files in given directory.
To use it:
The script makes backup of all files before modification so you can assume it is safe to run it. I anyway do not take any responsibility for potential problems caused by the script.
Edit: You can leave feedback to the script in the following repository: https://github.com/dominikduda/config_files/blob/master/bin/fix_vim_syntax_files.sh
#!/bin/bash
function fix_file {
sed -i -e '/exe/! {s/contains=/contains=@Spell,/g}' $1
sed -i -e 's/contains=@Spell,ALL/contains=ALL/g' $1
sed -i -e 's/contains=@Spell,ALLBUT/contains=ALLBUT/g' $1
sed -i -e 's/contains=@Spell,TOP/contains=TOP/g' $1
sed -i -e 's/contains=@Spell,CONTAINED/contains=CONTAINED/g' $1
sed -i -e 's/contains=@Spell,NONE/contains=@Spell/g' $1
sed -i -e '/^ *syn match/ {/contains=/! s/$/ contains=@Spell/g}' $1
sed -i -e '/^ *syn region/ {/contains=/! s/$/ contains=@Spell/g}' $1
return 0
}
function revert_file {
mv "$1/$2.spellfix-backup" "$1/$2"
return 0
}
function fix_recursively_in_catalog {
syntax_catalogs_paths="$(find $1 -type d ! -name '*.*' -not -path '*git*' -print)"
syntax_catalogs_count="$(echo "${syntax_catalogs_paths}" | wc -l)"
echo "${syntax_catalogs_count} syntax catalogs found and will be scanned for files"
echo "${syntax_catalogs_paths}" | while read -r catalog_path ; do
echo " Scanning $catalog_path"
ls -p "${catalog_path}" | grep -v / | grep -v .spellfix-backup | grep .vim | while read -r file_name ; do
cp "${catalog_path}/${file_name}" "${catalog_path}/${file_name}.spellfix-backup"
fix_file "${catalog_path}/${file_name}"
echo " Fixing ${file_name} (backup created as ${file_name}.spellfix-backup)"
done
done
echo 'Fix done.'
echo 'Remember to REVERT FIX before updating vim plugins'
return 0
}
function revert_recursively_in_catalog {
syntax_catalogs_paths="$(find $1 -type d ! -name '*.*' -not -path '*git*' -print)"
syntax_catalogs_count="$(echo "${syntax_catalogs_paths}" | wc -l)"
echo "${syntax_catalogs_count} syntax catalogs found and will be scanned for spellfix-backup files"
echo "${syntax_catalogs_paths}" | while read -r catalog_path ; do
echo " Scanning $catalog_path"
ls -p "${catalog_path}" | grep -v / | grep -v .spellfix-backup | grep .vim | while read -r file_name ; do
revert_file "${catalog_path}" "${file_name}"
echo " Reverting ${file_name} (from file ${file_name}.spellfix-backup)"
done
done
echo 'Revert done.'
echo 'Remember to FIX AGAIN after plugins update (or set it as a post update hook)'
return 0
}
function main {
syntax_catalogs_paths="$(find $1 -type d ! -name '*.*' -not -path '*git*' -print)"
while read -r catalog_path ; do
if ls -p "${catalog_path}" | grep -v / | grep .spellfix-backup; then
echo ".spellfix-backup files found, reverting fix!"
echo "--------------------------------------------"
revert_recursively_in_catalog $1
return 0
fi
done < <(echo "${syntax_catalogs_paths}")
echo ".spellfix-backup files NOT found, fixing!"
echo "-----------------------------------------"
fix_recursively_in_catalog $1
}
main ~/PATH/TO/VIM/PLUGINS/
Upvotes: 0
Reputation: 27822
As far as I'm able to determine, there is no way to tell Vim to ignore the spellcheck suggestions in the syntax file and to just "check everything".
A fairly heavy-handed workaround is to disable syntax entirely with :syn off
;
you can re-enable this with :syn on
.
Specifically for Markdown, you can disable highlighting of code blocks with
:syn clear markdownCodeBlock
; you can reset this with :syn on
as well.
Upvotes: 8
Reputation: 1549
Use syntax spell
:syntax spell toplevel
See: http://usevim.com/2013/05/10/synspell/
Upvotes: 3