[IPython-user] vim mapping for copying from the ipython history
Fernando.Perez at colorado.edu
Thu Oct 20 12:42:46 CDT 2005
Ryan Krauss wrote:
> This may be useful to any VIM users on the list (but you probably
> already thought of it). I do a fair ammount of copying and pasting
> from the ipython history into an existing file. This mapping:
> :map <C-S-i> :%s/^\d\+:\s\+//<cr>
> removes the #:space from the beginning of those lines.
Thanks for the tip. Just as an fyi, you may want to know that the -n switch
prevents these numbers from being printed in the first place:
In : print 'hi Ryan'
In : import sys
In : hist
1: print 'hi Ryan'
2: import sys
In : hist -n
print 'hi Ryan'
This makes it much easier to copy/paste. You can also use the %save magic to
dump a bunch of lines (not necessarily contiguous) to a file. Type %save? for
More information about the IPython-user