mirror of
https://github.com/junegunn/vim-easy-align.git
synced 2025-11-13 12:23:48 -05:00
Fix: trailing delimiter not ignored (#4)
This commit is contained in:
@@ -90,12 +90,12 @@ Formatting YAML (or JSON)
|
||||
```yaml
|
||||
|
||||
mysql:
|
||||
# JDBC driver for MySQL database
|
||||
# JDBC driver for MySQL database:
|
||||
driver: com.mysql.jdbc.Driver
|
||||
# JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE)
|
||||
url: jdbc:mysql://localhost/test
|
||||
database: test
|
||||
user:r00t
|
||||
"user:pass":r00t:pa55
|
||||
|
||||
```
|
||||
|
||||
|
||||
@@ -89,13 +89,13 @@ function! s:do_align(just, all_tokens, fl, ll, fc, lc, pattern, nth, ml, mr, sti
|
||||
\ strpart(getline(line), a:fc - 1, a:lc - a:fc + 1) :
|
||||
\ strpart(getline(line), a:fc - 1),
|
||||
\ pattern.'\zs')
|
||||
let concat = 0
|
||||
if empty(ignored_syntax)
|
||||
let tokens = raw_tokens
|
||||
else
|
||||
" Concat adjacent tokens that are split by ignorable delimiters
|
||||
let tokens = []
|
||||
let idx = 0
|
||||
let concat = 0
|
||||
for token in raw_tokens
|
||||
let idx += len(token)
|
||||
if concat
|
||||
@@ -112,6 +112,11 @@ function! s:do_align(just, all_tokens, fl, ll, fc, lc, pattern, nth, ml, mr, sti
|
||||
let tokens = extend([join(tokens[0:1], '')], tokens[2:-1])
|
||||
endif
|
||||
|
||||
" Skip comment line
|
||||
if concat && len(tokens) == 1
|
||||
let tokens = []
|
||||
endif
|
||||
|
||||
" Remember tokens for subsequent recursive calls
|
||||
let a:all_tokens[line] = tokens
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user