汇编vim语法高亮
默认的程序集语法文件效果不佳,在网上搜索有关 Gas 程序集的信息时,我没有找到任何有关 vim 的 Gas (AT&T) 语法文件的信息。 有人发现这个吗? 我无法编写自己的语法文件。
http://img168.imageshack.us/img168/46/nasm.png ft=nasm
http://img160.imageshack.us/img160/5857/asm.png ft=asm(默认)
< a href="http://img164.imageshack.us/img164/8476/tasm.png">http://img164.imageshack.us/img164/8476/tasm.png ft=tasm
The default assembly syntax file didn't work well and searching the web about gas assembly I found nothing about a gas (AT&T) syntax file for vim. Has anyone found this? I can't write my own syntax file.
http://img168.imageshack.us/img168/46/nasm.png ft=nasm
http://img160.imageshack.us/img160/5857/asm.png ft=asm(default)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Vim/Nvim
如果无法检测特定文件类型,可以使用文件本身中的实际宏来告知它是什么,而不必分别运行:set ft=nasm
命令打开文件的时间。为此,请弄清楚文件类型的注释语法是什么,然后在文件末尾添加如下行:(例如对于
NASM
)此图还显示了语法突出显示的实际效果就像添加了该行后文件的外观一样。
Vim/Nvim
if unable to detect specific filetype can be told what it is with an actual macro in the file itself instead of having to run the:set ft=nasm
command each time you open the file.To do this, figure out what the comment syntax of the file type is and add a line like this to the end of your file: (e.g. for
NASM
)This image shows the syntax highlighting in action as well as how the file looks with the line added.
这可能帮助您入门。 这更像是您正在寻找的吗?
刚刚进行了快速搜索 - 看起来内置了几种不同类型的汇编语法突出显示。您使用的是哪一种?
从 :help 语法 复制粘贴
此附加 语法脚本 来自 vim .org
看起来您的屏幕截图正在使用默认的 asm 文件类型。
尝试一下
,您应该会根据这些屏幕截图看到一些颜色变化。
< /a>
从上面的屏幕截图中,我对 fasm vim 语法进行了一些快速修改,并将其称为gasm。
可以在pastebin上此处找到它。
将其复制并粘贴到您的个人 .vim/syntax 或 vimfiles/syntax 目录中,并将其命名为gasm.vim
然后在你的汇编文件中:set ft=gasm
这个vim脚本依赖于以下形式的注释
% 评论
包括空间。
您可以在脚本的第 116 行看到这一点(或者根据需要更改它)。
请注意:不要复制行号。
This may get you started. Is that more like what you're looking for?
Just had a quick search - it looks like there are a few different sorts of assembly syntax highlighting built in. Which one are you using?
Copy-pasted from :help syntax
This additional syntax script is from vim.org
It looks like your screenshot is using the default asm filetype.
Try
and you should get some colour changes as per these screenshots.
From your screenshots above I've made a couple of quick modifications to the fasm vim syntax and called it gasm.
It can be found here on pastebin.
Copy and paste that into your personal .vim/syntax or vimfiles/syntax directory and call it gasm.vim
Then in your assembly file :set ft=gasm
This vim script relies on comments being of the form
% comment
with the space included.
You can see this (or change it if you wish) on line 116 of the script.
Please note: Don't copy the line numbers.
我开始从头开始编写完整的 GNU as 语法。
语法文件可从 vim.org 获取:GNU 作为 X86 的语法
以及直接在 GitHub 上:GNU 作为 X86 的语法
除了它会识别的基本指令之外以下扩展 Intel / AMD 指令:
如下所示:
I started to write a complete GNU as syntax from scratch.
The syntax file is available from vim.org: GNU as syntax for X86
As well as directly on GitHub: GNU as syntax for X86
In addition to the basic instructions it will recognize the following extended Intel / AMD instructions:
Here is how it looks like:
每当您打开
.asm
文件时,将此行放入您的.vimrc
中即可使用 intel 语法进行设置:Putting this line in your
.vimrc
will set you up with the intel syntax whenever you open an.asm
file :