将无扩展名文件关联到 Bash [英] Associate extensionless files to Bash

查看:36
本文介绍了将无扩展名文件关联到 Bash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Bash 脚本没有任何扩展名和 shebang 行.当我打开此项目的每个文件时,如何避免必须选择语法高亮显示?

My Bash scripts do not have any extensions nor shebang line. How can I avoid having to select the syntax highlighter when I open every file for this project?

推荐答案

files.associations 设置允许匹配任意 glob 模式,而不仅仅是文件扩展名.例如,对于名为 start 的 Bash 脚本,您可以在工作区的 settings.json 中包含以下内容:

The files.associations setting allows matching against arbitrary glob patterns, not just file extensions. For instance, for a Bash script named start, you could have the following in your workspace's settings.json:

"files.associations": {
    "start": "shellscript"
}

您还可以在 {} 之间使用逗号分隔的文件名列表:

You can also have a comma-separated list of file names between {}:

"files.associations": {
    "{start,stop}": "shellscript"
}

这篇关于将无扩展名文件关联到 Bash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆