See: http://www.vim.org/scripts/script.php?script_id=5358
This Vim plugin provides syntax highlighting and auto-completion support
for PostgreSQL version 9.4 or above and for some of its extensions:
- PL/pgSQL;
- any other language, like PL/Python, PL/R, etc...;
- PostGIS 2.2 (including PostGIS Topology);
- pgTap 0.95.0.
Source code available on GitHub: https://github.com/lifepillar/pgsql.vim
Enjoy,
Life