mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-10 02:43:49 -05:00
Allow whitespaces between delimiter key and options
This commit is contained in:
@@ -23,6 +23,8 @@ function! GFM()
|
|||||||
\ lang, lang, lang)
|
\ lang, lang, lang)
|
||||||
endfor
|
endfor
|
||||||
let b:current_syntax='mkd'
|
let b:current_syntax='mkd'
|
||||||
|
|
||||||
|
syntax sync fromstart
|
||||||
endfunction
|
endfunction
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ function! s:parse_args(args)
|
|||||||
" Poor man's option parser
|
" Poor man's option parser
|
||||||
let idx = 0
|
let idx = 0
|
||||||
while 1
|
while 1
|
||||||
let midx = match(args, '{.*}\s*$', idx)
|
let midx = match(args, '\s*{.*}\s*$', idx)
|
||||||
if midx == -1 | break | endif
|
if midx == -1 | break | endif
|
||||||
|
|
||||||
let cand = strpart(args, midx)
|
let cand = strpart(args, midx)
|
||||||
@@ -399,6 +399,9 @@ function! s:parse_args(args)
|
|||||||
let o = eval(cand)
|
let o = eval(cand)
|
||||||
if type(o) == 4
|
if type(o) == 4
|
||||||
let option = o
|
let option = o
|
||||||
|
if args[midx - 1 : midx] == '\ '
|
||||||
|
let midx += 1
|
||||||
|
endif
|
||||||
let args = strpart(args, 0, midx)
|
let args = strpart(args, 0, midx)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
@@ -471,11 +474,16 @@ function! easy_align#align(just, expr) range
|
|||||||
if regexp
|
if regexp
|
||||||
let dict = { 'pattern': ch }
|
let dict = { 'pattern': ch }
|
||||||
else
|
else
|
||||||
|
" Resolving command-line ambiguity
|
||||||
|
if !empty(a:expr)
|
||||||
|
" '\ ' => ' '
|
||||||
if ch =~ '^\\\s\+$'
|
if ch =~ '^\\\s\+$'
|
||||||
let ch = ' '
|
let ch = ' '
|
||||||
elseif ch =~ '^\\\\\s\+$'
|
" '\\' => '\'
|
||||||
|
elseif ch =~ '^\\\\\s*$'
|
||||||
let ch = '\'
|
let ch = '\'
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
if !has_key(delimiters, ch)
|
if !has_key(delimiters, ch)
|
||||||
echon "\rUnknown delimiter key: ". ch
|
echon "\rUnknown delimiter key: ". ch
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -374,6 +374,11 @@ static std::map<std::string, float>* scores = pointer;
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Paul<<< McCartney{{{ 1942
|
||||||
|
George<<< Harrison {{{ 1943
|
||||||
|
Ringo<<< Starr {{{ 1940
|
||||||
|
Pete<<< Best {{{ 1941
|
||||||
|
|
||||||
Paul McCartney 1942
|
Paul McCartney 1942
|
||||||
George Harrison 1943
|
George Harrison 1943
|
||||||
Ringo Starr 1940
|
Ringo Starr 1940
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
4Gvipjyvip
|
4Gvipjyvip
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ function! GFM()
|
|||||||
\ lang, lang, lang)
|
\ lang, lang, lang)
|
||||||
endfor
|
endfor
|
||||||
let b:current_syntax='mkd'
|
let b:current_syntax='mkd'
|
||||||
|
|
||||||
|
syntax sync fromstart
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
silent! unlet g:easy_align_delimiters
|
silent! unlet g:easy_align_delimiters
|
||||||
@@ -39,5 +41,4 @@ set buftype=nofile
|
|||||||
silent! ScrollPositionHide
|
silent! ScrollPositionHide
|
||||||
|
|
||||||
call GFM()
|
call GFM()
|
||||||
syntax sync fromstart
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user