记事本++不是语法突出显示我的文件
直到一周前,我还很高兴在 Notepad++ 中使用语法突出显示编写 html.erb 文件。然后我的硬盘坏了。
我在新系统上重新安装了 Notepad++,但是当我打开 html.erbs 时,只有其中一些正确突出显示。
我认为问题可能是大多数这些文件被视为“普通文本文件”,其中少数正在工作的文件被视为“html 文件”。我尝试“另存为”同名的 html 文件,但它不起作用。如何恢复语法突出显示?这严重减慢了我的速度。
Until a week ago I was happily coding html.erb files in Notepad++ with syntax highlighting. Then my hard drive crashed.
I reinstalled Notepad++ on my new system but when I open my html.erbs, only a few of them are highlighting properly.
I think the problem might be that most of these files are being considered 'normal text files', where the few that are working are considered 'html files'. I tried 'save as' html file of the same name, but it isn't working. How can I get my syntax highlighting back? This is seriously slowing me down.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
我正在复制 PHP 代码段,但它们不包含
I was copying PHP code segments and they did not include the <?php imbedded language control tag. Once I added <? at the top of the page the highlighting was activated.
我试图找到答案的稍微不同的是如何突出显示“23”,例如它可以在“Costs_2023”或“Products_2023”中
它只会突出显示完整的单词,我发现 -
下有一个设置
设置 - 首选项 - 突出显示 - 标记所有出现的样式 - 区分大小写
取消选中此选项显然可以解决问题,因此我可以突出显示单词的一部分,例如“23”,并且它会突出显示它出现在我的文件中的所有位置
这是在新笔记本电脑上安装 Notepad + + 之后的结果,因此将是默认设置
希望它可以帮助某人
Something slightly different I was trying to find an answer to was how to highlight "23" for example and it could be in "Costs_2023" OR "Products_2023"
It would only highlight full words and I found there is a setting under -
Settings - Preferences - Highlighting - Style All Occurrences of Token - Match Case
Unchecking this option resolved the problem obviously so I could highlight part of a word like "23" and it would highlight everywhere it appeared in my file
This was after installing Notepad + + on a new laptop so will be default settings
Hope it helps someone
我的问题很愚蠢,但也许人们也会有同样的问题:
某些主题对同一语言的所有元素应用相同的语法着色(例如:Ruby Blue 主题中的 python 除了白色之外没有其他任何颜色)。
将主题更改为区分我正在编码的语言元素的主题解决了这个问题。
My issue was very dumb but maybe people will have the same:
Some themes apply the same syntax coloring to all elements of the same language (example: python in Ruby Blue theme is just not colored in anything else than white).
Changing the theme to one that differentiates elements of the language I was coding in solved the issue.
我在重新安装 notepad++ 时遇到了这个问题,因为在新安装中,
.r
源代码文件被识别为 REBOL 而不是 R。我必须手动删除r
文件扩展名来自langs.xml
文件中的 REBOL 键。有关说明,请参阅 Notepad++ 社区论坛上的类似问题 此链接。I had this problem when reinstalling notepad++ because with the new install,
.r
source code files were being recognized as REBOL instead of R. I had to manually remove ther
file extension from the REBOL key in thelangs.xml
file. For instructions, see the similar question on the Notepad++ community forum at this link.转到
设置 ->样式配置器...
,然后禁用启用全局前景色
和启用全局背景色
。这解决了我的问题。Go to
Settings -> Style configurator...
then disableEnable global foreground color
andEnable global background color
. This fixed my problem.所以我知道这个问题在 7 年前就已经解决了,但这是谷歌上的最高结果,所以我想添加我的问题的解决方案。
却没有意识到这就是我正在做的事情,只需将其放回可用项目中即可。
So I Know this problem was solved 7 years ago but it's the top result on google so I wanted to add what the solution to my problem.
I had stupidly disabled python without realizing that that's what I was doing, just had to put it back into available items.
我遇到了完全相同的问题,并且发布的解决方案都不适合我,因此我更深入地研究,发现我在设置→样式配置器下错误地分配了用户定义的扩展两次,例如SQL< /em> 和 XML。
从一种语言中删除我的用户定义的扩展恢复了语法突出显示。
I had the exact same problem and none of the posted solutions worked for me so I digged deeper and found that I mistakenly assigned my user defined extensions twice under Settings → Style Configurator, for example SQL and XML.
Deleting my user defined extension from one language restored the syntax highlighting.
以防万一,如果有人遇到我的情况:我已在面板
设置 -> 中激活
,停用它会重新激活语法突出显示。启用全局前景色
样式配置器...Just in case, if anyone meets my situation: I had activated
Enable global foreground color
in panelSettings -> Style configurator...
, deactivating it reactivated syntax highlighting.可能导致此问题的另一种可能情况是您安装了新主题。如果主题没有定义某些语言并且您使用其中一种语言,那么您也将失去语法突出显示。
检查:
设置->样式配置器
检查左侧是否存在您正在运行的当前主题的语言。
Another possible situation that could cause this is if you install new themes. If the theme doesn't have certain languages defined and you use one of those, then you will lose the syntax highlighting as well.
To Check:
Settings -> Style Configurator
Check that the language is there on the left hand side for the current theme you are running.
您可以尝试转到语言> H> Html 应该突出显示内容。
You could try going to Language > H > Html and that should highlight stuff.