diff --git a/EXAMPLES.md b/EXAMPLES.md index d4c6dda..399965e 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -219,7 +219,7 @@ Aligning in-line comments ------------------------- *Note: Since the current version provides '#'-rule as one of the default rules, -you can ignore this section* +you can ignore this section.* ```ruby apple = 1 # comment not aligned diff --git a/README.md b/README.md index fc90674..33ed24a 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ shortcuts for the most common use cases with the concept of "_alignment rule_". An *alignment rule* is a predefined set of options for common alignment tasks, which is identified by a single character, *DELIMITER KEY*, such as ``, -`=`, `:`, `.`, `|`, `&`, and `,`. +`=`, `:`, `.`, `|`, `&`, `#`, and `,`. Think of it as a shortcut. Instead of writing regular expression and setting several options, you can just type in a single character. @@ -149,7 +149,7 @@ With these mappings, you can align text with only a few keystrokes. - `-` Around the last occurrences of delimiters (`-1`) - `-2` Around the second to last occurrences of delimiters - ... -1. Delimiter key (a single keystroke; ``, `=`, `:`, `.`, `|`, `&`, `,`) +1. Delimiter key (a single keystroke; ``, `=`, `:`, `.`, `|`, `&`, `#`, `,`) #### Predefined alignment rules @@ -452,7 +452,9 @@ For example if you set `ignore_groups` option to be an empty list, you get } ``` -Satisfied? :satisfied: +If a pattern in `ignore_groups` is prepended by a `!`, it will have the opposite +meaning. For instance, if `ignore_groups` is given as `['!Comment']`, delimiters +that are *not* highlighted as Comment will be ignored during the alignment. ### Ignoring unmatched lines @@ -674,7 +676,7 @@ let g:easy_align_delimiters = { \ '/': { \ 'pattern': '//\+\|/\*\|\*/', \ 'delimiter_align': 'l', -\ 'ignore_groups': ['^\(.\(Comment\)\@!\)*$'] }, +\ 'ignore_groups': ['!Comment'] }, \ ']': { \ 'pattern': '[[\]]', \ 'left_margin': 0, diff --git a/autoload/easy_align.vim b/autoload/easy_align.vim index c5a061f..4de8956 100644 --- a/autoload/easy_align.vim +++ b/autoload/easy_align.vim @@ -37,8 +37,7 @@ let s:easy_align_delimiters_default = { \ ',': { 'pattern': ',', 'left_margin': 0, 'right_margin': 1, 'stick_to_left': 1 }, \ '|': { 'pattern': '|', 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 }, \ '.': { 'pattern': '\.', 'left_margin': 0, 'right_margin': 0, 'stick_to_left': 0 }, -\ '#': { 'pattern': '#\+', -\ 'delimiter_align': 'l', 'ignore_groups': ['^\(.\(Comment\)\@!\)*$'] }, +\ '#': { 'pattern': '#\+', 'delimiter_align': 'l', 'ignore_groups': ['!Comment'] }, \ '&': { 'pattern': '\\\@