本文介绍了Postgres外部编辑器不对savequit执行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我有点发疯。我正在尝试在postgres中使用 \e 编辑查询,但是在保存退出:wq 时没有任何反应。
运行 \p ,它显示编辑器保存的内容,只是带有空白行,或者是我最近在cli中运行的内容。

This is driving me slightly insane. I'm trying to edit a query using \e in postgres, but upon savequitting :wq nothing happens.Running \p, which shows what the editor saved, just comes up with a blank line, or whatever I ran most recently in the cli. It seems likethe editor is not persisting whatsoever.

我使用vim作为默认编辑器,并且使用的是psql 9.5.4版。操作系统是OSX,我正在使用iterm2。我在网上可以找到的唯一类似问题是,似乎没有任何建议可以帮助您。

I'm using vim as my default editor, and I'm on psql version 9.5.4. Operating system is OSX and I'm using iterm2. The only similar problem I could find online was here, and no advice there seemed to help.

欢迎所有想法!

编辑:发现了问题。这与我的vim有关-当我将编辑器设置为Pico时,事情就起作用了,所以我取消了vimrc并慢慢读取了东西。奇怪的是,当一切恢复正常时,它继续工作。因此,请检查它是否可以与其他编辑器一起使用!

Found the problem. It was something to do with my vim -- things worked when I set my editor to Pico, so I nuked my vimrc and slowly readded things. Oddly, when everything was up again it continued to work. So check if it works with another editor!

推荐答案

我已经确认使用 Janus vim发行版时会发生这种情况,并已以对其进行跟踪。在那儿解决后,它会给我们一个提示,我可以在这里给出具体的答案。

I have confirmed that this occurs when using the Janus vim distribution, and have created an issue over there to track it. Once resolved over there it'll give us a clue and I can give a specific answer here.

在此期间,将以下内容添加到您的〜 /.profile 作为解决方法:

In the interim add the following to your ~/.profile as a workaround:

export PSQL_EDITOR="vim -u NONE"

您将失去Janus功能(以及您之前 .vimrc中的其他任何内容。之后,但是它将允许您使用vim。

You will lose Janus functionality (and anything else in your .vimrc.before and .after, but it will let you use vim.

请参阅:

  • vim -u switch.
  • PSQL_EDITOR env var.

这篇关于Postgres外部编辑器不对savequit执行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 04:05