默认情况下,vim拼写检查程序可识别代码,因此它不会拼写检查文件的代码部分。实际上,在降价时,它将(pandoc多行)表视为代码,因此不会拼写检查其内容。
可以覆盖这个吗?或者为包括代码在内的整个文件启用拼写检查。
答案 0 :(得分:4)
答案 1 :(得分:3)
据我所知,没有办法告诉Vim忽略了 语法文件中的拼写检查建议,并且只需检查所有内容"。
一个相当苛刻的解决方法是使用:syn off
完全禁用语法;
您可以使用:syn on
重新启用此功能。
特别是对于Markdown,您可以禁用突出显示代码块
:syn clear markdownCodeBlock
;您也可以使用:syn on
重置此内容。
答案 2 :(得分:1)
在这种情况下,我会联系markdown语法文件的维护者,并询问他/她是否可以解决这个问题。
答案 3 :(得分:0)
我创建了bash脚本修复语法文件。它不完美但是它很好。它可以通过再次运行来反转。它会在给定目录中的所有文件中为contains=@Spell
和syn match
定义添加syn region
。
使用它:
该脚本在修改之前备份所有文件,因此您可以认为运行它是安全的。无论如何,我对脚本引起的潜在问题不承担任何责任。
编辑: 您可以将反馈留在以下存储库中的脚本中: 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/