Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C-a to go to the first character in emacs using ipython-mode

Tags:

emacs

ipython

C-a brings me back to the beginning of the line. But I would like C-a to bring me back to the beginning of the text when writing python code.

if(test) :
    print 'this is a test' # here i want to C-a

Now, at the end of the line starting with print i would like to press C-a to go to the p of print, not to the beginning of the line. Which function does this in emacs?

like image 900
user989762 Avatar asked Dec 07 '11 08:12

user989762


2 Answers

infact there is a direct global key binding for this M-m

like image 176
kindahero Avatar answered Nov 06 '22 18:11

kindahero


There is 'misc-cmds.el' by Drew Adams which has the command beginning-or-indentation. It's probably what you are looking for. From the 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.

Find it at http://www.emacswiki.org/cgi-bin/wiki/misc-cmds.el.

like image 29
u-punkt Avatar answered Nov 06 '22 17:11

u-punkt