dbcli / pgcli

Postgres CLI with autocompletion and syntax highlighting
http://pgcli.com
BSD 3-Clause "New" or "Revised" License
12.14k stars 557 forks source link

funtion keys not working in iterm #485

Open gnzsnz opened 8 years ago

gnzsnz commented 8 years ago

Hi,

i can't get function keys (F2, F3, F4) to work with pgcli and iterm(OSX). everything is working fine with osx terminal, and function keys do work in iterm and other software, ex byobu. it seems to an issue with this specific combination.

i get the following when i press function keys.

F2 --> [[B F3 --> [[C F4 --> [[D

amjith commented 8 years ago

Did you already try Fn+F2 or Fn+F3?

I'm using iterm and tmux and I'm able to use the function keys without trouble. The key combinations are handled by (prompt_toolkit)[https://github.com/jonathanslenders/python-prompt-toolkit/]. My recommendation is to try one of the other tools written in prompt_toolkit such as ptpython and see if function keys work in that scenario.

gnzsnz commented 8 years ago

Hi,

Thanks for your answer.

I'm using byobu which uses tmux as backend and function keys are working fine. Same with ptpython, F3 takes me to history in ptpython and i get an "[[C" with pgcli. with standard ios terminal function keys are working fine.

as a workaround i setup multiline ON in the configuration file. but would prefer to be able to change it dynamically.

is there another way to change dynamically multiline, completion, etc?

Gonzalo

j-bennet commented 8 years ago

@gnzsnz , I'm using pgcli with iterm2 on mac, and function keys work without any problems. I think your byobu may be interfering there, since it has its own mapping for function keys, and it would override prompt_toolkit's mapping (at least it did for me when I tried it). Did you customize your byobu or iterm key mapping, or is it all out-of-the-box?

gnzsnz commented 8 years ago

hi @j-bennet, i use pgcli outside byobu, otherwise key do conflict. but the problem is that even outside byobu function keys (F*) do not work for iterm and pgcli. iterm and pgcli are out of the box i have not changed key mapping.

thanks for your comments.

glowinthedark commented 4 years ago

a simple workaround is emulating function keys with ESC+ 1..0 which will send F1..F10 correspondingly.