forked from robert-hh/Micropython-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.txt
More file actions
145 lines (134 loc) · 8.83 KB
/
help.txt
File metadata and controls
145 lines (134 loc) · 8.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
The editor works in Insert mode. Cursor Keys, Home, End, PgUp and PgDn work
as you would expect. Some functions are available with Ctrl-Keys. Keyboard Mapping:
Key Alternative Function
--------------------------------------------------------------------------
Up Move the cursor up one line.
Down Move the cursor down one line.
Left Move the cursor left by one char;
skipping over to the previous line at the BOL. (*)
Right Move the cursor right by one char;
skipping over to the next line at the EOL. (*)
PgUp Move the cursor up by one screen height.
PgDn Move the cursor down by one screen height.
Home Go to start-of-line, if the Cursor is at start-of-text.
Otherwise go to start-of-text.
End Move to the end-of-line.
Mouse Button 1 Set the cursor.
Mouse Button 2 Set/Clear the line mark.
Mouse Scroll Wheel Scroll Up/Down the screen content by 3 lines per tick.
The cursor stays visible and will be moved in the content
if required.
Enter \n Insert a line break at the cursor position.
Auto-indent is supported.
Backspc. Delete the char left hand to the cursor. If the mark
is set, delete the marked line range.
At the beginning of the line Backspace joins the
previous line. (*)
Del Delete char under cursor. At the end of the line join the
next line. If the mark is set, delete the marked line range.
If Autoindent is enabled, Del at the line's end also removes
leading spaces from the then joined line.
Tab Ctrl-I Tab. Insert spaces at the cursor position up to the next
tab location, moving the cursor. If the mark is set, indent
the lines between the mark and cursor.
BackTab Ctrl-U Back Tab. Remove spaces left to the cursor position up to
the next tab location or the next non-space char, and moves
the cursor. If the mark is set, un-indent the lines
between the mark and the cursor.
Ctrl-Q Quit a file buffer or the line edit mode. If the edited text
was changed, ask for confirmation. If the last buffer is
closed, the editor will terminate too.
Ctrl-S Save to file. The file name will be prompted for. The
content will be written to a temporary file (“tmpfile.pye”)
first and then this will be renamed. If the target file
name is invalid, the original file is lost, but
“tmpfile.pye” will have its content.
Ctrl-E Redraw the screen according to the actual screen parameters
width, height. With MicroPython, as a side effect, garbage
collection is performed and the available memory is shown.
With Linux/CPython, window size changes result in an
automatic redraw.
Ctrl-F Find text. The last search string is memorized, even across
buffers. Search stops at the end. Whether the search is
case sensitive or not, can be set by the Ctrl-A command.
Ctrl-N Repeat find starting at the column right to the cursor.
Ctrl-H Ctrl-R Find and replace. If the mark is set, it affects the marked
region only.
Ctrl-G Go to Line. It prompts for the line number.
Ctrl-B Ctrl-End Go to the last line (*)
Ctrl-T Ctrl-Home Go to the first line (*)
Ctrl-K Go to the matching bracket, if any. The cursor has to be on
a bracket symbol. Bracket pairs are (), [], {} and <>.
Brackets in comments and strings are not discarded.
Ctrl-A Settings. Sets the state of auto-indent, search case
sensitivity, tab size, comment string and write-tabs.
Enter ‘y’ or ‘n’ or a number in up to five, comma separated
fields (e.g. n,y,4,# ,n). An empty field leaves the respective value
unchanged. The default values are auto-indent: y,
case sensitive: n, tab-size: 4, Comment string: #, Write Tabs: n
Ctrl-L Mark/Unmark the current line. The mark affects Delete,
Backspace, Cut lines, Copy lines, Insert lines, Tab,
Backtab, Save and Replace.
Ctrl-X Ctrl-Y Delete the area between the mark and the current line and
keep it in the paste buffer. Together with the Ctrl-V this
implements the Cut & Paste feature. The mark is cleared.
Ctrl-C Ctrl-D Copy the area between the mark and the current line to the
paste buffer. Together with the Ctrl-V this implements the
Copy & Paste feature. The mark is cleared on copy.
Ctrl-V Insert the content of the paste buffer before the actual
line. If the mark is set, delete the marked area first. In
line edit mode, Ctrl-V copies & insert symbol under the cursor.
Ctrl-W Switch to the next file buffer.
Ctrl-O Open a new file buffer. The file name will be prompted for.
If the name is left empty, an empty buffer will be opened.
If the file cannot be loaded (e.g. because it does not
exist), a buffer with that name will still be opened, but
will be empty. If the name entered belongs to a directory,
the sorted list of file names in that directory will be
returned.
Ctrl-P Comment/Uncomment a line or marked area. The default for
the comment Character is # , but can be changed with the
Ctrl-A settings
Ctrl-Z Undo the last change(s). Every char add sequence/deleted
char sequence/replaced item/deleted line/inserted
line(s)/indent sequence/Un-indent sequence counts as a
single change. The default for the undo stack size per
buffer is 50 with PyBoard/WiPy and 500 with Linux/Darwin
systems. It can be changed in the call to pye().
---------------------------------------------------------------------------------
Functions denoted with (*) are not supported in the minimal version.
The editor is contained in the file pye.py. Start pye from the REPL
prompt e.g. with
from pye import pye
res = pye(object_1, object_2, ..[, tabsize][, undo])
If object_n is a string, it's considered as the name of a file to be edited,
and the name of the file will be returned. If object_n is a list of strings,
these will be edited, and the edited list will be returned. If no object is
named, pye() will give you an empty screen, creating a list of strings,
unless you save to a file. In that case, the file name will be returned. If
object_n is neither a string nor a list of strings, an empty buffer is
opened. It is always the last buffer closed, which will be returned.
Optional named parameters:
tabsize=n Tab step (integer). The default is 4
undo=n Size of the undo stack (integer). A value of 0 or False disables
undo.
The Linux/Darwin version can be called from the command line with:
python3 pye.py [filename(s)]
Obviously, you may use micropython too. Using python3 (not micropython),
content can also be redirected or pipe'd into the editor.
When reading files, tab characters (\x09) in the text are replaced by spaces,
tab size 8, and white space at the end of a line is discarded. When you save
the file, you have the option to replace sequences of spaces by tabs, tab size
8. When during reading the files tabs are detected, the tab write option is
set to y. However, the original state will NOT be restored. So be careful
when editing files with tab characters.
The size of a file that can be edited on a MicroPthon board is limited by its memory.
You may use REDRAW to determine how much space is left. Besides the file
itself, both buffer operations and especially undo consume memory. The undo
stack can be limited in the call to pye, the buffer size can be reduced again
by copying a single line into it. Up to about 200 lines on ESP8266 and 600 lines
on PyBoard should be safe to edit. The largest suitable file size is in the
same order of what can be handled as source file.
When you save a file on PyBoard, these changes may not be visible in the
file system of a connected PC until you disconnect and reconnect the
Pyboard drive. See also the related discussion in the MicroPython Forum.