aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/04_WorkingWithFiles.md
blob: 4a941a40d9cd4be834401ff1fb94cc301d0543ca (plain)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# Working with Files

## Buffers

One of the first things notably absent when opening multiple files in Textadept
is the lack of a tab bar showing the open files. This design decision allowed
Textadept to support unlimited split views from the very beginning. Having a
single tab bar for multiple views causes confusion and having one tab bar per
view clutters the interface.

Instead of having tabs, Textadept has the buffer browser. Press `Ctrl+B` (`⌘B`
on Mac OSX | `M-B` or `M-S-B` in curses) to open it.

![Buffer Browser](images/bufferbrowser.png)

The buffer browser displays a list of currently open buffers, the most recent
towards the bottom. Typing part of any filename filters the list. Spaces are
wildcards. The arrow keys move the selection up and down. Pressing `Enter`,
selecting `OK`, or double-clicking a buffer in the list switches to the selected
buffer.

![Buffer Browser Filtered](images/bufferbrowserfiltered.png)

Textadept shows the name of the active buffer in its titlebar. Pressing
`Ctrl+Tab` (`^⇥` on Mac OSX | `M-N` in curses) cycles to the next buffer and
`Ctrl+Shift+Tab` (`^⇧⇥` | `M-P`) cycles to the previous one.

### Settings

Individual files have three configurable settings: indentation, line endings,
and encoding. Indentation consists of an indentation character and an
indentation size. Line endings are the characters that separate lines. File
encoding specifies how to display text characters. Textadept shows these
settings in the buffer status statusbar.

![Document Statusbar](images/docstatusbar.png)

#### Indentation

Normally, a [language module][] or the [user settings][] dictate a buffer's
indentation settings. By default, indentation is 2 spaces. Pressing
`Ctrl+Alt+Shift+T` (`^⇧T` on Mac OSX | `M-T` or `M-S-T` in curses) manually
toggles between using tabs and spaces, although this only affects future
indentation. Existing indentation remains unchanged. `Ctrl+Alt+I` (`^I` | `M-I`)
performs the conversion. (If the buffer uses tabs, all indenting spaces convert
to tabs. If the buffer uses spaces, all indenting tabs convert to spaces.)
Similarly, the "Buffer -> Indentation" menu manually sets indentation size.

[language module]: 07_Modules.html#Buffer.Properties
[user settings]: 08_Preferences.html#Buffer.Properties

#### Line Endings

Textadept determines which default line endings, commonly known as end-of-line
(EOL) markers, to use based on the current platform. On Windows it is CRLF
("\r\n"). On all other platforms it is LF ('\n'). Textadept first tries to
auto-detect the EOL mode of opened files before falling back on the platform
default. The "Buffer -> EOL Mode" menu manually changes line endings and, unlike
indentation settings, automatically converts all existing EOLs.

#### Encodings

Textadept has the ability to decode files encoded in many different encodings,
but by default it only attempts to decode UTF-8, ASCII, ISO-8859-1, and
MacRoman. If you work with files with encodings Textadept does not recognize,
add those encodings to [`io.encodings`][] in your [preferences][].

UTF-8 is the recommended file encoding because of its wide support by other text
editors and operating systems. The "Buffer -> Encoding" menu changes the file
encoding and performs the conversion. Textadept saves new files as UTF-8 by
default, but does not alter the encoding of existing ones.

[`io.encodings`]: api/io.html#encodings
[preferences]: 08_Preferences.html

### Recent Files

Pressing `Ctrl+Alt+O` (`^⌘O` on Mac OSX | `M-^O` in curses) brings up a dialog
that behaves like the buffer browser, but displays a list of recently opened
files to reopen.

### Sessions

By default, Textadept saves its state when quitting in order to restore it the
next time the editor starts up. Passing the `-n` or `--nosession` switch to
Textadept on startup disables this feature. The "File -> Save Session..." and
"File -> Load Session..." menus manually save and open sessions while the `-s`
and `--session` switches load a session on startup. The switches accept the path
of a session file or the name of a session in *~/.textadept/*. Session files
store information such as open buffers, current split views, caret and scroll
positions in each buffer, Textadept's window size, and recently opened files.
Tampering with session files may have unintended consequences.

### Snapopen

A quicker, though slightly more limited alternative to the standard file
selection dialog is snapopen. It too behaves like the buffer browser, but
displays a list of files to open, including files in sub-directories. Pressing
`Ctrl+Alt+Shift+O` (`^⌘⇧O` on Mac OSX | `M-S-O` in curses) snaps open the
current file's directory and `Ctrl+U` (`⌘U` | `^U`) snaps open *~/.textadept/*.
Snapopen is pretty limited from the "Tools -> Snapopen" menu, but more versatile
in [scripts][].

[scripts]: api/io.html#snapopen

![Snapopen](images/snapopen.png)

## Views

### Split Views

Textadept allows you to split the editor window an unlimited number of times
both horizontally and vertically. `Ctrl+Alt+S` or `Ctrl+Alt+H` splits
horizontally into top and bottom views and `Ctrl+Alt+V` splits vertically (`^S`
and `^V` respectively on Mac OSX | N/A in curses) into side-by-side views.
Clicking and dragging on the splitter bar with the mouse or pressing
`Ctrl+Alt++` and `Ctrl+Alt+-` (`^+` and `^-` | N/A) resizes the split. Textadept
supports viewing a single buffer in two or more views.

Pressing `Ctrl+Alt+N` (`^⌥⇥` on Mac OSX | N/A in curses) jumps to the next view
and `Ctrl+Alt+P` (`^⌥⇧⇥` | N/A) jumps the previous one. However, depending on
the split sequence, the order when cycling between views may not be linear.

To unsplit a view, enter the view to keep open and press `Ctrl+Alt+W` (`^W` on
Mac OSX | N/A in curses). To unsplit all views, use `Ctrl+Alt+Shift+W` (`^⇧W` |
N/A).

Textadept curses does not support split views.

### Settings

Individual views have many configurable settings. Among the more useful settings
are viewing line endings, handling long lines, viewing indentation guides, and
viewing whitespace. These options change how to display buffers in the _current_
view. Changing a setting in one view does not change that setting in
any other split view. You must do it manually.

#### Line Endings

Normally, EOL characters ("\r" and "\n") are invisible. Pressing
`Ctrl+Alt+Enter` (`^↩` on Mac OSX | none in curses) toggles their visibility.

#### Long Lines

By default, lines with more characters than the view can show do not wrap into
view. `Ctrl+Alt+\` (`^\` on Mac OSX | none in curses) toggles line wrapping.

#### Indentation Guides

Views show small guiding lines based on indentation level by default.
`Ctrl+Alt+Shift+I` (`^⇧I` on Mac OSX | N/A in curses) toggles the visibility of
these guides.

Textadept curses does not support indentation guides.

#### Whitespace

Normally, whitespace characters, tabs and spaces, are invisible. Pressing
`Ctrl+Alt+Shift+S` (`^⇧S` on Mac OSX | none in curses) toggles their visibility.
Visible spaces show up as dots and visible tabs show up as arrows.

### Zoom

To temporarily increase or decrease the font size in a view, press `Ctrl+=`
(`⌘=` on Mac OSX | N/A in curses) and `Ctrl+-` (`⌘-` | N/A) respectively.
`Ctrl+0` (`⌘0` | N/A) resets the zoom.

Textadept curses does not support zooming.