The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

bidi - Make urxvt present Bidi text correctly

DESCRIPTION

This extension filters the text displayed by Urxvt, so that Bi-directional text (e.g., Hebrew or Arabic mixed with English) is displayed correctly. It does so using the Text::Bidi module (which should be installed).

The extension emulates a cursor via rendition. This means that when typing, there will be two cursors, the original one whose location corresponds to the current location within the logical string (so, mostly useless), and a fake one which corresponds to the current insertion point.

To enable the extension, add bidi to the Urxvt.perl-ext-common resource. See urxvt(1) and urxvtperl(1) for other options and more details.

The extension recognises the following resources:

bidi.FieldSep

This should be a string on which each line is split before applying the Bidi algorithm. This permits creating tables, where each cell is treated separately, e.g., in the index of an email client. Note that this is a string, not a regular expression. The default is \x{2502}.

bidi.LRE

A regular expression. The plugin insert an explicit left-right mark where it matches.

bidi.PDF

A regular expression. The plugin insert a PDF mark (end of LRE) where it matches.

bidi.par

Boolean, if true work in paragraph mode: the paragraph direction is not reset on each line, but only on lines that start or end a paragraph

bidi.ParReset

A regular expression. A line matching this will start a new paragraph.

bidi.ParResetAfter

Similar to bidi.ParReset, but the paragraph starts after the matching line.

For example, I use urxvt with this plugin to edit LaTeX documents in Hebrew. I have the following resources defined:

    URxvt.bidi.LRE: \\\\[([]
    URxvt.bidi.PDF: \\\\[)\\]]
    urxvt-vimh.bidi.par: true
    urxvt-vimh.cursorUnderline: true
    urxvt-vimh.bidi.ParReset: ^\\s*$|^\\\\begin|^\\\\\\[
    urxvt-vimh.bidi.ParResetAfter: ^\\\\end|\\\\\\]$

This causes inline equations (delimited by \( and \)) be displayed correctly, and equation environments be considered a paragraph (so that it is displayed on the left).