使用linum显示emacs行号

本文介绍如何在Emacs编辑器中启用行号显示功能。从Emacs 23.1版本开始,linum模式已作为标准特性提供。用户可以通过M-x linum-mode命令轻松激活该功能。此外,还提供了通过配置.emacs文件来全局启用行号的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

emacs 23.1以后的版本都默认包含linum,只需使用M-x输入命令linum-mode再按回车即可显示行号.详见下文.

(转自https://www.metalevel.at/linum/linum.html)



linum lets you display line numbers to the left of Emacs buffers.

linum-mode screenshot


As of Emacs 23.1,  linum  ships with GNU Emacs. You can enable it with  M-x linum-mode RET  

You can also download either: 

Copy the appropriate  linum.el  to your load-path and add to your  .emacs
      (require 'linum)
    

Then toggle display of line numbers with M-x linum-mode RET 


另外,全局开启的方法如下: .emacs 中写入

(global-linum-mode 1) <span class="comment-delimiter" style="color: rgb(178, 34, 34);">; </span><span class="comment" style="color: rgb(178, 34, 34);">always show line numbers</span>
保存即可。

注:.emacs文件一般位于用户的home目录下,windows下需要设置HOME环境变量,HOME环境变量所指的目录即为home目录.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值