Misaligned Line Numbers with display-line-numbers-mode reddit / emacs ---------------------------------------------------------------------- la023 · 2022-04-27 05:20 I just migrated from Linux to Mac. I'm using the setting `display- line-numbers-type 'visual`. On Linux, my line numbers were aligned fine, but on Mac they are misaligned as seen in this picture (using the same config): https://preview.redd.it/qi0cj866a0w81.png?width=454&format=png&auto=we bp&s=34c991504bba747e74437db9fa1a992e5b9beda3 Note, the `display-line-numbers-width` setting doesn't fix this, increasing it just shifts the misalignment to the right. The only other relevant configuration I'm using is `global-display- line-numbers-mode`. ---------------------------------------------------------------------- harunokashiwa · 2022-04-28 06:32 try ``` (setq-default display-line-numbers-width-start t display-line-numbers-width 1 display-line-numbers-grow-only t) (global-display-line-numbers-mode +1) ``` ---------------------------------------------------------------------- a-c-d-w · 2022-04-28 11:29 I had this issue when using a variable-pitch font. Changing the following faces to `fixed-pitch` helped: - `line-number` - `line-number-major-tick` - `line-number-minor-tick` - `line-number-current-line` ---------------------------------------------------------------------- la023 · 2022-04-28 19:57 None of these worked for me ---------------------------------------------------------------------- la023 · 2022-04-28 19:58 This didn't work using the code: ``` (set-face-attribute 'line-number 'fixed-pitch) (set-face-attribute 'line-number-major-tick 'fixed-pitch) (set-face-attribute 'line-number-minor-tick 'fixed-pitch) (set-face-attribute 'line-number-current-line 'fixed-pitch) ``` I tried it with a monospace font which did fix the alignment, so I'm guessing my code is setting these variables to fixed-pitch wrong with my variable-pitch font. Thanks for identifying the issue though ---------------------------------------------------------------------- a-c-d-w · 2022-04-28 20:45 sure thing! glad you got it fixed :)