Forked from https://github.com/godlygeek/tabular.
Limiting the number of cells to be processed.
In the following example, the additional colons in the third line should not be considered as cell-delimiters.
mysql:
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost/test
database: test
Which means, we want
mysql:
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost/test
database: test
and not,
mysql:
driver: com.mysql.jdbc.Driver
url: jdbc: mysql: //localhost/test
database: test
Put this line into your .vimrc
" Specify the number of cells after the dash
let g:tabular_default_format = "l1-1"
For the following case, where comments are interleaved, you might want to tabularize the lines in visual mode.
mysql:
# JDBC driver for MySQL database
driver: com.mysql.jdbc.Driver
# JDBC URL for the connection
url: jdbc:mysql://localhost/test
database: test
user: root
# password: r00t
Select all the lines in visual mode then, :'<,'>Tab /:\zs
.
The result should be
mysql:
# JDBC driver for MySQL database
driver: com.mysql.jdbc.Driver
# JDBC URL for the connection
url: jdbc:mysql://localhost/test
database: test
user: root
# password: r00t
instead of,
mysql:
# JDBC driver for MySQL database
driver: com.mysql.jdbc.Driver
# JDBC URL for the connection
url: jdbc:mysql://localhost/test
database: test
user: root
# password: r00t