跑完后:bufdo e!
我的所有文件都丢失了文件类型设置,我必须手动运行:在每个文件中设置ft = XXX.
我的所有文件都丢失了文件类型设置,我必须手动运行:在每个文件中设置ft = XXX.
有谁知道如何解决这个问题?
运行:bufdo set ft = XXX不起作用,我不想以任何速率将所有文件设置为相同的文件类型.
干杯.
您可以通过以下autocmd自动修复此问题:
" Enable Syntax highlighting when buffers were loaded through :bufdo,which " disables the Syntax autocmd event to speed up processing. augroup EnableSyntaxHighlighting " Filetype processing does happen,so we can detect a buffer initially " loaded during :bufdo through a set filetype,but missing b:current_Syntax. " Also don't do this when the user explicitly turned off Syntax highlighting " via :Syntax off. " Note: Must allow nesting of autocmds so that the :Syntax enable triggers " the ColorScheme event. Otherwise,some highlighting groups may not be " restored properly. autocmd! BufWinEnter * nested if exists('Syntax_on') && ! exists('b:current_Syntax') && ! empty(&l:filetype) | Syntax enable | endif " The above does not handle reloading via :bufdo edit!,because the " b:current_Syntax variable is not cleared by that. During the :bufdo," 'eventignore' contains "Syntax",so this can be used to detect this " situation when the file is re-read into the buffer. Due to the " 'eventignore',an immediate :Syntax enable is ignored,but by clearing " b:current_Syntax,the above handler will do this when the reloaded buffer " is displayed in a window again. autocmd! BufRead * if exists('Syntax_on') && exists('b:current_Syntax') && ! empty(&l:filetype) && index(split(&eventignore,','),'Syntax') != -1 | unlet! b:current_Syntax | endif augroup END
原文地址:https://www.jb51.cc/vim/386976.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。