如何显示 Emacs 模型行中的总行数
默认的 Emacs 模型行仅显示当前行号及其相对于总行号的百分比。如何让它也显示行总数?
The default Emacs modeline only shows the current line number and its percentage in relation to the total line numbers. How do I make it show the line total as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能有点棘手,因为如果您一直更新行数并且有一个很大的缓冲区,则可能会使 Emacs 有点无响应,因为它会一遍又一遍地计算行数。我写这篇文章是为了采取一种懒惰的方法来计数:它仅在第一次读入文件或保存/恢复文件后才进行计数。如果缓冲区被修改,它不会隐藏行数,只是在您再次保存之前不会显示。
当然,您可能需要调整
mode-line-format
来适合您的口味,以上是我个人更喜欢的。This can be a little tricky, because if you update the line count all the time and have a large buffer it can make Emacs somewhat unresponsive since it's counting lines over and over. I wrote this to take a lazy approach to counting: it only does it when the file is first read in or after you save/revert it. If the buffer is modified it doesn't lie about the line count, it simply isn't shown until you save again.
You might want to adjust
mode-line-format
to suit your taste of course, the above is what I personally prefer.