/jEdit/tags/jedit-4-0-pre3/doc/users-guide/text-edit.xml

# · XML · 974 lines · 971 code · 1 blank · 2 comment · 0 complexity · 747d4c8d0990dde51fc94f6829b5be4b MD5 · raw file

  1. <!-- jEdit buffer-local properties: -->
  2. <!-- :tabSize=1:indentSize=1:noTabs=true: -->
  3. <chapter id="editing"><title>Editing Text</title>
  4. <sect1 id="caret"><title>Moving The Caret</title>
  5. <para>
  6. The most direct way to move the caret is to click the
  7. mouse at the desired location in the text area. It can also be moved
  8. using the keyboard.
  9. </para>
  10. <para>
  11. The <keycap>Left</keycap>, <keycap>Right</keycap>, <keycap>Up</keycap> and
  12. <keycap>Down</keycap> keys move the caret in the respective direction, and
  13. the <keycap>Page Up</keycap> and <keycap>Page Down</keycap> keys move the
  14. caret up and down one screenful, respectively.
  15. </para>
  16. <para>
  17. When pressed once, the <keycap>Home</keycap> key moves the caret to the first
  18. non-whitespace character of the current line. Pressing it a second time
  19. moves the caret to the beginning of the line. Pressing it a third time
  20. moves the caret to the first visible line.
  21. </para>
  22. <para>
  23. The <keycap>End</keycap> key behaves in a
  24. similar manner, going to the last non-whitespace character, the end of
  25. the line, and finally to the last visible line.
  26. </para>
  27. <para>
  28. If there is a selection, <keycap>Home</keycap> and <keycap>End</keycap>
  29. behave the same as above, except that instead of operating on the current
  30. line, they move the caret to the first and last lines of the selection,
  31. respectively.
  32. </para>
  33. <para>
  34. <keycombo><keycap>Control</keycap><keycap>Home</keycap></keycombo> and
  35. <keycombo><keycap>Control</keycap><keycap>End</keycap></keycombo> move the
  36. caret to the beginning and end of the buffer.
  37. </para>
  38. <para>
  39. More advanced caret movement is covered in
  40. <xref linkend="words" />, <xref linkend="lines" /> and
  41. <xref linkend="paragraphs" />.
  42. </para>
  43. </sect1>
  44. <sect1 id="selection"><title>Selecting Text</title>
  45. <para>
  46. A <firstterm>selection</firstterm> is a a block of text marked for further
  47. manipulation. Unlike many other applications, jEdit supports both
  48. range and rectangular selections, and several chunks of text can be
  49. selected simultaneously.
  50. </para>
  51. <para>
  52. Dragging the mouse creates a range selection from where the mouse was
  53. pressed to where it was released.
  54. Holding down <keycap>Shift</keycap> while clicking a location in the
  55. buffer will create a selection from the caret position to the clicked
  56. location.
  57. </para>
  58. <para>
  59. Holding down <keycap>Shift</keycap> in addition to a caret movement key
  60. (<keycap>Left</keycap>, <keycap>Up</keycap>, <keycap>Home</keycap>, etc) will
  61. extend the selection in the specified direction. If no selection exists, one
  62. will be created.
  63. </para>
  64. <para>
  65. <guimenu>Edit</guimenu>&gt;<guimenuitem>Select All</guimenuitem> (shortcut:
  66. <keycombo><keycap>Control</keycap><keycap>A</keycap></keycombo>) selects the
  67. entire buffer.
  68. </para>
  69. <para>
  70. <guimenu>Edit</guimenu>&gt;<guimenuitem>Select None</guimenuitem> (shortcut:
  71. <keycap>Escape</keycap>) deactivates the selection.
  72. </para>
  73. <sect2><title>Rectangular Selection</title>
  74. <para>
  75. Holding down <keycap>Control</keycap> and dragging will create a rectangular
  76. selection. Holding down
  77. <keycap>Shift</keycap> and <keycap>Control</keycap> while clicking a location in
  78. the buffer will create a rectangular selection from the caret position to
  79. the clicked location.
  80. </para>
  81. <para>
  82. It is possible to select a rectangle with zero width but non-zero height.
  83. This can be used to insert a new column between two existing
  84. columns, for example. Such zero-width selections are shown as a thin
  85. vertical line.
  86. </para>
  87. <para>
  88. Rectangles can be deleted, copied, pasted, and operated on using ordinary
  89. editing commands.
  90. </para>
  91. <note>
  92. <para>
  93. Rectangular selections are implemented using character offsets,
  94. not absolute screen positions, so they might not behave as you might
  95. expect if a proportional-width font is being used, or hard tabs are
  96. enabled. For information about changing the font used in the text
  97. area, see <xref linkend="global-opts" />. For more information about
  98. hard and soft tabs, see <xref linkend="soft-tabs" />.
  99. </para>
  100. </note>
  101. </sect2>
  102. <sect2 id="multi-select"><title>Multiple Selection</title>
  103. <para>
  104. Pressing <keycombo><keycap>Control</keycap> <keycap>\</keycap></keycombo>
  105. turns multiple selection mode on and
  106. off. In multiple selection mode, multiple fragments of text can be selected
  107. and operated on simultaneously, and the text <literal>multi</literal> is shown
  108. in the status bar.
  109. </para>
  110. <para>
  111. While multiple selection mode is active, you can click and drag the mouse
  112. to reposition the caret and create new selections.
  113. </para>
  114. <para>
  115. Various jEdit commands behave differently with multiple selections:
  116. </para>
  117. <itemizedlist>
  118. <listitem><para>Commands that copy text place the contents of
  119. each selection, separated by line breaks, in the specified register. Note
  120. that the selections are appended in the order they were created, not the
  121. order they appear in the buffer. For example, if you select a chunk of
  122. text near the end of the buffer, another near the beginning, then invoke
  123. <guimenuitem>Copy</guimenuitem>, the clipboard will contain the later chunk,
  124. followed by a line break, followed by the earlier chunk.
  125. </para></listitem>
  126. <listitem><para>Commands that insert (or paste) text replace each selection
  127. with the entire text that is being inserted.</para></listitem>
  128. <listitem><para>Commands that filter text (such as <guimenuitem>Spaces to
  129. Tabs</guimenuitem>, <guimenuitem>Range Comment</guimenuitem>, and even
  130. <guimenuitem>Replace in Selection</guimenuitem>) operate on each selection,
  131. in turn.</para></listitem>
  132. <listitem><para>Line-based commands (such as <guimenuitem>Shift Indent
  133. Left</guimenuitem>, <guimenuitem>Shift Indent Right</guimenuitem>, and
  134. <guimenuitem>Line Comment</guimenuitem>) operate on each line that contains
  135. at least one selection, in addition to the line containing the caret.
  136. </para></listitem>
  137. <listitem><para>Caret movement commands that would normally deactivate the
  138. selection (such as the arrow keys, while <keycap>Shift</keycap> is not being
  139. held down), move the caret, leaving the selection as-is.</para></listitem>
  140. <listitem><para>Some older plugins may not support multiple selection at
  141. all.</para></listitem>
  142. </itemizedlist>
  143. <para>
  144. <guimenu>Edit</guimenu>&gt;<guimenuitem>Invert Selection</guimenuitem>
  145. (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  146. <keycap>I</keycap>) selects a set of text chunks such that all text
  147. that was formely part of a selection is now unselected, and all text that
  148. wasn't, is selected.
  149. </para>
  150. <tip>
  151. <para>
  152. Deactivating multiple selection
  153. mode while a fragmented selection exists will leave the selection in place,
  154. but it will prevent you from making further fragmented selections.
  155. </para>
  156. </tip>
  157. </sect2>
  158. </sect1>
  159. <sect1 id="entering-text"><title>Inserting and Deleting Text</title>
  160. <para>
  161. Text entered at the keyboard is inserted into the buffer. If
  162. overwrite mode is on, one character is deleted from in
  163. front of the caret position for every character that is inserted.
  164. To activate overwrite mode, press <keycap>Insert</keycap>. The caret is
  165. drawn as horizontal line while in overwrite
  166. mode; the text <literal>ovr</literal> also appears in the status bar.
  167. </para>
  168. <para>
  169. Inserting text while there is a selection will replace the selection
  170. with the inserted text.
  171. </para>
  172. <para>
  173. Inserting text at the end of a line beyond the wrap column will
  174. automatically break the line
  175. at the appropriate word boundary. The wrap column is indicated in the
  176. text area as a faint blue line and its location (specified in number of
  177. character positions from the left margin) can be changed in one of
  178. several ways:
  179. </para>
  180. <itemizedlist>
  181. <listitem><para>On a global or mode-specific
  182. basis in the
  183. <guibutton>Editing</guibutton> and <guibutton>Mode-Specific</guibutton> panes
  184. of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem>
  185. dialog box; see <xref linkend="global-opts" />.</para></listitem>
  186. <listitem><para>In the current buffer
  187. for the duration of the editing session in the
  188. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Buffer Options</guimenuitem>
  189. dialog box; see <xref linkend="buffer-opts" />.
  190. </para></listitem>
  191. <listitem><para>In the current buffer
  192. for future editing sessions by placing
  193. the following in one of the first 10 lines of the buffer, where
  194. <replaceable>column</replaceable> is the desired wrap column position:
  195. </para>
  196. <screen>:maxLineLen=<replaceable>column</replaceable>:</screen>
  197. </listitem>
  198. </itemizedlist>
  199. <para>
  200. To disable word wrap completely, set the wrap column to 0 using any of the
  201. above means.
  202. </para>
  203. <note>
  204. <para>
  205. Word wrap is implemented using character offsets, not screen
  206. positions, so it might not behave like you expect if a
  207. proportional-width font is being used. For information about
  208. changing the font used in the text area, see <xref linkend="global-opts" />.
  209. </para>
  210. </note>
  211. <para>
  212. When inserting text, keep in mind that the <keycap>Tab</keycap> and
  213. <keycap>Enter</keycap> keys might
  214. not behave entirely like you expect because of various indentation
  215. features; see <xref linkend="indent" /> for details.
  216. </para>
  217. <para>
  218. The simplest way to delete text is with the
  219. <keycap>Backspace</keycap> and <keycap>Delete</keycap> keys. If nothing is
  220. selected, they delete the character before or after the caret,
  221. respectively. If a selection exists, both delete the
  222. selection.
  223. </para>
  224. <para>
  225. More advanced deletion commands are described in
  226. <xref linkend="words" />, <xref linkend="lines" /> and
  227. <xref linkend="paragraphs" />.
  228. </para>
  229. </sect1>
  230. <sect1 id="undo-redo"><title>Undo and Redo</title>
  231. <para>
  232. <guimenu>Edit</guimenu>&gt;<guimenuitem>Undo</guimenuitem> (shortcut:
  233. <keycombo><keycap>Control</keycap><keycap>Z</keycap></keycombo>) undoes the
  234. effects of the most recent text editing command. For example, this can be
  235. used to restore unintentionally deleted text. More complicated operations,
  236. such as a search and replace, can also be undone. By default, the undo
  237. queue remembers the last 100 edits; older edits are discarded.
  238. The undo queue size can be changed in the <guibutton>Editing</guibutton> pane
  239. of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  240. Options</guimenuitem> dialog box.
  241. </para>
  242. <para>
  243. <guimenu>Edit</guimenu>&gt;<guimenuitem>Redo</guimenuitem> (shortcut:
  244. <keycombo><keycap>Control</keycap><keycap>R</keycap></keycombo>) goes forward
  245. in the undo queue, redoing changes which were undone. For example, if some
  246. text was inserted, <guimenuitem>Undo</guimenuitem> will remove it from the
  247. buffer. <guimenuitem>Redo</guimenuitem> will insert it again.
  248. </para>
  249. </sect1>
  250. <sect1 id="words"><title>Working With Words</title>
  251. <para>
  252. Holding down <keycap>Control</keycap> in addition to <keycap>Left</keycap> or
  253. <keycap>Right</keycap> moves the caret a word at
  254. a time. Holding down <keycap>Shift</keycap> and <keycap>Control</keycap>
  255. in addition to <keycap>Left</keycap> or <keycap>Right</keycap>
  256. extends the selection a word at a time.
  257. </para>
  258. <para>
  259. A single word can be selected by double-clicking with the mouse,
  260. or using the
  261. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Select
  262. Word</guimenuitem> command (shortcut:
  263. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo> <keycap>W</keycap>).
  264. A selection that begins and ends on word boundaries can be created by
  265. double-clicking and dragging.
  266. </para>
  267. <para>
  268. Pressing <keycap>Control</keycap> in addition to
  269. <keycap>Backspace</keycap> or <keycap>Delete</keycap> deletes the word
  270. before or after the caret, respectively.
  271. </para>
  272. <para>
  273. <guimenu>Edit</guimenu>&gt;<guimenuitem>Word Count</guimenuitem>
  274. displays a dialog box with the number of characters,
  275. words and lines in the current buffer.
  276. </para>
  277. <para>
  278. <guimenu>Edit</guimenu>&gt;<guimenuitem>Complete Word</guimenuitem> (shortcut:
  279. <keycombo><keycap>Control</keycap><keycap>B</keycap></keycombo>) searches the
  280. current buffer for possible completions of the current word.
  281. This feature be used to avoid retyping
  282. previously entered identifiers in program source, for example.
  283. </para>
  284. <para>
  285. If there is only one completion, it will be inserted into the buffer
  286. immediately.
  287. If multiple completions were found, they will be listed in a popup below
  288. the caret position. To insert a completion from the list, either click it
  289. with the mouse,
  290. or select it using the <keycap>Up</keycap> and <keycap>Down</keycap> keys and
  291. press <keycap>Enter</keycap>. To close the popup without inserting a
  292. completion, press <keycap>Escape</keycap>.
  293. </para>
  294. </sect1>
  295. <sect1 id="lines"><title>Working With Lines</title>
  296. <para>
  297. An entire line can be selected by triple-clicking with the mouse,
  298. or using the
  299. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Select
  300. Line</guimenuitem> command (shortcut:
  301. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo> <keycap>L</keycap>).
  302. A selection that begins and ends on line boundaries can be created
  303. by triple-clicking and dragging.
  304. </para>
  305. <para>
  306. <guimenu>Edit</guimenu>&gt;<guimenuitem>Go to Line</guimenuitem> (shortcut:
  307. <keycombo><keycap>Control</keycap><keycap>L</keycap></keycombo>) displays an
  308. input dialog box and moves the caret to the specified line number.
  309. </para>
  310. <para>
  311. <guimenu>Edit</guimenu>&gt;<guimenuitem>Select Line Range</guimenuitem>
  312. (shortcut
  313. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  314. <keycombo><keycap>Control</keycap><keycap>L</keycap></keycombo>)
  315. selects all text between between two specified line numbers, inclusive.
  316. </para>
  317. <para>
  318. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Join
  319. Lines</guimenuitem> (shortcut:
  320. <keycombo><keycap>Control</keycap><keycap>J</keycap></keycombo>)
  321. removes any whitespace from the start of the next line and joins it with
  322. the current line. For example, invoking <guimenuitem>Join Lines</guimenuitem>
  323. on the first line of the following Java code:
  324. </para>
  325. <screen>new Widget(Foo
  326. .createDefaultFoo());</screen>
  327. <para>
  328. Will change it to:
  329. </para>
  330. <screen>new Widget(Foo.createDefaultFoo());</screen>
  331. <para>
  332. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  333. Line</guimenuitem>
  334. (shortcut: <keycombo><keycap>Control</keycap><keycap>D</keycap></keycombo>)
  335. deletes the current line.
  336. </para>
  337. <para>
  338. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  339. to Start Of Line</guimenuitem>
  340. (shortcut:
  341. <keycombo><keycap>Shift</keycap><keycap>Backspace</keycap></keycombo>)
  342. deletes all text from the start of the current line to the caret.
  343. </para>
  344. <para>
  345. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  346. to End Of Line</guimenuitem>
  347. (shortcut:
  348. <keycombo><keycap>Shift</keycap><keycap>Delete</keycap></keycombo>) deletes
  349. all text from the caret to the end of the current line.
  350. </para>
  351. <para>
  352. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Remove
  353. Trailing Whitespace</guimenuitem>
  354. (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  355. <keycap>R</keycap>) removes all whitespace from the end of each selected line, or
  356. the current line if there is no selection.
  357. </para>
  358. </sect1>
  359. <sect1 id="paragraphs"><title>Working With Paragraphs</title>
  360. <para>
  361. As far as jEdit is concerned, <quote>paragraphs</quote> are delimited by
  362. double newlines. This is also how <application>TeX</application>
  363. defines a paragraph. Note that jEdit doesn't parse HTML files for
  364. <quote>&lt;P&gt;</quote> tags, nor does it support paragraphs delimited only
  365. by a leading indent.
  366. </para>
  367. <para>
  368. Holding down <keycap>Control</keycap> in addition to <keycap>Up</keycap>
  369. or <keycap>Down</keycap>
  370. moves the caret to the previous and next paragraph, respectively.
  371. As with other caret movement commands, holding down <keycap>Shift</keycap>
  372. in addition to the above
  373. extends the selection, a paragraph at a time.
  374. </para>
  375. <para>
  376. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Select
  377. Paragraph</guimenuitem> (shortcut:
  378. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  379. <keycap>P</keycap>)
  380. selects the paragraph containing the caret.
  381. </para>
  382. <para>
  383. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Delete
  384. Paragraph</guimenuitem> (shortcut:
  385. <keycombo><keycap>Control</keycap><keycap>E</keycap>
  386. </keycombo> <keycap>D</keycap>)
  387. deletes the paragraph containing the caret.
  388. </para>
  389. <para>
  390. <guimenu>Edit</guimenu>&gt;<guisubmenu>Text</guisubmenu>&gt;<guimenuitem>Format
  391. Paragraph</guimenuitem> (shortcut:
  392. <keycombo><keycap>Control</keycap><keycap>E</keycap>
  393. </keycombo> <keycap>F</keycap>) splits and joins lines in the current
  394. paragraph to make them fit within the wrap column position. See
  395. <xref linkend="entering-text" /> for information and word wrap and
  396. changing the wrap column.
  397. </para>
  398. </sect1>
  399. <sect1 id="scrolling"><title>Scrolling</title>
  400. <para>
  401. <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Scroll to
  402. Current Line</guimenuitem> (shortcut:
  403. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  404. <keycombo><keycap>Control</keycap><keycap>J</keycap></keycombo>) centers the
  405. line containing the caret on the screen.
  406. </para>
  407. <para>
  408. <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Center Caret
  409. on Screen</guimenuitem> (shortcut:
  410. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  411. <keycombo><keycap>Control</keycap><keycap>I</keycap></keycombo>)
  412. moves the caret to the
  413. line in the middle of the screen.
  414. </para>
  415. <para>
  416. <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Line
  417. Scroll Up</guimenuitem> (shortcut:
  418. <keycombo><keycap>Control</keycap><keycap>'</keycap></keycombo>)
  419. scrolls the text area up by one line.
  420. </para>
  421. <para>
  422. <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Line
  423. Scroll Down</guimenuitem> (shortcut:
  424. <keycombo><keycap>Control</keycap><keycap>/</keycap></keycombo>) scrolls the
  425. text area down by one line.
  426. </para>
  427. <para>
  428. <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Page
  429. Scroll Up</guimenuitem> (shortcut:
  430. <keycombo><keycap>Alt</keycap><keycap>'</keycap></keycombo>) scrolls the text
  431. area up by one screenful.
  432. </para>
  433. <para>
  434. <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Page
  435. Scroll Down</guimenuitem> (shortcut:
  436. <keycombo><keycap>Alt</keycap><keycap>/</keycap></keycombo>) scrolls the text
  437. area down by one screenful.
  438. </para>
  439. <para>
  440. The above scrolling commands differ from the caret movement commands
  441. in that they don't actually move the caret; they just change the
  442. scroll bar position.
  443. </para>
  444. <para>
  445. <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Synchronized
  446. Scrolling</guimenuitem> is a check box menu item, that if selected,
  447. forces scrolling performed in one text area to be propagated to all
  448. other text areas in the current view. Invoking the command a second
  449. time disables the feature.
  450. </para>
  451. </sect1>
  452. <sect1 id="text-transfer"><title>Transferring Text</title>
  453. <para>
  454. jEdit provides a rich set of commands for moving and copying text
  455. using <firstterm>registers</firstterm>. A register is a holding
  456. area with a single-character name that can hold once piece of text at a time.
  457. Registers are global to the editor; all buffers share the same set. With the
  458. exception of the clipboard, register contents are only accessable inside
  459. jEdit.
  460. </para>
  461. <para>
  462. jEdit has three sets of commands for working with registers.
  463. The <quote>quick copy</quote> and system clipboard features allow easy
  464. access to two specific registers. A third set of commands allows access to
  465. all other registers.
  466. </para>
  467. <sect2><title>Quick Copy</title>
  468. <para>
  469. Holding down the <keycap>Alt</keycap> key and clicking the left mouse button
  470. in the text area inserts the most recently
  471. selected text at the clicked location. If you have a three-button mouse, you
  472. can simply click the middle mouse button, without holding down
  473. <keycap>Alt</keycap>.
  474. </para>
  475. <para>
  476. Internally, this is implemented by storing the most recently selected text
  477. in the <filename>%</filename> register (recall that registers have
  478. single-character names).
  479. </para>
  480. <sidebar><title>X Windows primary selection</title>
  481. <para>
  482. If jEdit is being run under Java 2 version 1.4 on Unix, you will be
  483. able to transfer text with other X Windows applications using the
  484. quick copy feature. On other platforms and Java versions, the contents
  485. of the quick copy register are only accessable from within jEdit.
  486. </para>
  487. </sidebar>
  488. </sect2>
  489. <sect2><title>The System Clipboard</title>
  490. <para>
  491. Quick copy is very useful in many situations, but it has a number of
  492. drawbacks; it requires the use of the mouse, it cannot be used to replace an
  493. existing selection, and it cannot be used to transfer text between different
  494. applications (unless you are using Java 2 version 1.4 on Unix).
  495. </para>
  496. <para>
  497. The system clipboard, internally known as the <filename>$</filename>
  498. register, does not have these limitations, but can be slightly less
  499. convinient to use.
  500. </para>
  501. <para>
  502. <guimenu>Edit</guimenu>&gt;<guimenuitem>Cut</guimenuitem>
  503. (shortcut: <keycombo><keycap>Control</keycap><keycap>X</keycap></keycombo>)
  504. places the selected text in the clipboard and removes it from the buffer.
  505. </para>
  506. <para>
  507. <guimenu>Edit</guimenu>&gt;<guimenuitem>Copy</guimenuitem>
  508. (shortcut: <keycombo><keycap>Control</keycap><keycap>C</keycap></keycombo>)
  509. places the selected text in the clipboard and leaves it in the buffer.
  510. </para>
  511. <para>
  512. <guimenu>Edit</guimenu>&gt;<guimenuitem>Cut Append</guimenuitem>
  513. (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  514. <keycombo><keycap>Control</keycap><keycap>U</keycap></keycombo>)
  515. appends the selected text to the clipboard, then removes it from the
  516. buffer. After this command has been invoked, the clipboard will consist of
  517. the former clipboard contents, followed by a newline, followed by the
  518. selected text.
  519. </para>
  520. <para>
  521. <guimenu>Edit</guimenu>&gt;<guimenuitem>Copy Append</guimenuitem>
  522. (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  523. <keycombo><keycap>Control</keycap><keycap>A</keycap></keycombo>)
  524. appends the selected text to the clipboard, and leaves it in the
  525. buffer. After this command has been invoked, the clipboard will consist of
  526. the former clipboard contents, followed by a newline, followed by the
  527. selected text.
  528. </para>
  529. <para>
  530. <guimenu>Edit</guimenu>&gt;<guimenuitem>Paste</guimenuitem>
  531. (shortcut: <keycombo><keycap>Control</keycap><keycap>V</keycap></keycombo>)
  532. inserts the clipboard contents in place of the selection (or at the
  533. caret position, if there is no selection).
  534. </para>
  535. </sect2>
  536. <sect2><title>General Register Commands</title>
  537. <para>
  538. These commands are slightly less convinient to use than the two methods of
  539. transferring text described above, but have the advantage that they allow
  540. any number of strings to be copied simultaneously.
  541. </para>
  542. <para>
  543. These commands all expect a single-character
  544. register name to be typed at the keyboard after the command is
  545. invoked, and subsequently operate on that register.
  546. Pressing <keycap>Escape</keycap> instead of specifying a register name
  547. will cancel the operation.
  548. </para>
  549. <para>
  550. <guimenu>Edit</guimenu>&gt;<guisubmenu>Registers</guisubmenu>&gt;<guimenuitem>Cut
  551. to Register</guimenuitem>
  552. (shortcut: <keycombo><keycap>Control</keycap><keycap>R</keycap></keycombo>
  553. <keycombo><keycap>Control</keycap><keycap>X</keycap></keycombo>
  554. <keycap><replaceable>key</replaceable></keycap>)
  555. stores the selected text in the specified
  556. register, removing it from the buffer.
  557. </para>
  558. <para>
  559. <guimenu>Edit</guimenu>&gt;<guisubmenu>Registers</guisubmenu>&gt;<guimenuitem>Copy
  560. to Register</guimenuitem>
  561. (shortcut: <keycombo><keycap>Control</keycap><keycap>R</keycap></keycombo>
  562. <keycombo><keycap>Control</keycap><keycap>C</keycap></keycombo>
  563. <keycap><replaceable>key</replaceable></keycap>)
  564. stores the selected text in the specified
  565. register, leaving it in the buffer.
  566. </para>
  567. <para>
  568. <guimenu>Edit</guimenu>&gt;<guisubmenu>Registers</guisubmenu>&gt;<guimenuitem>Cut
  569. Append to Register</guimenuitem>
  570. (shortcut: <keycombo><keycap>Control</keycap><keycap>R</keycap></keycombo>
  571. <keycombo><keycap>Control</keycap><keycap>U</keycap></keycombo>
  572. <keycap><replaceable>key</replaceable></keycap>)
  573. adds the selected text to the existing contents of the specified
  574. register, and removes it from the buffer.
  575. </para>
  576. <para>
  577. <guimenu>Edit</guimenu>&gt;<guisubmenu>Registers</guisubmenu>&gt;<guimenuitem>Copy
  578. Append to Register</guimenuitem>
  579. (shortcut: <keycombo><keycap>Control</keycap><keycap>R</keycap></keycombo>
  580. <keycombo><keycap>Control</keycap><keycap>A</keycap></keycombo>
  581. <keycap><replaceable>key</replaceable></keycap>)
  582. adds the selected text to the existing contents of the specified
  583. register, without removing it from the buffer.
  584. </para>
  585. <para>
  586. <guimenu>Edit</guimenu>&gt;<guisubmenu>Registers</guisubmenu>&gt;<guimenuitem>Paste
  587. from Register</guimenuitem>
  588. (shortcut: <keycombo><keycap>Control</keycap><keycap>R</keycap></keycombo>
  589. <keycombo><keycap>Control</keycap><keycap>V</keycap></keycombo>
  590. <keycap><replaceable>key</replaceable></keycap>)
  591. replaces the selection with the
  592. contents of the specified register.
  593. </para>
  594. <para>
  595. <guimenu>Edit</guimenu>&gt;<guimenuitem>Paste Previous</guimenuitem>
  596. (shortcut:
  597. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  598. <keycombo><keycap>Control</keycap><keycap>V</keycap></keycombo>)
  599. displays a dialog box listing recently copied and
  600. pasted text. By default, the last 20 strings are remembered; this can be
  601. changed in the <guibutton>General</guibutton> pane of the
  602. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem>
  603. dialog box; see <xref linkend="global-opts" />.
  604. </para>
  605. <para>
  606. <guimenu>Edit</guimenu>&gt;<guisubmenu>Registers</guisubmenu>&gt;<guimenuitem>View
  607. Registers</guimenuitem> displays a dialog box for
  608. viewing the contents of registers (including the clipboard).
  609. </para>
  610. </sect2>
  611. </sect1>
  612. <sect1 id="markers"><title>Markers</title>
  613. <para>
  614. Each buffer can have any number of <firstterm>markers</firstterm> defined,
  615. pointing to
  616. specific locations within that buffer. Each line in a buffer can have
  617. at most one marker set pointing to it. Markers are persistent; they are
  618. saved to
  619. <filename>.<replaceable>filename</replaceable>.marks</filename>, where
  620. <filename><replaceable>filename</replaceable></filename> is the file
  621. name. (The dot prefix
  622. makes the markers file hidden on Unix systems.) Marker
  623. saving can be
  624. disabled in the <guibutton>Loading and Saving</guibutton> pane of the
  625. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem>
  626. dialog box; see <xref linkend="global-opts" />.
  627. </para>
  628. <para>
  629. Markers are listed in the <guimenu>Markers</guimenu> menu; selecting a marker
  630. from this menu is the simplest way to return to its location.
  631. Each marker can optionally have a single-character shortcut; markers without
  632. a shortcut can only be returned to using the menu, markers with a shortcut
  633. can be accessed more quickly from the keyboard.
  634. </para>
  635. <para>
  636. Lines which contain markers are indicated in the gutter with a highlight.
  637. Moving the mouse over the highlight displays a tool tip showing the marker's
  638. shortcut, if it has one. See <xref linkend="textarea" /> for information
  639. about the gutter.
  640. </para>
  641. <para>
  642. <guimenu>Markers</guimenu>&gt;<guimenuitem>Add/Remove Marker</guimenuitem>
  643. (shortcut:
  644. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  645. <keycombo><keycap>Control</keycap><keycap>M</keycap></keycombo>) adds a
  646. marker without a shortcut pointing to the current line. If a marker is
  647. already set on the current line, the marker is removed instead.
  648. If text is selected,
  649. markers are added to the first and last line of each selection.
  650. </para>
  651. <para>
  652. <guimenu>Markers</guimenu>&gt;<guimenuitem>Add Marker With
  653. Shortcut</guimenuitem>
  654. (shortcut: <keycombo><keycap>Control</keycap><keycap>T</keycap></keycombo>
  655. <keycap><replaceable>key</replaceable></keycap>)
  656. reads the next character entered at the keyboard, and adds a marker with that
  657. shortcut pointing to the current line. If a previously-defined marker already
  658. has that shortcut, it will no longer have that shortcut, but will remain
  659. in the buffer. Pressing <keycap>Escape</keycap> instead of specifying a
  660. marker shortcut after invoking the command will cancel the operation.
  661. </para>
  662. <para>
  663. <guimenu>Markers</guimenu>&gt;<guimenuitem>Go to Marker</guimenuitem>
  664. (shortcut: <keycombo><keycap>Control</keycap><keycap>Y</keycap></keycombo>
  665. <keycap><replaceable>key</replaceable></keycap>)
  666. reads the next character entered at the keyboard, and moves the caret to the
  667. location of the marker with that shortcut. Pressing <keycap>Escape</keycap>
  668. instead of specifying a marker
  669. shortcut after invoking the command will cancel the operation.
  670. </para>
  671. <para>
  672. <guimenu>Markers</guimenu>&gt;<guimenuitem>Select to Marker</guimenuitem>
  673. (shortcut: <keycombo><keycap>Control</keycap><keycap>U</keycap></keycombo>
  674. <keycap><replaceable>key</replaceable></keycap>)
  675. reads the next character entered at the keyboard, and extends
  676. the selection to the location of the marker with that shortcut.
  677. Pressing <keycap>Escape</keycap> instead of specifying a marker
  678. shortcut after invoking the command will cancel the operation.
  679. </para>
  680. <para>
  681. <guimenu>Markers</guimenu>&gt;<guimenuitem>Swap Caret and
  682. Marker</guimenuitem> (shortcut:
  683. <keycombo><keycap>Control</keycap><keycap>U</keycap></keycombo>
  684. <keycap><replaceable>key</replaceable></keycap>)
  685. reads the next character entered at the keyboard, and swaps the
  686. position of the caret with the location of the marker with that shortcut.
  687. Pressing <keycap>Escape</keycap> instead of specifying a marker
  688. shortcut after invoking the command will cancel the operation.
  689. </para>
  690. <para>
  691. <guimenu>Markers</guimenu>&gt;<guimenuitem>Go to Previous
  692. Marker</guimenuitem>
  693. (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  694. <keycap>,</keycap>) goes
  695. to the marker immediately before the caret position.
  696. </para>
  697. <para>
  698. <guimenu>Markers</guimenu>&gt;<guimenuitem>Go to Next Marker</guimenuitem>
  699. (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  700. <keycap>.</keycap>)
  701. goes to the marker immediately after the caret position.
  702. </para>
  703. <para>
  704. <guimenu>Markers</guimenu>&gt;<guimenuitem>Remove All Markers</guimenuitem>
  705. removes all markers set in the current buffer.
  706. </para>
  707. </sect1>
  708. <sect1 id="search-replace"><title>Search and Replace</title>
  709. <sect2><title>Searching For Text</title>
  710. <para>
  711. <guimenu>Search</guimenu>&gt;<guimenuitem>Find</guimenuitem> (shortcut:
  712. <keycombo><keycap>Control</keycap><keycap>F</keycap></keycombo>) displays
  713. the search and replace dialog box. If text is selected and the selection
  714. does not span a line break, the selected text becomes the default search
  715. string.
  716. </para>
  717. <para>
  718. If the selection does span one or more line breaks, the default
  719. search string is empty, and the <guibutton>Search in Selection</guibutton>
  720. and <guibutton>HyperSearch</guibutton>
  721. buttons are pre-selected. Note that finding the next or previous
  722. ocurrence cannot be constrained to a selected range; only
  723. replacement and HyperSearch can be (see <xref linkend="hypersearch" />).
  724. </para>
  725. <para>
  726. The search string can be entered in the <guibutton>Search for</guibutton>
  727. text field. This text field remembers previously entered strings; see
  728. <xref linkend="history" /> for details.
  729. </para>
  730. <para>
  731. The search can be made case insensitive (for example, searching for
  732. <quote>Hello</quote> will match <quote>hello</quote>, <quote>HELLO</quote>
  733. and <quote>HeLlO</quote>) by selecting the <guibutton>Ignore
  734. case</guibutton> check box. Regular expressions may be used to match inexact
  735. sequences of text if the <guibutton>Regular expressions</guibutton> check
  736. box is selected; see <xref linkend="regexps" /> for more information about
  737. regular expressions. Note that regular expressions can only be used when
  738. searching forwards.
  739. </para>
  740. <para>
  741. Clicking <guibutton>Find</guibutton> will locate the next (or previous, if
  742. searching backwards) occurrence of the
  743. search string after the caret position. If the
  744. <guibutton>Keep dialog</guibutton> check box is selected, the dialog box
  745. will remain open; otherwise, it will be closed after the search string is
  746. located.
  747. </para>
  748. <para>
  749. If no occurrences could be found and the
  750. <guibutton>Auto wrap</guibutton> check box is selected, the search will
  751. automatically be restarted and a message will be shown in the status bar
  752. to indicate that. If the check box is not selected, a dialog
  753. box will be displayed, offering to restart the search.
  754. </para>
  755. <para>
  756. <guimenu>Search</guimenu>&gt;<guimenuitem>Find Next</guimenuitem> (shortcut:
  757. <keycombo><keycap>Control</keycap><keycap>G</keycap></keycombo>) locates the
  758. next occurrence of the most recent search string without displaying the
  759. search and replace dialog box.
  760. </para>
  761. <para>
  762. <guimenu>Search</guimenu>&gt;<guimenuitem>Find Previous</guimenuitem>
  763. (shortcut: <keycombo><keycap>Control</keycap><keycap>H</keycap></keycombo>)
  764. locates the previous occurrence of the most recent search string without
  765. displaying the search and replace dialog box.
  766. </para>
  767. </sect2>
  768. <sect2><title>Replacing Text</title>
  769. <para>
  770. Occurrences of the search string can be replaced with either a replacement
  771. string or the result of a BeanShell script snippet. Two radio buttons in
  772. the search and replace dialog box can be used to choose between these two
  773. behaviors.
  774. </para>
  775. <para>
  776. The replace string text field remembers previously entered strings;
  777. see <xref linkend="history" /> for details.
  778. </para>
  779. <para>
  780. Clicking <guibutton>Replace</guibutton> will perform a replacement in each
  781. text selection.
  782. Clicking <guibutton>Replace &amp; Find</guibutton> will perform a
  783. replacement in each text selection and locate the next occurrence of the
  784. search string. Clicking <guibutton>Replace All</guibutton> will perform a
  785. replacement in each buffer to be searched.
  786. </para>
  787. <para>
  788. In text replacement mode, the search string is replaced with the replacement
  789. string. If regular expressions are enabled, positional parameters
  790. (<literal>$0</literal>, <literal>$1</literal>, <literal>$2</literal>, and so
  791. on) can be used to insert the contents of matched subexpressions in the
  792. replacement text; see <xref linkend="regexps" /> for more information.
  793. </para>
  794. <para>
  795. In BeanShell replacement mode, the search string is replaced with the return
  796. value of a BeanShell snippet. The following predefined variables can be
  797. referenced in the snippet:
  798. </para>
  799. <itemizedlist><listitem><para><varname>_0</varname> -- the text to be
  800. replaced</para>
  801. </listitem><listitem><para><varname>_1</varname> - <varname>_9</varname> --
  802. if regular expressions are enabled, these contain the values of matched
  803. subexpressions.
  804. </para></listitem></itemizedlist>
  805. <para>
  806. BeanShell syntax and features are covered in great detail in
  807. <xref linkend="writing-macros-part" />, but here are some examples:
  808. </para>
  809. <informalexample>
  810. <para>
  811. To convert all HTML tags to lower case, search
  812. for the following regular expression:
  813. </para>
  814. <programlisting><![CDATA[<(.*?)>]]></programlisting>
  815. <para>
  816. Replacing it with the following BeanShell snippet:
  817. </para>
  818. <programlisting><![CDATA["<" + _1.toLowerCase() + ">"]]></programlisting>
  819. </informalexample>
  820. <informalexample>
  821. <para>
  822. To replace arithmetic expressions between curly braces with their result,
  823. search for the following regular expression:
  824. </para>
  825. <programlisting><![CDATA[\{(.+)\}]]></programlisting>
  826. <para>
  827. Replacing it with the following BeanShell snippet:
  828. </para>
  829. <programlisting><![CDATA[eval(_1)]]></programlisting>
  830. </informalexample>
  831. <para>
  832. These two examples only scratch the surface; the possibilities are endless.
  833. </para>
  834. </sect2>
  835. <sect2 id="hypersearch"><title>HyperSearch</title>
  836. <para>
  837. If the <guibutton>HyperSearch</guibutton> check box in the search and
  838. replace dialog box is selected, clicking <guibutton>Find</guibutton> will
  839. list all occurrences of the search string, rather than locating them one
  840. by one.
  841. </para>
  842. <para>
  843. By default, HyperSearch results are shown in a floating window;
  844. the window can be set to dock into the view
  845. in the <guibutton>Docking</guibutton> pane of the
  846. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem>
  847. dialog box; see <xref linkend="docking" />.
  848. </para>
  849. <para>
  850. Running searches can be stopped in the
  851. <guimenu>Utilities</guimenu>&gt;<guimenuitem>I/O Progress
  852. Monitor</guimenuitem> dialog box.
  853. </para>
  854. </sect2>
  855. <sect2><title>Multiple File Search</title>
  856. <para>
  857. Searching, replacement and HyperSearch can also be performed in all
  858. open buffers or all files in a directory.
  859. </para>
  860. <para>
  861. If the <guibutton>All buffers</guibutton> radio button in the search and
  862. replace dialog box is selected, all open buffers whose names match the glob
  863. pattern
  864. entered in the <guibutton>Filter</guibutton> text field will be searched.
  865. See <xref linkend="globs" /> for more information about glob patterns.
  866. </para>
  867. <para>
  868. If the <guibutton>Directory</guibutton> radio button is selected, all files
  869. in the directory whose names match the glob will be searched. The
  870. directory to search in can either be entered in the
  871. <guibutton>Directory</guibutton> text field, or chosen in a file selector
  872. dialog box by clicking <guibutton>Choose</guibutton>.
  873. If the <guibutton>Search subdirectories</guibutton> check box is selected,
  874. all subdirectories of the specified directory will also be searched. Keep
  875. in mind that searching through directories with many files can take
  876. a long time and consume a large amount of memory.
  877. </para>
  878. <para>
  879. The <guibutton>Directory</guibutton> and <guibutton>Filter</guibutton>
  880. text fields remember previously entered strings; see <xref linkend="history" />
  881. for details.
  882. </para>
  883. <para>
  884. Note that selecting the <guibutton>All Buffers</guibutton> or
  885. <guibutton>Directory</guibutton> radio buttons also selects the
  886. <guibutton>HyperSearch</guibutton> check box. This is merely for
  887. convinience, however; normal searching is supported as well.
  888. </para>
  889. <para>
  890. Two convinience commands are provided for performing multiple file searches.
  891. </para>
  892. <para>
  893. <guimenu>Search</guimenu>&gt;<guimenuitem>Search in Open
  894. Buffers</guimenuitem> (shortcut:
  895. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  896. <keycombo><keycap>Control</keycap><keycap>B</keycap></keycombo>) displays
  897. the search and replace dialog box, and selects the <guibutton>All
  898. buffers</guibutton> radio button.
  899. </para>
  900. <para>
  901. <guimenu>Search</guimenu>&gt;<guimenuitem>Search in Directory</guimenuitem>
  902. (shortcut:
  903. <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  904. <keycombo><keycap>Control</keycap><keycap>D</keycap></keycombo>) displays
  905. the search and replace dialog box, and selects the
  906. <guibutton>Directory</guibutton> radio button.
  907. </para>
  908. </sect2>
  909. <sect2><title>The Search Bar</title>
  910. <para>
  911. The search bar at the top of the view provides a convenient way to
  912. perform simple searches without
  913. opening the search and replace dialog box first. Neither multiple file
  914. search nor replacement can be done from the search bar.
  915. The search bar remembers
  916. previously entered strings; see <xref linkend="history" /> for details.
  917. </para>
  918. <para>
  919. Unless the <guibutton>HyperSearch</guibutton> check box is selected, the
  920. search bar will perform an <firstterm>incremental search</firstterm>.
  921. In incremental search mode, the first occurrence of the search
  922. string is located in the current buffer as is it is being typed.
  923. Pressing <keycap>Enter</keycap>
  924. and <keycombo><keycap>Shift</keycap><keycap>Enter</keycap></keycombo>
  925. searches for the next and previous occurrence, respectively.
  926. Once the desired occurrence has been found, press <keycap>Escape</keycap>
  927. to return keyboard focus to the text area.
  928. </para>
  929. <para>
  930. If the <guibutton>HyperSearch</guibutton> check box is selected, entering a
  931. search string and pressing <keycap>Enter</keycap> will perform a
  932. HyperSearch.
  933. </para>
  934. <para>
  935. <guimenu>Search</guimenu>&gt;<guimenuitem>Incremental Search</guimenuitem>
  936. (shortcut: <keycombo><keycap>Control</keycap><keycap>,</keycap></keycombo>)
  937. moves keyboard focus to the search bar. If text is selected when this
  938. command is invoked, the selection is inserted into the search bar
  939. automatically.
  940. </para>
  941. <para>
  942. <guimenu>Search</guimenu>&gt;<guimenuitem>Quick HyperSearch</guimenuitem>
  943. (shortcut: <keycombo><keycap>Control</keycap><keycap>.</keycap></keycombo>)
  944. moves keyboard focus to the search bar and pre-selects the
  945. <guibutton>HyperSearch</guibutton> check box. If text is selected when this
  946. command is invoked, a HyperSearch for that text is performed immediately.
  947. </para>
  948. <para>
  949. The
  950. <guimenu>Search</guimenu>&gt;<guimenuitem>Incremental Search
  951. for Word</guimenuitem>
  952. (shortcut: <keycombo><keycap>Alt</keycap><keycap>,</keycap></keycombo>)
  953. and <guimenu>Search</guimenu>&gt;<guimenuitem>Quick HyperSearch
  954. for Word</guimenuitem>
  955. (shortcut: <keycombo><keycap>Alt</keycap><keycap>.</keycap></keycombo>)
  956. commands perform an incremental search and HyperSearch, respectively,
  957. for the word under the caret.
  958. </para>
  959. <para>
  960. The search bar can be disabled in the <guibutton>General</guibutton> pane of
  961. the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  962. Options</guimenuitem> dialog box.
  963. </para>
  964. <note>
  965. <para>
  966. Incremental searches cannot be not recorded in macros. Use the
  967. search and replace dialog box instead. See <xref linkend="using-macros" />
  968. for information about macros.
  969. </para>
  970. </note>
  971. </sect2>
  972. </sect1>
  973. </chapter>