Ide 如何向Geany添加Go支持
我正在尝试让语法高亮显示和构建选项对Geany有效,有什么建议吗?查看$GOROOT/misc和其他编辑器的语法文件,以获得想法Ide 如何向Geany添加Go支持,ide,syntax-highlighting,go,geany,Ide,Syntax Highlighting,Go,Geany,我正在尝试让语法高亮显示和构建选项对Geany有效,有什么建议吗?查看$GOROOT/misc和其他编辑器的语法文件,以获得想法 禁止从C或C++开始,添加/减去诸如“代码> GO ”、“代码> > P>。您在//CONFIG/GENON/FILTEYPEXUpExist.CONF?/P>中定义了GO文件类型吗? [Extensions] ... Go=*.go ... 如果conf文件尚不存在,请从/usr/share/geany复制它,并在“扩展名”下添加该行(或在“工具”>“配置文件”下
禁止从C或C++开始,添加/减去诸如“代码> GO ”、“代码> > P>。您在//CONFIG/GENON/FILTEYPEXUpExist.CONF?/P>中定义了GO文件类型吗?
[Extensions]
...
Go=*.go
...
如果conf文件尚不存在,请从/usr/share/geany复制它,并在“扩展名”下添加该行(或在“工具”>“配置文件”下查找)。我刚刚注意到这一页: 看起来他们已经把你需要的东西都准备好了。这是答案
Go=*.go;
cp /usr/share/geany/filetypes.c ~/.config/geany/filedefs/filetypes.Go.conf
[settings]
# default extension used when saving files
extension=go
lexer_filetype=C
[keywords]
# all items must be in one line
primary=break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var
secondary=byte int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float32 float64 complex64 complex128 uintptr string
我制作了一个Python脚本,它自动执行Jaybill-McCarthy提供的链接中的方向
import shutil, re, os
HOME = os.environ['HOME']
shutil.copy('/usr/share/geany/filetype_extensions.conf', HOME +'/.config/geany/')
with open(HOME + '/.config/geany/filetype_extensions.conf', 'r') as f:
fileData = f.read()
fileData = re.sub(r'Haskell=.*;', r'Go=*.go;\nHaskell=*.hs;*.lhs;', fileData)
fileData = re.compile('(\[Groups\][^\[]Programming=.*?$)', re.DOTALL|re.MULTILINE).sub(r'\1Go;', fileData)
with open(HOME + '/.config/geany/filetype_extensions.conf', 'w') as f:
f.write(fileData)
textSettings = """[settings]
extension=go
lexer_filetype=C
comment_single=//
comment_open=/*
comment_close=*/
comment_use_indent=true
"""
textKeywords = """[keywords]
primary=break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var
secondary=byte int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float32 float64 complex64 complex128 uintptr string"""
shutil.copy('/usr/share/geany/filetypes.c', HOME + '/.config/geany/filedefs/filetypes.Go.conf')
with open(HOME + '/.config/geany/filedefs/filetypes.Go.conf', 'r') as f:
fileData = f.read()
fileData = re.compile(r'\[settings\].*?^\[', re.DOTALL|re.MULTILINE).sub('%s\n\n[' %textSettings, fileData)
fileData = re.compile(r'\[keywords\].*?^\[', re.DOTALL|re.MULTILINE).sub('%s\n\n[' %textKeywords, fileData)
with open(HOME + '/.config/geany/filedefs/filetypes.Go.conf', 'w') as f:
f.write(fileData)
print "Complete!"
我不确定这是否意味着我懒惰,或者反过来。。。o、 o.我从C开始,但什么都不起作用:(我已经基于提供的C语言创建了一个~/.config/geany/filetypes.go,但根本没有高亮显示。对于我的Windows程序员同事来说,有一个愚蠢的窍门可以让它正常工作:
filetypes.go.conf
必须实际命名为filetypes.go.conf
欢迎使用堆栈溢出!虽然这在理论上可以回答这个问题,在这里包括答案的基本部分,并提供链接供参考。谢谢!你有这个作为要点吗?