PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/jEdit/tags/jedit-4-5-pre1/doc/users-guide/basics.xml

#
XML | 526 lines | 410 code | 113 blank | 3 comment | 0 complexity | 3adcc9fd302e6cf53b9ada19a8c4dfe4 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <chapter id="basics">
  3. <title>jEdit Basics</title>
  4. <!-- jEdit buffer-local properties: -->
  5. <!-- :indentSize=1:noTabs=true: -->
  6. <!-- :xml.root=users-guide.xml: -->
  7. <section id="overview">
  8. <title>Interface Overview</title>
  9. <para>A <firstterm>View</firstterm> is the jEdit term for an editor main
  10. window. It is possible to have multiple views open at once, and each
  11. View can be split into multiple panes. jEdit remembers the state of open
  12. views between editing sessions.</para>
  13. <para>An open file is referred to as a <firstterm>Buffer</firstterm>.
  14. Unlike some editors where each buffer gets its own View, jEdit
  15. completely separates the two concepts. A buffer might be visible in
  16. several views, or none at all.</para>
  17. <para>A <firstterm>TextArea</firstterm> is an editor for a buffer.
  18. An <firstterm>EditPane</firstterm> contains a TextArea plus optional buffer switcher.
  19. A View contains one EditPane by default, and additional panes are created whenever
  20. the View is split. </para>
  21. <para>The drop-down buffer switcher list at the top of each EditPane shows
  22. a BufferSet, or a set of open buffers (see <xref linkend="buffersets" />).
  23. Selecting a buffer on this list will make it visible in the TextArea. Different
  24. emblems are displayed next to buffer names in the list, depending the
  25. buffer's state; a red disk is shown for buffers with unsaved changes, a
  26. lock is shown for read-only buffers, and a spark is shown for new
  27. buffers which don't yet exist on disk.</para>
  28. <para>With the new Tango icon theme, these symbols are slightly different,
  29. a red square is shown for buffers with unsaved changes, a lock is shown for
  30. read-only buffers, and a yellow square is shown for new buffers which don't
  31. yet exist on disk.</para>
  32. <para>As with most other graphical applications, there is a tool bar at
  33. the top of the View which provides quick access to frequently-used
  34. commands. Also, clicking the TextArea with the right mouse button
  35. displays a popup menu which also facilitates quick access to various
  36. commands. Both the tool bar and the right-click menu can be completely
  37. customized to suit your tastes in the
  38. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  39. Options</guimenuitem> dialog box; see <xref linkend="context-pane" />
  40. and <xref linkend="toolbar-pane" />.</para>
  41. <para>Most of the View is taken up by the TextArea. If you've ever used
  42. a graphical user interface before, the TextArea will be instantly
  43. familiar. Text can be inserted simply by typing. More details on text
  44. insertion and deletion can be found in <xref
  45. linkend="entering-text" />.</para>
  46. <para>The strip on the left of the TextArea is called a
  47. <firstterm>gutter</firstterm>. The gutter displays marker and register
  48. locations, as well as folding arrows; it will also display line numbers
  49. if the <guimenu>View</guimenu>&gt;<guimenuitem>Line
  50. Numbers</guimenuitem> (shortcut: <keycap>C+e C+t</keycap>) command is
  51. invoked. Note this menu toggle action has the side-effect of changing the
  52. persistent jEdit properties for the Gutter, which can also
  53. be set from the <guilabel>Gutter</guilabel> pane of the
  54. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  55. Options</guimenuitem> dialog box.</para>
  56. <para> The gutter is divided into two sections. Right-clicking on the left side
  57. gives you a context menu, while right-clicking on the right side (where line numbers might be)
  58. toggles a marker at that position.
  59. Text can be selected by left-clicking and dragging on right side of the gutter,
  60. over the range of lines you wish to select.
  61. </para>
  62. </section>
  63. <section id="views">
  64. <title>Multiple Views</title>
  65. <para>As documented at the beginning of this chapter, multiple Views
  66. (main windows) can be open at once.</para>
  67. <para><guimenu>View</guimenu>&gt;<guimenuitem>New View</guimenuitem>
  68. creates a new View, or main window.</para>
  69. <para><guimenu>View</guimenu>&gt;<guimenuitem>New Plain
  70. View</guimenuitem> creates a new View but without any tool bars or
  71. dockable windows. This can be used to open a small window for taking notes
  72. and so on.</para>
  73. <para><guimenu>View</guimenu>&gt;<guimenuitem>Close View</guimenuitem>
  74. closes the current View. If only one View is open, closing it will exit
  75. jEdit, unless background mode is on; see <xref linkend="starting" /> for
  76. information about starting jEdit in background mode.</para>
  77. <para><guimenu>View</guimenu>&gt;<guimenuitem>Split
  78. Horizontally</guimenuitem> (shortcut: <keycap>C+2</keycap>) splits the
  79. View into two TextAreas, placed above each other.</para>
  80. <para><guimenu>View</guimenu>&gt;<guimenuitem>Split
  81. Vertically</guimenuitem> (shortcut: <keycap>C+3</keycap>) splits the
  82. View into two TextAreas, placed next to each other.</para>
  83. <para><guimenu>View</guimenu>&gt;<guimenuitem>Unsplit
  84. Current</guimenuitem> (shortcut: <keycap>C+0</keycap>) removes the split
  85. containing the current TextArea only.</para>
  86. <para><guimenu>View</guimenu>&gt;<guimenuitem>Unsplit All</guimenuitem>
  87. (shortcut: <keycap>C+1</keycap>) removes all splits from the View.</para>
  88. <para>When a View is split, editing commands operate on the TextArea
  89. that has keyboard focus. To give a TextArea keyboard focus, click in it
  90. with the mouse, or use the following commands.</para>
  91. <para><guimenu>View</guimenu>&gt;<guimenuitem>Go to Previous Text
  92. Area</guimenuitem> (shortcut: <keycap>A+PAGE_UP</keycap>) shifts
  93. keyboard focus to the previous TextArea.</para>
  94. <para><guimenu>View</guimenu>&gt;<guimenuitem>Go to Next Text
  95. Area</guimenuitem> (shortcut: <keycap>A+PAGE_DOWN</keycap>) shifts
  96. keyboard focus to the next TextArea.</para>
  97. <para><guimenu>Macros</guimenu>&gt;<guimenu>Interface</guimenu>&gt;
  98. <guimenu>Splitpane Grow</guimenu> grows the size of the currently focused
  99. TextArea. </para>
  100. </section>
  101. <section id="buffers">
  102. <title>Switching Buffers</title>
  103. <para>Each EditPane has an optional drop-down BufferSwitcher at the top.
  104. The BufferSwitcher shows the current buffer and can also be used to
  105. switch the current buffer, using menu item commands and their keyboard shortcuts.</para>
  106. <para><guimenu>View</guimenu>&gt;<guimenuitem>Go to Previous
  107. Buffer</guimenuitem> (keyboard shortcut: <keycap>C+PAGE_UP</keycap>)
  108. switches to the previous buffer in the list.</para>
  109. <para><guimenu>View</guimenu>&gt;<guimenuitem>Go to Next
  110. Buffer</guimenuitem> (keyboard shortcut: <keycap>C+PAGE_DOWN</keycap>)
  111. switches to the next buffer in the list.</para>
  112. <para><guimenu>View</guimenu>&gt;<guimenuitem>Go to Recent
  113. Buffer</guimenuitem> (keyboard shortcut: <keycap>C+BACK_QUOTE</keycap>)
  114. flips between the two most recently edited buffers.</para>
  115. <para><guimenu>View</guimenu>&gt;<guimenuitem>Show Buffer
  116. Switcher</guimenuitem> (keyboard shortcut:
  117. <keycap>A+BACK_QUOTE</keycap>) has the same effect as clicking on the
  118. buffer switcher combo box.</para>
  119. <para>If you prefer an alternative graphical paradigm for switching
  120. buffers, take a look at one of these plugins:</para>
  121. <itemizedlist>
  122. <listitem>
  123. <para><application>BufferList</application></para>
  124. </listitem>
  125. <listitem>
  126. <para><application>BufferSelector</application></para>
  127. </listitem>
  128. <listitem>
  129. <para><application>BufferTabs</application></para>
  130. </listitem>
  131. </itemizedlist>
  132. <para>If you decide to use one of these plugins, you can hide the popup
  133. menu buffer switcher in the <guilabel>View</guilabel> pane of the
  134. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  135. Options</guimenuitem> dialog box.</para>
  136. <para>A number of plugins that implement fast keyboard-based buffer
  137. switching are available as well:</para>
  138. <itemizedlist>
  139. <listitem>
  140. <para><application>FastOpen</application></para>
  141. </listitem>
  142. <listitem>
  143. <para><application>OpenIt</application></para>
  144. </listitem>
  145. <listitem>
  146. <para><application>SwitchBuffer</application></para>
  147. </listitem>
  148. </itemizedlist>
  149. </section>
  150. <section id="buffersets">
  151. <title>Buffer Sets</title>
  152. <para> The buffer sets feature helps keep the buffer lists local and manageable when using
  153. jEdit in a multiple-View and multiple-EditPane environment. </para>
  154. <para> As mentioned in the previous section, each EditPane can show a Buffer Switcher, which
  155. displays the contents of a BufferSet. In jEdit 4.2, all EditPane buffer switchers
  156. showed the same BufferSet: a global list of all buffers that were opened from any EditPane in any View.
  157. When using many Views and EditPanes, this resulted in large lists of buffers, and made
  158. the next/previous buffer actions useless with many Views, EditPanes and Buffers.
  159. </para>
  160. <para> In jEdit 4.3, it is possible to have more narrow scopes for the BufferSets
  161. of an EditPane. This makes the 'next-buffer' and 'previous-buffer' actions switch
  162. between buffers that are local to the view or pane. </para>
  163. <para>
  164. The three BufferSet scopes are: </para>
  165. <orderedlist>
  166. <listitem><para> <emphasis role="bold">Global</emphasis>: Includes all buffers open from any EditPane. </para></listitem>
  167. <listitem><para> <emphasis role="bold">View</emphasis>: EditPanes in the same
  168. View share the same BufferSet. Opening a buffer in one View will not affect the
  169. other views. </para></listitem>
  170. <listitem><para><emphasis role="bold">EditPane</emphasis>: Each EditPane can have its
  171. own independent BufferSet.
  172. </para></listitem>
  173. </orderedlist>
  174. <para> Bufferset scope can be set from <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem> &gt; <guimenuitem>View</guimenuitem> &gt;
  175. <guilabel>BufferSet scope:</guilabel>.
  176. </para>
  177. <para> <guimenu>File</guimenu> &gt; <guimenuitem>Close</guimenuitem> removes the current buffer from the EditPane's BufferSet only. If it was the last BufferSet to contain that buffer, the buffer is also closed. </para>
  178. <para> The <guimenu> File </guimenu> &gt; <guimenuitem>Close (global)</guimenuitem> action closes the buffer in all EditPanes, as the jEdit 4.2 <guimenu> File </guimenu> &gt; <guimenuitem>Close</guimenuitem> action did before. </para>
  179. <para> When <guimenuitem>Exclusive Buffersets</guimenuitem> are enabled, any time a buffer is opened from one EditPane, it should be automatically closed in other EditPanes which use a disjoint (non-intersecting) BufferSet. </para>
  180. <para> <guimenuitem>Close Others</guimenuitem> will clear the BufferSet of the
  181. current EditPane by performing a <guimenuitem>Close</guimenuitem> on all items except those buffers which are displayed in another active EditPane. </para>
  182. <bridgehead> Switching Bufferset Scopes </bridgehead>
  183. <para> The statusbar shows you which BufferSet scope is active
  184. (look for the letter "G", "E" or "V"). Double-clicking on that
  185. will allow you to change the scope without going into global options.
  186. The BufferSet Scope can also be changed from
  187. <guimenu>View</guimenu>&gt;<guimenu>Buffer Sets</guimenu> &gt;
  188. <guimenu>(Global|View|EditPane) Buffer Set</guimenu>.
  189. Changes to the bufferset scope affects all editpanes immediately.
  190. </para>
  191. </section>
  192. <section id="docking">
  193. <title>Window Docking Layouts</title>
  194. <para> A docking layout is similar to an Eclipse "Perspective" in that it describes a set of dockable windows that are visible to the user at any given time, hiding the rest. </para>
  195. <para>Various jEdit and plugin windows can be docked into the View for
  196. convenience. Dockable windows have a popup button in their top-left
  197. corner. Clicking this button displays a menu with commands for docking
  198. the window in one of four sides of the View.</para>
  199. <para>On each side of the TextArea where there are docked windows, a
  200. strip of buttons is shown. There is a button for activating each docked
  201. window, as well as a close box and a popup menu button, which when
  202. clicked shows a menu for moving or undocking the currently selected
  203. window. The popup menu also contains a command for opening a new
  204. floating instance of the current window.</para>
  205. <para>The commands in the
  206. <guimenu>View</guimenu>&gt;<guisubmenu>Docking</guisubmenu> menu move keyboard focus between docking areas.</para>
  207. <para>
  208. After you have customized the layout of your dockables and wish to save it for export/import, use the actions <guimenu>View</guimenu> - <guimenu>Docking</guimenu> - <guimenuitem>Save/Load Docking Layout</guimenuitem>. </para>
  209. <para> It is possible to configure a Dockable layout for just one or a handful of edit modes. This makes it possible to save or load your dockable layout with the same keyboard shortcut (or automatically) based on the edit mode of your current buffer.
  210. </para>
  211. <para>
  212. It is also possible to save/load a layout for a particular edit mode. The loading and saving can be done automatically, as configured in the global options docking pane when the mode of the buffer changes, or manually in response to invoking <guimenu>View</guimenu> - <guimenu>Docking</guimenu> - <guimenuitem>Save/Load Docking Layout for current mode.</guimenuitem>
  213. </para>
  214. <para>Dockable windows can be further configured in the
  215. <guilabel>Docking</guilabel> pane of the
  216. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  217. Options</guimenuitem> dialog box. See <xref linkend="docking-pane"/> for details.
  218. </para>
  219. <sidebar>
  220. <title>For keyboard/power users</title>
  221. <para>Each dockable has three commands associated with it; one is part of the menu bar and opens the dockable. The other two commands are:</para>
  222. <itemizedlist>
  223. <listitem>
  224. <para><guimenuitem>Window Name (Toggle)</guimenuitem> -
  225. opens the dockable window if it is hidden, and hide it if
  226. its already open.</para>
  227. </listitem>
  228. <listitem>
  229. <para><guimenuitem>Window Name (New Floating
  230. Instance)</guimenuitem> - opens a new instance of the
  231. dockable in a floating window, regardless of the docking
  232. configuration. For example, this can be used to view two
  233. different directories side-by-side in two file system
  234. browser windows.</para>
  235. <para>A new floating instance can also be opened from the
  236. dockable window's popup menu.</para>
  237. </listitem>
  238. </itemizedlist>
  239. <para>These commands cannot be invoked from the menu bar. However,
  240. they can be added to the tool bar or context menu, and given
  241. keyboard shortcuts; see <xref linkend="global-opts" />.</para>
  242. </sidebar>
  243. </section>
  244. <section id="status-bar">
  245. <title>The Status Bar</title>
  246. <para>The <firstterm>status bar</firstterm> at the bottom of the View
  247. consists of the following components, from left to right:</para>
  248. <itemizedlist>
  249. <listitem>
  250. <para>Caret position information:</para>
  251. <itemizedlist>
  252. <listitem>
  253. <para>The offset of the caret from the beginning of the file</para>
  254. </listitem>
  255. <listitem>
  256. <para>The line number containing the caret</para>
  257. </listitem>
  258. <listitem>
  259. <para>The column position of the caret, with the leftmost column
  260. being 1.</para>
  261. <para>If the line contains tabs, the <firstterm>file</firstterm>
  262. position (where a hard tab is counted as one column) is shown
  263. first, followed by the <firstterm>screen</firstterm> position
  264. (where each tab counts for the number of columns until the next
  265. tab stop).</para>
  266. </listitem>
  267. <listitem>
  268. <para>The percent offset of the caret from the start of the file.
  269. This is based on the line number of the caret and the total number
  270. of lines in the file, so this is the same as the relative position
  271. of the right scroll bar in the main text area.</para>
  272. </listitem>
  273. </itemizedlist>
  274. <para>
  275. All of the above information is configurable in the Global Options
  276. for the status bar.
  277. </para>
  278. <para>Double-clicking on the caret location indicator displays
  279. the <guimenu>Edit</guimenu>&gt;<guimenuitem>Go to
  280. Line</guimenuitem> dialog box; see <xref
  281. linkend="lines" />.
  282. </para>
  283. </listitem>
  284. <listitem>
  285. <para>A message area where various prompts and status messages
  286. are shown.</para>
  287. </listitem>
  288. <listitem>
  289. <para>The current buffer's edit mode, fold mode, and character
  290. encoding. Double-clicking one of these displays the
  291. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Buffer
  292. Options</guimenuitem> dialog box. For more information about
  293. these settings, see:</para>
  294. <itemizedlist>
  295. <listitem>
  296. <para><xref linkend="buffer-opts" /></para>
  297. </listitem>
  298. <listitem>
  299. <para><xref linkend="modes" /></para>
  300. </listitem>
  301. <listitem>
  302. <para><xref linkend="folding" /></para>
  303. </listitem>
  304. <listitem>
  305. <para><xref linkend="encodings" /></para>
  306. </listitem>
  307. </itemizedlist>
  308. </listitem>
  309. <listitem>
  310. <para>A set of flags which indicate various editor features and
  311. settings. Clicking each flag will toggle the feature in
  312. question; hovering the mouse over a flag will show a tool tip
  313. with an explanation:</para>
  314. <itemizedlist>
  315. <listitem>
  316. <para>Word wrap - see <xref
  317. linkend="word-wrap" />.</para>
  318. </listitem>
  319. <listitem>
  320. <para>Multiple selection - see <xref
  321. linkend="multi-select" />.</para>
  322. </listitem>
  323. <listitem>
  324. <para>Rectangular selection - see <xref
  325. linkend="rect-select" />.</para>
  326. </listitem>
  327. <listitem>
  328. <para>Overwrite mode - see <xref
  329. linkend="entering-text" />.</para>
  330. </listitem>
  331. <listitem>
  332. <para>Line separator - see <xref
  333. linkend="line-separators" />.</para>
  334. </listitem>
  335. <listitem>
  336. <para>Buffer Set Scope - see <xref
  337. linkend="buffersets" />.</para>
  338. </listitem>
  339. </itemizedlist>
  340. </listitem>
  341. <listitem>
  342. <para>A Java heap memory usage indicator, that shows used and
  343. total heap memory, in megabytes. Double-clicking this indicator
  344. opens the
  345. <guimenu>Utilities</guimenu>&gt;<guisubmenu>Troubleshooting</guisubmenu>&gt;<guimenuitem>Memory
  346. Status</guimenuitem> dialog box.</para>
  347. </listitem>
  348. </itemizedlist>
  349. <para>The visibility of each of the above items can be controlled in the
  350. <guibutton>Status Bar</guibutton> pane of the
  351. <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  352. Options</guimenuitem> dialog box; see <xref
  353. linkend="status-bar-pane" />.</para>
  354. </section>
  355. <section id="action-bar">
  356. <title>The Action Bar</title>
  357. <para>The action bar allows almost any editor feature to be accessed
  358. from the keyboard.</para>
  359. <para><guimenu>Utilities</guimenu>&gt;<guimenuitem>Action
  360. Bar</guimenuitem> (shortcut: <keycap>C+ENTER</keycap>) displays the
  361. action bar at the bottom of the View and gives it keyboard focus. The
  362. action bar remembers previously entered strings; see <xref
  363. linkend="history" /> for details.</para>
  364. <para>To use the action bar, input a command and press
  365. <keycap>Enter</keycap>. The following commands are supported:</para>
  366. <bridgehead>Action invocations</bridgehead>
  367. <para>Each menu item and tool bar button is bound to an
  368. <firstterm>action</firstterm>. To find out the name of an action, invoke
  369. the menu item or click the tool bar button, and look in the action bar's
  370. history.</para>
  371. <para>If a substring or an action name is entered, pressing
  372. <keycap>Tab</keycap> shows a popup listing matching actions. An action
  373. can be selected using the <keycap>Up</keycap> and <keycap>Down</keycap>
  374. arrow keys, or by entering more characters of its name.</para>
  375. <para>Pressing <keycap>Enter</keycap> with an incomplete substring
  376. invokes the action that would be first in the completion popup's
  377. list.</para>
  378. <para>For example, entering <userinput>l-o</userinput> will match
  379. <userinput>global-options</userinput>, which has the same effect as
  380. invoking <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global
  381. Options</guimenuitem>.</para>
  382. <bridgehead>Buffer-local properties</bridgehead>
  383. <para>Entering <userinput>buffer.property=value</userinput> sets the
  384. value of the buffer-local property named <userinput>property</userinput>
  385. to <userinput>value</userinput>. Buffer-local properties are documented
  386. in <xref linkend="buffer-local" />.</para>
  387. <para>For example, entering <userinput>buffer.tabSize=4</userinput>
  388. changes the current buffer's tab size to 4.</para>
  389. <para>See <xref linkend="buffer-local" /> for information about
  390. buffer-local properties.</para>
  391. <bridgehead>Global properties</bridgehead>
  392. <para>Entering <userinput>property=value</userinput> sets the value of
  393. the global property named <userinput>property</userinput> to
  394. <userinput>value</userinput>. This feature is primarily intended to help
  395. plugin developers, since the properties jEdit uses to store its settings
  396. are not currently documented.</para>
  397. <bridgehead>Command repetition</bridgehead>
  398. <para>To repeat a command multiple times, enter a number in the action
  399. bar, then press the key-combination that invokes the command.
  400. For example,
  401. <quote><keycap>C+ENTER</keycap> <keycap>1</keycap> <keycap>4</keycap>
  402. <keycap>C+d</keycap></quote> will delete 14 lines;
  403. <quote><keycap>C+ENTER</keycap> <keycap>9</keycap>
  404. <keycap>#</keycap></quote> will insert <quote>#########</quote> in the
  405. buffer.
  406. Note: The space characters in these examples should not be typed;
  407. they are only here to visually separate the keys to be typed.</para>
  408. <para>If you specify a repeat count greater than 20, a confirmation
  409. dialog box will be displayed, asking if you really want to perform the
  410. action. This prevents you from hanging jEdit by executing a command too
  411. many times.</para>
  412. </section>
  413. </chapter>