Show More
@@ -13,6 +13,7 b' def clear_f(self,arg):' | |||
|
13 | 13 | %clear in - clear input history |
|
14 | 14 | %clear shadow_compress - Compresses shadow history (to speed up ipython) |
|
15 | 15 | %clear shadow_nuke - permanently erase all entries in shadow history |
|
16 | %clear dhist - clear dir history | |
|
16 | 17 | """ |
|
17 | 18 | |
|
18 | 19 | api = self.getapi() |
@@ -50,10 +51,15 b' def clear_f(self,arg):' | |||
|
50 | 51 | print "Erased all keys from shadow history " |
|
51 | 52 | for k in ip.db.keys('shadowhist/*'): |
|
52 | 53 | del ip.db[k] |
|
54 | elif target == 'dhist': | |
|
55 | print "Clearing directory history" | |
|
56 | del ip.user_ns['_dh'][:] | |
|
57 | ||
|
53 | 58 | |
|
54 | 59 | ip.expose_magic("clear",clear_f) |
|
55 | 60 | import ipy_completers |
|
56 | ipy_completers.quick_completer('%clear','in out shadow_nuke shadow_compress') | |
|
61 | ipy_completers.quick_completer( | |
|
62 | '%clear','in out shadow_nuke shadow_compress dhist') | |
|
57 | 63 | |
|
58 | 64 | |
|
59 | 65 |
@@ -318,10 +318,12 b' def cd_completer(self, event):' | |||
|
318 | 318 | bkms = self.db.get('bookmarks',{}) |
|
319 | 319 | return bkms.keys() |
|
320 | 320 | |
|
321 | ||
|
321 | ||
|
322 | 322 | if event.symbol == '-': |
|
323 | width_dh = str(len(str(len(ip.user_ns['_dh']) + 1))) | |
|
323 | 324 | # jump in directory history by number |
|
324 | ents = ['-%d [%s]' % (i,s) for i,s in enumerate(ip.user_ns['_dh'])] | |
|
325 | fmt = '-%0' + width_dh +'d [%s]' | |
|
326 | ents = [ fmt % (i,s) for i,s in enumerate(ip.user_ns['_dh'])] | |
|
325 | 327 | if len(ents) > 1: |
|
326 | 328 | return ents |
|
327 | 329 | return [] |
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """Magic functions for InteractiveShell. |
|
3 | 3 | |
|
4 |
$Id: Magic.py 272 |
|
|
4 | $Id: Magic.py 2728 2007-09-07 16:12:42Z vivainio $""" | |
|
5 | 5 | |
|
6 | 6 | #***************************************************************************** |
|
7 | 7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
@@ -2709,7 +2709,12 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2709 | 2709 | |
|
2710 | 2710 | This history is automatically maintained by the %cd command, and |
|
2711 | 2711 | always available as the global list variable _dh. You can use %cd -<n> |
|
2712 |
to go to directory number <n>. |
|
|
2712 | to go to directory number <n>. | |
|
2713 | ||
|
2714 | Note that most of time, you should view directory history by entering | |
|
2715 | cd -<TAB>. | |
|
2716 | ||
|
2717 | """ | |
|
2713 | 2718 | |
|
2714 | 2719 | dh = self.shell.user_ns['_dh'] |
|
2715 | 2720 | if parameter_s: |
@@ -2938,6 +2943,8 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2938 | 2943 | def magic_r(self, parameter_s=''): |
|
2939 | 2944 | """Repeat previous input. |
|
2940 | 2945 | |
|
2946 | Note: Consider using the more powerfull %rep instead! | |
|
2947 | ||
|
2941 | 2948 | If given an argument, repeats the previous command which starts with |
|
2942 | 2949 | the same string, otherwise it just repeats the previous input. |
|
2943 | 2950 |
General Comments 0
You need to be logged in to leave comments.
Login now