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)
|
||||
endfor
|
||||
let b:current_syntax='mkd'
|
||||
|
||||
syntax sync fromstart
|
||||
endfunction
|
||||
```
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ function! s:parse_args(args)
|
||||
" Poor man's option parser
|
||||
let idx = 0
|
||||
while 1
|
||||
let midx = match(args, '{.*}\s*$', idx)
|
||||
let midx = match(args, '\s*{.*}\s*$', idx)
|
||||
if midx == -1 | break | endif
|
||||
|
||||
let cand = strpart(args, midx)
|
||||
@@ -399,6 +399,9 @@ function! s:parse_args(args)
|
||||
let o = eval(cand)
|
||||
if type(o) == 4
|
||||
let option = o
|
||||
if args[midx - 1 : midx] == '\ '
|
||||
let midx += 1
|
||||
endif
|
||||
let args = strpart(args, 0, midx)
|
||||
break
|
||||
endif
|
||||
@@ -471,11 +474,16 @@ function! easy_align#align(just, expr) range
|
||||
if regexp
|
||||
let dict = { 'pattern': ch }
|
||||
else
|
||||
" Resolving command-line ambiguity
|
||||
if !empty(a:expr)
|
||||
" '\ ' => ' '
|
||||
if ch =~ '^\\\s\+$'
|
||||
let ch = ' '
|
||||
elseif ch =~ '^\\\\\s\+$'
|
||||
" '\\' => '\'
|
||||
elseif ch =~ '^\\\\\s*$'
|
||||
let ch = '\'
|
||||
endif
|
||||
endif
|
||||
if !has_key(delimiters, ch)
|
||||
echon "\rUnknown delimiter key: ". ch
|
||||
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
|
||||
George Harrison 1943
|
||||
Ringo Starr 1940
|
||||
|
||||
@@ -1 +1 @@
|
||||
4Gvipjyvip
|
||||
4Gvipjyvip
|
||||
|
||||
@@ -16,6 +16,8 @@ function! GFM()
|
||||
\ lang, lang, lang)
|
||||
endfor
|
||||
let b:current_syntax='mkd'
|
||||
|
||||
syntax sync fromstart
|
||||
endfunction
|
||||
|
||||
silent! unlet g:easy_align_delimiters
|
||||
@@ -39,5 +41,4 @@ set buftype=nofile
|
||||
silent! ScrollPositionHide
|
||||
|
||||
call GFM()
|
||||
syntax sync fromstart
|
||||
|
||||
|
||||
Reference in New Issue
Block a user