Today I Learned

hashrocket A Hashrocket project

Page Through MySQL with Vim

Yesterday I wrote about paging through the MySQL REPL with Less. Here's how to do it with the more fully-featured Vim text editor.

mysql> pager vim -
PAGER set to 'vim -'

The - is important; it tells Vim to read text from stdin. Normal Vim feature flags can be used with this pager, so if you want to set use Vim's easy mode (for example), use the flag:

mysql> pager vim -y -
PAGER set to 'vim -y -'
See More #sql TILs
Looking for help? Hashrocket developers believe that data quality is as important as code quality. We enjoy all the challenges of relational databases, from finding the fastest index, to structuring data to fit the needs of an application. We're eager to share our experiences; check out PG Casts, our series of free PostgreSQL screencasts.