Postgres外部编辑器不对savequit执行查询

编程入门 行业动态 更新时间:2024-10-25 06:33:12
本文介绍了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 开关。
  • PSQL_EDITOR 环境变量。
  • vim -u switch.
  • PSQL_EDITOR env var.

更多推荐

Postgres外部编辑器不对savequit执行查询

本文发布于:2023-10-23 00:15:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519167.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:编辑器   Postgres   savequit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!