Skip to content

[Bug] RTL Language Support: Arrow keys/Vim motions (h/l) directionality and text alignment #134

Description

@YuvalAmir1

Description

When using Right-to-Left (RTL) languages like Hebrew (and likely Arabic), there are a couple of issues regarding visual cursor movement and paragraph alignment.

What is working correctly:

  • Word ordering and bidirectional (bidi) text rendering seem to work properly.
  • The b and w Vim motions function as expected.

There are two primary issues with RTL:

Issue 1: Inverted Cursor Movement (Arrows and h/l)

Currently, the right arrow key (and the l Vim motion) always functions as "move the cursor to the next character." However, in RTL text, the next character is visually to the left. This results in the physical arrow keys feeling inverted when navigating RTL text (e.g., pressing Right moves the cursor visually Left). The same holds true for the left arrow key and the h Vim motion.

Issue 2: Incorrect Text Alignment

Text is always aligned to the left side of the screen, even for lines that consist entirely of RTL characters.

Expected Behavior

  • Cursor Movement: Visual cursor movement should map directly to physical keys. Pressing the right arrow (or l) should always move the cursor physically to the right, regardless of the underlying logical text direction.
  • Alignment: Lines starting with an RTL character should automatically align to the right, ideally with a way to force-align a line/block of text.

Platform

CachyOS Linux

Suggested Implementation

Full bidirectional text support can take time to get right. A practical compromise is to evaluate the first character of the line to dictate the arrow key directionality, accepting that mixed-direction inline text might still have reversed inputs. This alone would be a massive improvement to the baseline UX.

For reference on a more complete implementation, Obsidian currently handles bidi arrow directionality exceptionally well.

Activity

  1. added
    bugSomething isn't working
    i18nInput methods, RTL, localisation
    vimVim mode: motions, leader, hint mode, ex commands
    on Aug 25, 2026
  2. added theissue type on Aug 25, 2026
  3. fadyehabamer commented on Oct 1, 2026

    @fadyehabamer

    I'd like to take this. Approach: each line gets its direction from its first strong letter (after skipping list markers, task boxes, heading and quote markers, so - [x] مهمة reads RTL), right-to-left lines get dir="rtl" with EditorView.perLineTextDirection so they align right and the arrow keys move visually, and Vim h/l/<Left>/<Right> follow the same per-line direction (like Vim's rightleft). I have it working with tests, happy to open a PR if this sounds right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingi18nInput methods, RTL, localisationvimVim mode: motions, leader, hint mode, ex commands

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions