Making PostgreSQL 1% better

I’ve been a Vim user for as long as I’ve been using GNU/Linux (damn, that’s actually a really long time). I’m also a big fan of Vim mode when using the command-line interface (CLI). It’s so much more efficient than the Emacs mode in my opinion.

Additionally, PostgreSQL is my favourite relational database management system (RDBMS). PostgreSQL has so many qualities but its interactive interface (psql) is undoubtedly its strongest asset.

However, when it comes to using psql, I always found myself missing the Vim mode. Truth be told, you wouldn’t even think of using one with the other as both pieces of software are typically unrelated.

Well, I have some good news for you today: you can actually enable Vim mode within psql!

Simply run the commands below. Make sure you are logged in as a normal user as you want to avoid executing commands as root as much as possible.

1$ cd $HOME
2$ echo "set editing-mode vi" > .inputrc

Now source the .inputrc file to enable it.

1$ source .inputrc

That’s it! Exit psql and restart it and you should now have access to Vim mode within psql.

#PostgreSQL   #SQL   #Databases   #RDBMS   #Vim   #GNU/Linux   #English