mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-09 18:33:49 -05:00
Update shorthand notation for stick_to_left: > to unset
- `<` == `stl1` - `>` == `stl0`
This commit is contained in:
@@ -284,7 +284,7 @@ The following table summarizes the shorthand notation.
|
|||||||
| `filter` | `[gv]/.*/` |
|
| `filter` | `[gv]/.*/` |
|
||||||
| `left_margin` | `l[0-9]+` |
|
| `left_margin` | `l[0-9]+` |
|
||||||
| `right_margin` | `r[0-9]+` |
|
| `right_margin` | `r[0-9]+` |
|
||||||
| `stick_to_left` | `<` or `s[01]` |
|
| `stick_to_left` | `<` or `>` |
|
||||||
| `ignore_unmatched` | `iu[01]` |
|
| `ignore_unmatched` | `iu[01]` |
|
||||||
| `ignore_groups` | `ig\[.*\]` |
|
| `ignore_groups` | `ig\[.*\]` |
|
||||||
| `align` | `a[lrc*]*` |
|
| `align` | `a[lrc*]*` |
|
||||||
|
|||||||
@@ -814,7 +814,7 @@ endfunction
|
|||||||
|
|
||||||
let s:shorthand_regex =
|
let s:shorthand_regex =
|
||||||
\ '\s*\%('
|
\ '\s*\%('
|
||||||
\ .'\(lm\?[0-9]\+\)\|\(rm\?[0-9]\+\)\|\(iu[01]\)\|\(\%(s\%(tl\)\?[01]\)\|<\)\|'
|
\ .'\(lm\?[0-9]\+\)\|\(rm\?[0-9]\+\)\|\(iu[01]\)\|\(\%(s\%(tl\)\?[01]\)\|[<>]\)\|'
|
||||||
\ .'\(da\?[clr]\)\|\(\%(ms\?\|a\)[lrc*]\+\)\|\(i\%(dt\)\?[kdsn]\)\|\([gv]/.*/\)\|\(ig\[.*\]\)'
|
\ .'\(da\?[clr]\)\|\(\%(ms\?\|a\)[lrc*]\+\)\|\(i\%(dt\)\?[kdsn]\)\|\([gv]/.*/\)\|\(ig\[.*\]\)'
|
||||||
\ .'\)\+\s*$'
|
\ .'\)\+\s*$'
|
||||||
|
|
||||||
@@ -831,7 +831,7 @@ function! s:parse_shorthand_opts(expr)
|
|||||||
let match = matchlist(expr, regex)
|
let match = matchlist(expr, regex)
|
||||||
if empty(match) | break | endif
|
if empty(match) | break | endif
|
||||||
for m in filter(match[ 1 : -1 ], '!empty(v:val)')
|
for m in filter(match[ 1 : -1 ], '!empty(v:val)')
|
||||||
for key in ['lm', 'rm', 'l', 'r', 'stl', 's', '<', 'iu', 'da', 'd', 'ms', 'm', 'ig', 'i', 'g', 'v', 'a']
|
for key in ['lm', 'rm', 'l', 'r', 'stl', 's', '<', '>', 'iu', 'da', 'd', 'ms', 'm', 'ig', 'i', 'g', 'v', 'a']
|
||||||
if stridx(tolower(m), key) == 0
|
if stridx(tolower(m), key) == 0
|
||||||
let rest = strpart(m, len(key))
|
let rest = strpart(m, len(key))
|
||||||
if key == 'i' | let key = 'idt' | endif
|
if key == 'i' | let key = 'idt' | endif
|
||||||
@@ -853,8 +853,8 @@ function! s:parse_shorthand_opts(expr)
|
|||||||
catch
|
catch
|
||||||
call s:exit("Invalid ignore_groups: ". a:expr)
|
call s:exit("Invalid ignore_groups: ". a:expr)
|
||||||
endtry
|
endtry
|
||||||
elseif key == '<'
|
elseif key =~ '[<>]'
|
||||||
let opts['stl'] = 1
|
let opts['stl'] = key == '<'
|
||||||
else
|
else
|
||||||
let opts[key] = str2nr(rest)
|
let opts[key] = str2nr(rest)
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ The following table summarizes the shorthand notation.
|
|||||||
`filter` | `[gv]/.*/`
|
`filter` | `[gv]/.*/`
|
||||||
`left_margin` | `l[0-9]+`
|
`left_margin` | `l[0-9]+`
|
||||||
`right_margin` | `r[0-9]+`
|
`right_margin` | `r[0-9]+`
|
||||||
`stick_to_left` | `<` or `s[01]`
|
`stick_to_left` | `<` or `>`
|
||||||
`ignore_unmatched` | `iu[01]`
|
`ignore_unmatched` | `iu[01]`
|
||||||
`ignore_groups` | `ig\[.*\]`
|
`ignore_groups` | `ig\[.*\]`
|
||||||
`align` | `a[lrc*]*`
|
`align` | `a[lrc*]*`
|
||||||
|
|||||||
@@ -84,6 +84,13 @@ Expect:
|
|||||||
apple;:;; banana:: cake
|
apple;:;; banana:: cake
|
||||||
data;; exchange:;:: format
|
data;; exchange:;:: format
|
||||||
|
|
||||||
|
Execute (>):
|
||||||
|
%EasyAlign*/[:;]\+/l0dl<>rm3
|
||||||
|
|
||||||
|
Expect:
|
||||||
|
apple;:;; banana :: cake
|
||||||
|
data ;; exchange:;:: format
|
||||||
|
|
||||||
Execute (different regular expression):
|
Execute (different regular expression):
|
||||||
%EasyAlign*/../{'lm':'<','rm':'>'}
|
%EasyAlign*/../{'lm':'<','rm':'>'}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user