We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9b2991c + e8c0ed0 commit 8a3b5e1Copy full SHA for 8a3b5e1
pymode/run.py
@@ -6,8 +6,7 @@
6
from .environment import env
7
8
9
-encoding = re(r'#[^\w]+coding:\s+utf.*$')
10
-
+encoding = re(r'#.*coding[:=]\s*([-\w.]+)')
11
12
def run_code():
13
""" Run python code in current buffer.
@@ -18,9 +17,12 @@ def run_code():
18
17
errors, err = [], ''
19
line1, line2 = env.var('a:line1'), env.var('a:line2')
20
lines = __prepare_lines(line1, line2)
21
- for ix in (0, 1):
22
- if encoding.match(lines[ix]):
23
- lines.pop(ix)
+ if encoding.match(lines[0]):
+ lines.pop(0)
24
+ elif encoding.match(lines[1]):
25
+ lines.pop(1)
26
27
context = dict(
28
__name__='__main__',
0 commit comments