Created
August 30, 2012 20:20
-
-
Save saveologypaul/3539912 to your computer and use it in GitHub Desktop.
Spit out a table's columns into a vim buffer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
how to spit out a table's column names: | |
the following are vim commands | |
# get the table definition from the database | |
:r!echo '\d domains' | psql battery_development | |
# strip out everything besides the column name | |
:'<,'>s/^\s*\(\S\S*\)\s.*/\1/ | |
# uppercase everything after the underscore '_' | |
:'<,'>s/_\(.\)/ \U\1/g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment