EMACS :: linum 模式和字体大小(不可读的行号)
当在 emacs 中使用 linum-mode 以及通过 Mx text-scale-increase
增加字体时,有一件事困扰着我。行号的字体与阅读的大小相同,并且不适合到缓冲区左侧的left-margin
!
1 正常字体大小,OK
2 字体大小增大,不再可读 FUUUUU
我真正想要的有:
当增加/减少字体时,我希望其中之一起作用
- ,然后增加/减少左边距的宽度(resp。 left-fringe) 相应地
然后不要更改左边距的字体但增加/减少行号之间的间距
有人有什么建议吗? 谢谢,伙计们
When using linum-mode in emacs and when increase font by M-x text-scale-increase
, there is the one thing that bothers me. Font for line numbers have same size as reading and don't fit into left-margin
on left side of buffer!
1
Normal font-size, OK
2
Increased font-size, no longer readable FUUUUU
What I'd really like to have:
When increase/decrease font I want one of these to work
- then increase/decrease width of left-margin (resp. left-fringe) accordingly
then don't change font for left-margin but increase/decrease spacing between line numbers
Does anybody have some suggestions?
Thanks, guys
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我想我可以用下面的代码解决这个问题:
它似乎可以工作,至少在 24.5 上是这样。
I think I can fix that problem with the following code:
It seems to work, at least with 24.5.
如果可以的话,我会评论基于
customize-face
的解决方案。这对我来说效果很好。实际的面孔是linum
而不是linum-mode
,至少在我的emacs-24.3.1
中是这样。在自定义缓冲区中,我单击“显示所有属性”,然后将面高度设置为十分之 100 点。如果您可以接受行号的固定大小的面(就像我一样),那么基于customize-face
的解决方案非常简单。I would comment on the solution based on
customize-face
if I could. It works well for me. The actual face islinum
rather thanlinum-mode
, at least in myemacs-24.3.1
. In the customization buffer, I clicked on "Show all attributes" and then set the face height to 100 tenths of a point. If a fixed-size face for the line numbers is acceptable to you (as it is to me) the solution based oncustomize-face
is straightforward.您可以禁用
linum-mode
并使用display-line-numbers-mode
来代替,它是自版本 26 以来 Emacs 的一部分,并且在增加字体大小时可以很好地缩放。例如,您的配置可能如下所示:
You can disable
linum-mode
and usedisplay-line-numbers-mode
instead which is part of Emacs since version 26 and scales well when increasing font size.E.g. your config can look like:
看一下这两个链接:
它可以很好地满足我的需求。
示例:
1
Have a look at these two links:
It works quite well enough for my needs.
Examples:
1
我见过的最简单、最直接的解决方案是将行号设置为固定高度。根据 user78810 的回答,这可以轻松完成:https://unix.stackexchange.com/questions/ 29786/font-size-issues-with-emacs-in-linum-mode/146781#146781
也就是说,在您的 emacs 配置中添加以下行(如果您使用的是 spacemacs,则添加到您的
dotspacemacs/user-config
函数中):The easiest, most straightforward solution I've seen is to set the line numbers to a fixed height. This can be accomplished easily, in accordance with user78810's answer: https://unix.stackexchange.com/questions/29786/font-size-issues-with-emacs-in-linum-mode/146781#146781
To wit, add the following line in your emacs config (or to your
dotspacemacs/user-config
function, if you're using spacemacs):