Вопрос

In earlier versions of Textmate, when I double-clicked on a Rails instance variable (e.g. @contract), the selection omitted the @ sign -- which was great. The pasteboard only contained "contract".

In Textmate version 2.0-alpha.9459, double clicking on an instance variable selects the @sign as well as the characters. The pasteboard now contains "@contract".

Is there a way to configure Textmate 2.0 so that the @ of an instance variable is omitted on select?

Это было полезно?

Решение 2

You can edit the Ruby bundle's language grammar to define "words". There's a section called "variable.other.readwrite.instance.ruby", which looks like this:

name = 'variable.other.readwrite.instance.ruby';
match = '(@)[a-zA-Z_]\w*';
captures = { 1 = { name = 'punctuation.definition.variable.ruby'; }; };

Remove the @-sign from the regex and it will behave like you described:

name = 'variable.other.readwrite.instance.ruby';
match = '[a-zA-Z_]\w*';
captures = { 1 = { name = 'punctuation.definition.variable.ruby'; }; };

Note that now syntax highlighting won't catch the @ as well.

Другие советы

According to https://github.com/textmate/textmate/wiki/FAQ:

If you do not wish for punctuation to be considered part of (completion) units, then:

  1. Select the menu item: Bundles → Edit Bundles…
  2. In the column browser select: Source → Settings → Character Class: Punctuation
  3. In the drawer, change scope selector from punctuation.separator to punctuation
  4. Press ⌘S (Save), and close bundle editor
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top