C-a
让我回到了行的开头。但是我希望C-a
在编写python代码时让我回到文本的开头。
if(test) :
print 'this is a test' # here i want to C-a
现在,在以print
开头的行的最后,我想按C-a
转到print
的p,而不是行的开头。 emacs中有哪些功能?
答案 0 :(得分:12)
事实上,这个 M-m 有一个直接的全局键绑定
答案 1 :(得分:1)
Drew Adams有'misc-cmds.el',它有beginning-or-indentation
命令。这可能就是你要找的东西。来自docstring:
Move cursor to beginning of this line or to its indentation.
If at indentation position of this line, move to beginning of line.
If at beginning of line, move to beginning of previous line.
Else, move to indentation position of this line.
答案 2 :(得分:0)
我用
back-to-indentation
我将它绑定到我的.emacs中的 C-x C-a :
(global-set-key "\C-x\C-a" 'back-to-indentation)
答案 3 :(得分:0)
我在我的设置中做了一个小的自定义功能。当我按下C-a并且它不在缩进处时,它会回到缩进处。如果是,则转到该行的开头。
;; Remap C-a to more useful behaviour (a press anywhere other than at the indentation preforms the effect of back-to-indetation, otherwise, the normal C-a behaviour is used.
(global-set-key (kbd "C-a") (lambda () (interactive)
(let ((previous-point (point)))
(back-to-indentation)
(if (equal (point) previous-point) (move-beginning-of-line 1)))))