Skip to content

Instantly share code, notes, and snippets.

@saveologypaul
Created August 30, 2012 20:20
Show Gist options
  • Save saveologypaul/3539912 to your computer and use it in GitHub Desktop.
Save saveologypaul/3539912 to your computer and use it in GitHub Desktop.
Spit out a table's columns into a vim buffer
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