You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] RTL Language Support: Arrow keys/Vim motions (h/l) directionality and text alignment #134
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.
Reacted by Mohamed Ibraheem, OfirSinn, spidtzz and Yousuf Altayeb
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.
Activity
fadyehabamer commentedon Oct 1, 2026
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 getdir="rtl"withEditorView.perLineTextDirectionso they align right and the arrow keys move visually, and Vimh/l/<Left>/<Right>follow the same per-line direction (like Vim'srightleft). I have it working with tests, happy to open a PR if this sounds right.