bash - bash 脚本中的 while 循环在 vim 中没有正确突出显示

标签 bash shell vim syntax-highlighting

我试图在 bash 的一个 while 循环中编写一个 while 循环,第二个 while 的语法没有突出显示。使用这个有什么特殊的语法吗?

while [ "ka" = $name ] 
do 
  while [ "ka" = $name ] //this while is not highlighted
  do
  done
done

最佳答案

正如其他答案已经指出的那样,这是影响非 Bash shell 语法的语法插件中的错误。

请向脚本作者 Charles Campbell 提交错误报告(基本上是指向此页面的链接);他的电子邮件地址在脚本的标题中;该脚本位于 Vim 安装目录中的 syntax/sh.vim

如果您没有收到回复,请通知 vim_dev 邮件列表(cp. http://www.vim.org/community.php ;您需要先注册);希望其他人会把它捡起来。

解决方法

作为解决方法,您可以默认强制使用 Bash 语法(在您的 ~/.vimrc 中):

:let g:is_bash      = 1

关于bash - bash 脚本中的 while 循环在 vim 中没有正确突出显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16914987/

相关文章:

linux - 为什么 Linux rm -rf 抛出无效参数错误?

bash - 关于 $SHLVL 的 Zsh 怪异

batch-file - Windows 在 PATH 中搜索可执行文件的相对顺序是什么?

vim - Vim 中的命名搜索?

vim - 获取 .vimrc 和 .gvimrc 的函数

具有空变量的 Bash 算术扩展行为

linux - 在 bash 脚本中从 grep 重新格式化名称/内容对

linux - 使用 sed 在 linux 中查找以开头并替换的行

python - impala shell,带大写字母的 shell 命令

arrays - 令人惊讶的数组扩展行为