LoginSignup
1
2

More than 5 years have passed since last update.

Postgres.app で入ってくる psql の readline ショートカットがなんだかおかしかったら

Posted at

Mac で簡単に PostgreSQL を立てられる Postgres.app を使っていたら、
readline ショートカット(例えば、Ctrl-rで履歴を検索、Ctrl-aで行頭に飛ぶ、Ctrl-eで行末に飛ぶ、など)が動作しなくて困った。

雑に調べてみると、2014年の issue ではあるがそれっぽいものが見つかった。ななめ読みしてみると、Postgres.app は libreadline の代わりに、libedit を使っているらしく、~/.editrc ファイルに必要な物を書いておけば、とりあえずは使えるとのこと。

bind "^R" em-inc-search-prev
bind "\e[1~" ed-move-to-beg
bind "\e[4~" ed-move-to-end
bind "\e[3~" ed-delete-next-char
bind "\e[2~" ed-quoted-insert
bind "\e[1;5C" em-next-word
bind "\e[1;5D" ed-prev-word
bind "\e[5C" em-next-word
bind "\e[5D" ed-prev-word

とりあえず↑を ~/.editrc に書いてみると、Ctrl-rなど動作した。それぞれの行は、以下に対応。

  • History completion with Ctrl-R
  • Home
  • End
  • Delete
  • Insert

普通に brew install postgresql して使ったほうが変なところではまらずに良いかもしれません...

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2