mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-13 12:23:48 -05:00
Implement stick_to_left in center-alignment mode
This commit is contained in:
@@ -414,6 +414,15 @@ function! s:do_align(modes, all_tokens, all_delims, fl, ll, fc, lc, pattern, nth
|
||||
let strip = float2nr(ceil((max.token_len - max.strip_len) / 2.0))
|
||||
let token = repeat(' ', float2nr(pf1)) .token. repeat(' ', float2nr(p2))
|
||||
let token = substitute(token, repeat(' ', strip) . '$', '', '')
|
||||
|
||||
if a:stick_to_left
|
||||
if empty(s:rtrim(token))
|
||||
let center = len(token) / 2
|
||||
let [token, rpad] = [strpart(token, 0, center), strpart(token, center)]
|
||||
else
|
||||
let [token, rpad] = [s:rtrim(token), matchstr(token, '\s*$')]
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let tokens[nth] = token
|
||||
|
||||
|
||||
Reference in New Issue
Block a user