Search code examples
linuxshellreadline

How to AVOID completion while pasting a `tab`?


I build an executable like bash with readline. It provides completion when I type tab.
When I copy a tab and paste on it, it still does complete. That isn't I'm hoping for.

The only setting of readline is:

rl_completion_entry_function = CmdGenerator;

I could provide details of CmdGenerator if it matters.

I hope tab is like a general charator like space or alpha when I paste it.

I tried to paste a tab in postgres psql, it didn't complete. On this environment, I did so in bash, it also didn't complete while others environments' bash do complete.


Solution

  • If the bracketed paste feature isn't working in your terminal, here is a work around:

    Use your $EDITOR to edit the command line using Ctrlx, Ctrle. Paste the data into your editor, save and quit.

    If the editor is Vim, you might want :set paste to turn on paste mode, to avoid the paste being reformatted by your auto-indent settings and whatnot.