从0开始的Emacs列号模式编号列通常不会让我感到悲伤,但我正在使用一些基于行/列的数据文件,其规格以"1"开头,如果我这样会更容易可以让emacs做到这一点,或找到一些elisp.
欢迎思考.
Tre*_*son 10
您不能轻易地将Emacs更改为基于1的列计数,更改必须在C代码中.
但是,您可以计算自己的列并将其放在模式行中.注意:这需要使用force-mode-line-update- 这可能会减慢你的Emacs(只要记住两年后Emacs在一些大缓冲区感觉迟钝).
;; update the mode line to have line number and column number
(setq mode-line-position
'("%p (%l," (:eval (format "%d)" (1+ (current-column))))))
;; force the update of the mode line so the column gets updated
(add-hook 'post-command-hook 'force-mode-line-update)
Run Code Online (Sandbox Code Playgroud)
Doc使用的链接是"模式行中使用的变量"和"光标位置信息".
从Emacs 26(现已发布)开始,有一个内置旋钮可以解决此问题。
要使用它,请(setq column-number-indicator-zero-based nil)
在.emacs中设置
[编辑以反映Emacs 26现在已经发布。]