Skip to content

junegunn/tabular

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tabular.vim

Forked from https://github.com/godlygeek/tabular.

Change #1: Extended format

Limiting the number of cells to be processed.

Why

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

How

Put this line into your .vimrc

" Specify the number of cells after the dash
let g:tabular_default_format = "l1-1"

Change #2: Better tabularization in visual mode

Why

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

About

tabular.vim with a couple of changes (abandoned. check out vim-easy-align)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%