Show More
@@ -139,12 +139,24 b' def create_ipython_shortcuts(shell):' | |||
|
139 | 139 | event.current_buffer.insert_text("{}") |
|
140 | 140 | event.current_buffer.cursor_left() |
|
141 | 141 | |
|
142 | @kb.add('"', filter=focused_insert & auto_match & following_text(r"[,)}\]]|$")) | |
|
142 | @kb.add( | |
|
143 | '"', | |
|
144 | filter=focused_insert | |
|
145 | & auto_match | |
|
146 | & preceding_text(r'^([^"]+|"[^"]*")*$') | |
|
147 | & following_text(r"[,)}\]]|$"), | |
|
148 | ) | |
|
143 | 149 | def _(event): |
|
144 | 150 | event.current_buffer.insert_text('""') |
|
145 | 151 | event.current_buffer.cursor_left() |
|
146 | 152 | |
|
147 | @kb.add("'", filter=focused_insert & auto_match & following_text(r"[,)}\]]|$")) | |
|
153 | @kb.add( | |
|
154 | "'", | |
|
155 | filter=focused_insert | |
|
156 | & auto_match | |
|
157 | & preceding_text(r"^([^']+|'[^']*')*$") | |
|
158 | & following_text(r"[,)}\]]|$"), | |
|
159 | ) | |
|
148 | 160 | def _(event): |
|
149 | 161 | event.current_buffer.insert_text("''") |
|
150 | 162 | event.current_buffer.cursor_left() |
@@ -186,16 +198,6 b' def create_ipython_shortcuts(shell):' | |||
|
186 | 198 | event.current_buffer.insert_text("{}" + dashes) |
|
187 | 199 | event.current_buffer.cursor_left(len(dashes) + 1) |
|
188 | 200 | |
|
189 | @kb.add('"', filter=focused_insert & auto_match & preceding_text(r".*(r|R)$")) | |
|
190 | def _(event): | |
|
191 | event.current_buffer.insert_text('""') | |
|
192 | event.current_buffer.cursor_left() | |
|
193 | ||
|
194 | @kb.add("'", filter=focused_insert & auto_match & preceding_text(r".*(r|R)$")) | |
|
195 | def _(event): | |
|
196 | event.current_buffer.insert_text("''") | |
|
197 | event.current_buffer.cursor_left() | |
|
198 | ||
|
199 | 201 | # just move cursor |
|
200 | 202 | @kb.add(")", filter=focused_insert & auto_match & following_text(r"^\)")) |
|
201 | 203 | @kb.add("]", filter=focused_insert & auto_match & following_text(r"^\]")) |
General Comments 0
You need to be logged in to leave comments.
Login now