2

Is there a way to make a key-binding such that emacs moves the cursor to a certain column (e.g. 100)? In my case that's where I tend to put inline comments, so it would be great to have a shortcut to add spaces from the end of the line of code, up to line 100. Preferably it would move the cursor (without adding spaces) if there was already text at the (e.g.) 100th line.

4

1 回答 1

2

这是一个简单的选项 - 使用M-g TAB(绑定到move-to-column)。

如果行不够长,此命令不会添加额外的空格。要添加额外空间,您可以使用稍作修改的命令:

(defun go-to-column (column)
  (interactive "nColumn: ")
  (move-to-column column t))

如果您希望将它们组合为单个命令,则可以使用前缀参数在两种行为之间切换。

于 2013-06-16T18:34:46.903 回答