Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass buffer/selection through other command first? #58

Closed
sdressler opened this issue Mar 9, 2020 · 2 comments
Closed

Pass buffer/selection through other command first? #58

sdressler opened this issue Mar 9, 2020 · 2 comments

Comments

@sdressler
Copy link

This is more a question than an issue: I wonder whether it would be possible to pass the buffer/selection to be send to the DB via an additional filter or extending command. For example, if I have

SELECT COUNT(*)
FROM foo;

and execute this in e.g. PostgreSQL, then it would be very efficient to get the EXPLAIN or EXPLAIN ANALYZE output by e.g.

%DB | echo "EXPLAIN ANALYZE" | postgresql://postgres@localhost/mydb

Or a similar sequence.

My assumption: this already works out of the box and I am just not googling for the right thing. Happy about any help.

@tpope
Copy link
Owner

tpope commented Mar 12, 2020

Vim doesn't have anything resembling pipes. :%DB postgres://... foo currently ignores the foo; it would probably be pretty easy to prepend it to the query if that's an adequate solution.

@sdressler
Copy link
Author

sdressler commented Mar 12, 2020

Thanks for the answer! Prepending would be absolutely acceptable. I just want to avoid having to change the query in the buffer and then reverting the change.

How could this be accomplished? Maybe it’s time for my first vim related PR ;-)

@tpope tpope closed this as completed in 62646c5 Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants