robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

Eisuke Kawashimadocs: adjust modelines for HTML rendering #396497e778205ab

master
10.1 KiB263 linesraw
1*usr_09.txt*	Nvim
2
3
4		     VIM USER MANUAL	by Bram Moolenaar
5
6
7				Using the GUI
8
9
10Vim works in an ordinary terminal, while gVim has a Graphical User Interface
11(GUI).  It can do the same things and a few more.  The GUI offers menus, a
12toolbar, scrollbars and other items.  This chapter is about these extra things
13that the GUI offers.
14
15|09.1|	Parts of the GUI
16|09.2|	Using the mouse
17|09.3|	The clipboard
18|09.4|	Select mode
19
20     Next chapter: |usr_10.txt|  Making big changes
21 Previous chapter: |usr_08.txt|  Splitting windows
22Table of contents: |usr_toc.txt|
23
24==============================================================================
25*09.1*	Parts of the GUI
26
27You might have an icon on your desktop that starts gvim.  Otherwise, one of
28these commands should do it: >
29
30	gvim file.txt
31	vim -g file.txt
32
33If this doesn't work you don't have a version of Vim with GUI support.  You
34will have to install one first.
35   Vim will open a window and display "file.txt" in it.  What the window looks
36like depends on the version of Vim.  It should resemble the following picture
37(for as far as this can be shown in ASCII!).
38
39	+----------------------------------------------------+
40	| file.txt + (~/dir) - VIM			   X |	<- window title
41	+----------------------------------------------------+
42	| File	Edit  Tools  Syntax  Buffers  Window  Help   |	<- menubar
43	+----------------------------------------------------+
44	| aaa  bbb  ccc  ddd  eee  fff	ggg  hhh  iii  jjj   |	<- toolbar
45	| aaa  bbb  ccc  ddd  eee  fff	ggg  hhh  iii  jjj   |
46	+----------------------------------------------------+
47	| file text					 | ^ |
48	| ~						 | # |
49	| ~						 | # |	<- scrollbar
50	| ~						 | # |
51	| ~						 | # |
52	| ~						 | # |
53	|						 | V |
54	+----------------------------------------------------+
55
56The largest space is occupied by the file text.  This shows the file in the
57same way as in a terminal.  With some different colors and another font
58perhaps.
59
60
61THE WINDOW TITLE
62
63At the very top is the window title.  This is drawn by your window system.
64Vim will set the title to show the name of the current file.  First comes the
65name of the file.  Then some special characters and the directory of the file
66in parens.  These special characters can be present:
67
68	• -	The file cannot be modified (e.g., a help file)
69	• +	The file contains changes
70	• =	The file is read-only
71	• =+	The file is read-only, contains changes anyway
72
73If nothing is shown you have an ordinary, unchanged file.
74
75
76THE MENUBAR
77
78You know how menus work, right?  Vim has the usual items, plus a few more.
79Browse them to get an idea of what you can use them for.  A relevant submenu
80is Edit/Global Settings.  You will find these entries:
81
82	Toggle Toolbar		make the toolbar appear/disappear
83	Toggle Bottom Scrollbar	make a scrollbar appear/disappear at the bottom
84	Toggle Left Scrollbar	make a scrollbar appear/disappear at the left
85	Toggle Right Scrollbar	make a scrollbar appear/disappear at the right
86
87
88THE TOOLBAR
89
90This contains icons for the most often used actions.  Hopefully the icons are
91self-explanatory.  There are tooltips to get an extra hint (move the mouse
92pointer to the icon without clicking and don't move it for a second).
93
94The "Edit/Global Settings/Toggle Toolbar" menu item can be used to make the
95toolbar disappear.  If you never want a toolbar, use this command in your
96vimrc file: >
97
98	:set guioptions-=T
99
100This removes the 'T' flag from the 'guioptions' option.  Other parts of the
101GUI can also be enabled or disabled with this option.  See the help for it.
102
103
104THE SCROLLBARS
105
106By default there is one scrollbar on the right.  It does the obvious thing.
107When you split the window, each window will get its own scrollbar.
108   You can make a horizontal scrollbar appear with the menu item
109Edit/Global Settings/Toggle Bottom Scrollbar.  This is useful in diff mode, or
110when the 'wrap' option has been reset (more about that later).
111
112When there are vertically split windows, only the windows on the right side
113will have a scrollbar.  However, when you move the cursor to a window on the
114left, it will be this one that the scrollbar controls.  This takes a bit of
115time to get used to.
116   When you work with vertically split windows, consider adding a scrollbar on
117the left.  This can be done with a menu item, or with the 'guioptions' option:
118>
119	:set guioptions+=l
120
121This adds the 'l' flag to 'guioptions'.
122
123==============================================================================
124*09.2*	Using the mouse
125
126Standards are wonderful.  In Microsoft Windows, you can use the mouse to
127select text in a standard manner.  The X Window system also has a standard
128system for using the mouse.  Unfortunately, these two standards are not the
129same. Fortunately, you can customize Vim.
130
131The following commands makes the mouse work more like a Microsoft Windows
132mouse: >
133
134	set selection=exclusive
135	set selectmode=mouse,key
136	set keymodel=startsel,stopsel
137
138The mouse can be further tuned.  Check out these options if you want to change
139the way how the mouse works:
140
141	'mouse'			in which mode the mouse is used by Vim
142	'mousemodel'		what effect a mouse click has
143	'mousetime'		time between clicks for a double-click
144	'mousehide'		hide the mouse while typing
145	'selectmode'		whether the mouse starts Visual or Select mode
146
147==============================================================================
148*09.3*	The clipboard
149
150In section |04.7| the basic use of the clipboard was explained.  There is one
151essential thing to explain about X-windows: There are actually two places to
152exchange text between programs.  MS-Windows doesn't have this.
153
154In X-Windows there is the "current selection".  This is the text that is
155currently highlighted.  In Vim this is the Visual area (this assumes you are
156using the default option settings).  You can paste this selection in another
157application without any further action.
158   For example, in this text select a few words with the mouse.  Vim will
159switch to Visual mode and highlight the text.  Now start another gvim, without
160a file name argument, so that it displays an empty window.  Click the middle
161mouse button.  The selected text will be inserted.
162
163The "current selection" will only remain valid until some other text is
164selected.  After doing the paste in the other gvim, now select some characters
165in that window.  You will notice that the words that were previously selected
166in the other gvim window are displayed differently.  This means that it no
167longer is the current selection.
168
169You don't need to select text with the mouse, using the keyboard commands for
170Visual mode works just as well.
171
172
173THE REAL CLIPBOARD
174
175Now for the other place with which text can be exchanged.  We call this the
176"real clipboard", to avoid confusion.  Often both the "current selection" and
177the "real clipboard" are called clipboard, you'll have to get used to that.
178   To put text on the real clipboard, select a few different words in one of
179the gvims you have running.  Then use the Edit/Copy menu entry.  Now the text
180has been copied to the real clipboard.  You can't see this, unless you have
181some application that shows the clipboard contents (e.g., KDE's Klipper).
182   Now select the other gvim, position the cursor somewhere and use the
183Edit/Paste menu.  You will see the text from the real clipboard is inserted.
184
185
186USING BOTH
187
188This use of both the "current selection" and the "real clipboard" might sound
189a bit confusing.  But it is very useful.  Let's show this with an example.
190Use one gvim with a text file and perform these actions:
191
192-  Select two words in Visual mode.
193-  Use the Edit/Copy menu to get these words onto the clipboard.
194-  Select one other word in Visual mode.
195-  Use the Edit/Paste menu item.  What will happen is that the single selected
196   word is replaced with the two words from the clipboard.
197-  Move the mouse pointer somewhere else and click the middle button.  You
198   will see that the word you just overwrote with the clipboard is inserted
199   here.
200
201If you use the "current selection" and the "real clipboard" with care, you can
202do a lot of useful editing with them.
203
204
205USING THE KEYBOARD
206
207If you don't like using the mouse, you can access the current selection and
208the real clipboard with two registers.  The "* register is for the current
209selection.
210   To make text become the current selection, use Visual mode.  For example,
211to select a whole line just press "V".
212   To insert the current selection before the cursor: >
213
214	"*P
215
216Notice the uppercase "P".  The lowercase "p" puts the text after the cursor.
217
218The "+ register is used for the real clipboard.  For example, to copy the text
219from the cursor position until the end of the line to the clipboard: >
220
221	"+y$
222
223Remember, "y" is yank, which is Vim's copy command.
224   To insert the contents of the real clipboard before the cursor: >
225
226	"+P
227
228It's the same as for the current selection, but uses the plus (+) register
229instead of the star "*" register.
230
231==============================================================================
232*09.4*	Select mode
233
234And now something that is used more often on MS-Windows than on X-Windows.
235But both can do it.  You already know about Visual mode.  Select mode is like
236Visual mode, because it is also used to select text.  But there is an obvious
237difference: When typing text, the selected text is deleted and the typed text
238replaces it.
239
240To start working with Select mode, you must first enable it (for MS-Windows
241it is probably already enabled, but you can do this anyway): >
242
243	:set selectmode+=mouse
244
245Now use the mouse to select some text.  It is highlighted like in Visual mode.
246Now press a letter.  The selected text is deleted, and the single letter
247replaces it.  You are in Insert mode now, thus you can continue typing.
248
249Since typing normal text causes the selected text to be deleted, you can not
250use the normal movement commands "hjkl", "w", etc.  Instead, use the shifted
251function keys.  <S-Left> (shifted cursor left key) moves the cursor left.  The
252selected text is changed like in Visual mode.  The other shifted cursor keys
253do what you expect.  <S-End> and <S-Home> also work.
254
255You can tune the way Select mode works with the 'selectmode' option.
256
257==============================================================================
258
259Next chapter: |usr_10.txt|  Making big changes
260
261Copyright: see |manual-copyright|
262
263vim:tw=78:ts=8:noet:ft=help:norl: