Vim 有一个很好的方法来指示特定文件应该使用什么语法高亮显示(通过在文件的开头或结尾指定关键字 vim:filetype
来忽略文件扩展名。 )
是否有一种等效的方法可以建议 vscode 对文件使用语法高亮显示而不注意其文件扩展名?
例子:在 vim 中
# vim:filetype=i3
set $mod Mod4
set $alt Mod1
...
I am not looking for
files.associations
or theChange Language Mode
settings. I want to state the language mapping within the file itself and I understand that probably this is not a builtin feature just hoping an extension can do thisWhy I am interested in this? because many of the so-called dotfiles in Linux don't have any special extension and when you open the file in another vscode instance (in another machine) you want the IDE to be intelligent enough to deduce the correct syntax highlighter.
最佳答案
我知道这个问题已经存在很长一段时间了,但我想我应该分享一下,现在可以通过第三方扩展来解决这个问题: https://marketplace.visualstudio.com/items?itemName=chrislajoie.vscode-modelines
我自己还没有测试过它,但它有很多安装而且绝对没有坏消息,所以它应该可以正常工作。
关于vim - "vim:filetype"在 vscode 中等效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59547975/