1

On my macOS and Linux systems, I run ed with alias ed='rlwrap ed'. On macOS with rlwrap 0.46.1 (2022) I can freely create files with tabs like:

$ ed a foo<TAB>bar 

but on my Linux systems with rlwrap 0.43 (2016) I can't use tabs unless I escape like this:

$ ed a foo<ESCAPE><TAB>bar 

I know I should get around to upgrading my Linux servers; but rlwrap is currently at the latest according to apt. Is there some rlwrap option that will give me back my tabs? I tried searching through the rlwrap manpage for "tab"; but didn't find anything.

1
  • Are you using vi or emacs editing mode with Readline (and are you specifically setting that editing mode somehow)? Do you have an existing ~/.inputrc file? Commented Feb 27 at 7:40

1 Answer 1

1

I don't know what your current Readline configuration looks like, so I'm going to wave my hands a bit and give you something that will probably work.

In emacs editing mode, the Tab key is bound to the self-insert Readline function, which has the effect of inserting the actual tab character when you press Tab on your keyboard. This is the default key binding for the key, but it may also have been re-bound to something that would potentially remove its self-insert functionality. In emacs editing mode Escape+Tab is bound to the tab-insert function, which inserts a tab character.

In vi editing mode, the Tab is bound to the complete function, which is also not helpful in inserting tab characters.

We can solve this by ensuring that Tab is bound to either self-insert or the tab-insert function for ed. We do this by adding the following to our ~/.inputrc file.

$if ed TAB: self-insert $endif 

The tab-insert function is helpful if you want to set up some other key combination (other than Tab) for inserting tabs.

1
  • 1
    Excellent! I didn't have a consequential ~/.inputrc file—only a set enable-bracketed-paste Off setting. And I haven't knowingly configured any emacs or vi mode; but in any case, your solution works (as usual :)). Commented Feb 28 at 5:20

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.