5 ms·
Note that if you use a variable width font (and so you don't care much if >= has different width than ≥ ) you can simply use font-lock-add-keywords and map what
by mrighele 10y ago
Note that if you use a variable width font (and so you don't care much if >= has different width than ≥ ) you can simply use font-lock-add-keywords and map what you need. For example in JS you could use
(font-lock-add-keywords 'js2-mode '(
("=>" (0 `(face nil display "")))
(">=" (0 `(face nil display "≥")))
("<=" (0 `(face nil display "≤")))))
EDIT: It seems that HW doesn't really like U+27A1 ... :-)
- anamoulous 10y agoAre you coding javascript in a variable width font?
- mrighele 10y agoAs strange as it may sound, yes. It took some time to get used to it, but now I find the code easier to read. There are a number instances where the missing vertical alignment is a drawback, for example ASCII art, boxed comments or comments on the right of the code, but since I don't make use of them it is not an issue for me.
- metaobject 10y agoI'm not sure I could ever write code in a non-fixed-width font. Maybe if I wrote every line perfectly and never had to navigate back a few lines to make adjustments. But then again, I spend a non-trivial amount of time lining code/variables up and making things just right before moving on that a variable-width font would probabky drive my OCD (Obsessive Code Disorder) levels up to 11. I don't even want to see what happens when you mark a region and call M-x align in a variable width font.