我想做点什么 这个 Textmate提示,因此当我在Python中编写代码时,始终以某种方式突出显示尾随空格 - 这使得更容易立即纠正它,而其他编辑器(如Emacs)可以执行此操作。
不幸的是,那篇文章之后的讨论似乎表明它很难做到。对我来说 invalid.trailing-whitespace 遵循此提示后,范围选择器甚至在首选项中不可见。有没有人有这个成功?
我想做点什么 这个 Textmate提示,因此当我在Python中编写代码时,始终以某种方式突出显示尾随空格 - 这使得更容易立即纠正它,而其他编辑器(如Emacs)可以执行此操作。
不幸的是,那篇文章之后的讨论似乎表明它很难做到。对我来说 invalid.trailing-whitespace 遵循此提示后,范围选择器甚至在首选项中不可见。有没有人有这个成功?
此代码有效(但没有注释):
{ scopeName = 'source.whitespace';
patterns = (
{ name = 'source.invalid.trailing-whitespace';
match = '(\s+)$';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
},
);
}
PS:我已将“source”更改为“source.whitespace”
对于Python语法中的注释更改:
{ name = 'comment.line.number-sign.python';
match = '(#).*$\n?';
captures = { 1 = { name = 'punctuation.definition.comment.python'; }; };
},
在:
{ name = 'comment.line.number-sign.python';
match = '(#).*?(\s*)$\n?';
captures = {
1 = { name = 'punctuation.definition.comment.python'; };
2 = { name = 'invalid.trailing-whitespace'; };
};
},
您需要在Python语言定义中添加“include”,其中:
:
patterns = (
{ name = 'comment.line.number-sign.python';
:
转向:
:
patterns = (
{ include = 'source.whitespace'; },
{ name = 'comment.line.number-sign.python';
:
此代码有效(但没有注释):
{ scopeName = 'source.whitespace';
patterns = (
{ name = 'source.invalid.trailing-whitespace';
match = '(\s+)$';
captures = { 1 = { name = 'invalid.trailing-whitespace'; }; };
},
);
}
PS:我已将“source”更改为“source.whitespace”
对于Python语法中的注释更改:
{ name = 'comment.line.number-sign.python';
match = '(#).*$\n?';
captures = { 1 = { name = 'punctuation.definition.comment.python'; }; };
},
在:
{ name = 'comment.line.number-sign.python';
match = '(#).*?(\s*)$\n?';
captures = {
1 = { name = 'punctuation.definition.comment.python'; };
2 = { name = 'invalid.trailing-whitespace'; };
};
},
您需要在Python语言定义中添加“include”,其中:
:
patterns = (
{ name = 'comment.line.number-sign.python';
:
转向:
:
patterns = (
{ include = 'source.whitespace'; },
{ name = 'comment.line.number-sign.python';
:
我不知道如何突出显示尾随空格,但你可以通过去除它来删除它
Bundles - > Text - > Converting / Stripping - >删除文档中的尾随空格
另外,因为textmate有emacs绑定,你可以像在emacs中那样做。