annotate runtime/doc/usr_09.txt @ 21905:2474c6b0c5de v8.2.1502

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