When I want to easily read my PostgreSQL schema, I dump it to stderr and redirect it to vim:
pg_dump -h localhost -U postgres dog_food --schema-only | vim -
This gives:
vim does not have a syntax highlight schema, because it has no filename extension when reading from stdin, so I use the following:
:set syntax=sql
Which gives:
Being the lazy developer I am, I would like to force vim to use the SQL syntax by passing a command line argument, saving me the choir of re-typing set syntax=<whatever> every time I open it with stdin data..
Is there a way to set vim syntax by passing a command line argument?




