0

This question already has an answer here:

I'm jealous of my co-workers using phpstorm etc to visualize the db schema etc.. I was wondering if there was a solution for that on vim? I googled around and found this https://github.com/vim-scripts/dbext.vim

although it seems kind of dated and the documentation seems lacking. help?

marked as duplicate by statox Mar 9 '18 at 14:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    Just a note: Vim follows the Unix philosophy "Your tools should do one thing and do it well". Vim is a text editor, not an IDE (which phpstorm is) thus I would not recommend trying to use it for something else than editing text. If you want a good database visualizer, find a standalone software which does that (or even use phpstorm) you'll get less trouble and a better quality tool than trying to bend vim to do something it was not designed to do. I know this is not an answer to your question, it is just my opinion and that doesn't make your question less legit :) – statox Jan 23 '18 at 8:43
  • just a text editor would merit an entire stack exchange site? 😒 – abbood Jan 23 '18 at 9:05
  • 4
    One of the best text editors definitely merits an entire stack exchange site :) – statox Jan 23 '18 at 9:08
  • When it's an extremely powerful text editor with many, many different ways to manipulate text...and the often unavoidable complexity that you get as part of the bargain...yes, it merits an entire SE site. And I love every bit of it. :) – B Layer May 15 '18 at 5:55
4

As statox explained, Vim is a text editor, not a database tool, not a coffee machine. But if you want to augment Vim's potential with external tools, you can, and you should!

On your specific question, you really should learn to use your database CLI. It'll give you the best knowledge of what's inside your DB. And because it will be a CLI, you can call it/read from Vim.

As an example, look at https://github.com/mattn/vdbi-vim/blob/master/autoload/vdbi.vim. It's another DB plugin visualisation.

It's wrapping the SELECT ... in functions so you can use them against different DBS. In a nutshell it's reading from the cli and putting it in the buffer.

It's cool and all, but it's not using Vim to anything related to the DB. You're using Vim to diplay the result of your query, and manipulate it and :g/re/p it if you want.

Vim is a text editor.

0

Tim Pope just created a plugin called vim-db. It's "a modern take on dbext.vim", which seems to be exactly what you are looking for.

Not the answer you're looking for? Browse other questions tagged or ask your own question.