mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-08 18:03:49 -05:00
Ignore unmatched line on right-justification mode
Unmatched line is NOT ignored on right-justification mode. However this commit makes such a line ignored when the end of the line is highlighted as one of the ignored syntax groups (e.g. Comments or Strings)
This commit is contained in:
@@ -251,8 +251,14 @@ function! s:do_align(just, all_tokens, all_delims, fl, ll, fc, lc, pattern, nth,
|
||||
let delim = delims[nth]
|
||||
let token = s:rtrim( tokens[nth] )
|
||||
let token = s:rtrim( strpart(token, 0, len(token) - len(s:rtrim(delim))) )
|
||||
if empty(delim) && !exists('tokens[nth + 1]') && a:just == 0 && a:ignore_unmatched
|
||||
continue
|
||||
if empty(delim) && !exists('tokens[nth + 1]') && a:ignore_unmatched
|
||||
if a:just == 0
|
||||
continue
|
||||
" Do not ignore on right-justification mode, except when the end of the
|
||||
" line is highlighted as ignored syntax (e.g. comments or strings).
|
||||
elseif s:highlighted_as(line, a:fc + len(token) - 1, a:ignores)
|
||||
continue
|
||||
endif
|
||||
endif
|
||||
|
||||
let indent = len(matchstr(tokens[0], '^\s\+'))
|
||||
|
||||
@@ -355,15 +355,15 @@ my_object .
|
||||
|batch_size |Fixnum |nil |number of maximum items to be assigned at once |
|
||||
|logger |Logger |nil |logger instance for debug logs |
|
||||
|
||||
| Option <| Type <| Default<| Description <|
|
||||
| -- <| -- <| -- <| -- <|
|
||||
| threads <| Fixnum <| 1 <| number of threads in the thread pool <|
|
||||
| queues <| Fixnum <| 1 <| number of concurrent queues <|
|
||||
| queue_size<| Fixnum <| 1000 <| size of each queue <|
|
||||
| interval <| Numeric<| 0 <| dispatcher interval for batch processing <|
|
||||
| batch <| Boolean<| false <| enables batch processing mode <|
|
||||
| batch_size<| Fixnum <| nil <| number of maximum items to be assigned at once<|
|
||||
| logger <| Logger <| nil <| logger instance for debug logs <|
|
||||
| Option ~| Type ~| Default~| Description ~|
|
||||
| -- ~| -- ~| -- ~| -- ~|
|
||||
| threads ~| Fixnum ~| 1 ~| number of threads in the thread pool ~|
|
||||
| queues ~| Fixnum ~| 1 ~| number of concurrent queues ~|
|
||||
| queue_size~| Fixnum ~| 1000 ~| size of each queue ~|
|
||||
| interval ~| Numeric~| 0 ~| dispatcher interval for batch processing ~|
|
||||
| batch ~| Boolean~| false ~| enables batch processing mode ~|
|
||||
| batch_size~| Fixnum ~| nil ~| number of maximum items to be assigned at once~|
|
||||
| logger ~| Logger ~| nil ~| logger instance for debug logs ~|
|
||||
|
||||
```c
|
||||
|
||||
@@ -374,10 +374,10 @@ static std::map<std::string, float>* scores = pointer;
|
||||
|
||||
```
|
||||
|
||||
Paul<<< McCartney{{{ 1942
|
||||
George<<< Harrison {{{ 1943
|
||||
Ringo<<< Starr {{{ 1940
|
||||
Pete<<< Best {{{ 1941
|
||||
Paul@@@ McCartney{{{ 1942
|
||||
George@@@ Harrison {{{ 1943
|
||||
Ringo@@@ Starr {{{ 1940
|
||||
Pete@@@ Best {{{ 1941
|
||||
|
||||
Paul McCartney 1942
|
||||
George Harrison 1943
|
||||
@@ -624,3 +624,30 @@ eggplant = 5
|
||||
daisy = 4
|
||||
eggplant = 5
|
||||
|
||||
|
||||
```c
|
||||
|
||||
int a = 1;
|
||||
long b = 2;
|
||||
float c = 3;
|
||||
string d = 4;
|
||||
// this line should not get aligned
|
||||
long int e = 5;
|
||||
std::map f;
|
||||
std::map g; /* this? */
|
||||
short h /* how about this? */ = 6;
|
||||
string i = "asdf";
|
||||
|
||||
int a = 1;
|
||||
long b = 2;
|
||||
float c = 3;
|
||||
string d = 4;
|
||||
// this line should not get aligned
|
||||
long int e = 5;
|
||||
std::map f;
|
||||
std::map g; /* this? */
|
||||
short h /* how about this? */ = 6;
|
||||
string i = "asdf";
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -136,3 +136,19 @@ Pete Best 1941
|
||||
daisy = 4
|
||||
eggplant = 5
|
||||
|
||||
|
||||
```c
|
||||
|
||||
int a = 1;
|
||||
long b = 2;
|
||||
float c = 3;
|
||||
string d = 4;
|
||||
// this line should not get aligned
|
||||
long int e = 5;
|
||||
std::map f;
|
||||
std::map g; /* this? */
|
||||
short h /* how about this? */ = 6;
|
||||
string i = "asdf";
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
4Gvipjyvip
|
||||
4Gvipjyvip
|
||||
|
||||
Reference in New Issue
Block a user