跳转到emacs中的第一个非空白字符


Answers:


93

该命令back-to-indentation默认绑定为M-m


12

这是我从先前的堆栈溢出问题中得到的

(defun smart-beginning-of-line ()
  "Move point to first non-whitespace character or beginning-of-line.

Move point to the first non-whitespace character on this line.
If point was already at that position, move point to beginning of line."
  (interactive)
  (let ((oldpos (point)))
    (back-to-indentation)
    (and (= oldpos (point))
         (beginning-of-line))))
(global-set-key [home] 'smart-beginning-of-line)
(global-set-key "\C-a" 'smart-beginning-of-line)

这不是用户要求的;vim中的^不会这样做;M-m恰好是^vim 的类似物,因此也是正确的答案。
xdavidliu

1

您可以安装 crux

键入C-a以在行首和第一个非空白字符之间切换光标


这个问题并没有要求在第一个非空白字符和第一列之间进行切换,它只是要求^in vim 的类似物,正是这样M-m
xdavidliu
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.