annotate runtime/doc/usr_31.txt @ 20554:296fd130e061

Added tag v8.2.0830 for changeset 2c808d01a9fde8dfc6bfa2bd651b85304e398e59
author Bram Moolenaar <Bram@vim.org>
date Tue, 26 May 2020 22:15:04 +0200
parents af69c9335223
children 1b345fb68ae3
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_31.txt* For Vim version 8.2. Last change: 2007 May 08
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 Exploiting the GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 Vim works well in a terminal, but the GUI has a few extra items. A file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 browser can be used for commands that use a file. A dialog to make a choice
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 between alternatives. Use keyboard shortcuts to access menu items quickly.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 |31.1| The file browser
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 |31.2| Confirmation
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 |31.3| Menu shortcuts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 |31.4| Vim window position and size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 |31.5| Various
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
800
d8f905020502 updated for version 7.0b
vimboss
parents: 697
diff changeset
18 Next chapter: |usr_32.txt| The undo tree
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 Previous chapter: |usr_30.txt| Editing programs
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 *31.1* The file browser
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 When using the File/Open... menu you get a file browser. This makes it easier
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 to find the file you want to edit. But what if you want to split a window to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 edit another file? There is no menu entry for this. You could first use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 Window/Split and then File/Open..., but that's more work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 Since you are typing most commands in Vim, opening the file browser with a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 typed command is possible as well. To make the split command use the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 browser, prepend "browse": >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 :browse split
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 Select a file and then the ":split" command will be executed with it. If you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 cancel the file dialog nothing happens, the window isn't split.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 You can also specify a file name argument. This is used to tell the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 browser where to start. Example: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 :browse split /etc
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 The file browser will pop up, starting in the directory "/etc".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 The ":browse" command can be prepended to just about any command that opens a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 If no directory is specified, Vim will decide where to start the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 browser. By default it uses the same directory as the last time. Thus when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 you used ":browse split" and selected a file in "/usr/local/share", the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 time you use a ":browse" it will start in "/usr/local/share" again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 This can be changed with the 'browsedir' option. It can have one of three
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 values:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 last Use the last directory browsed (default)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 buffer Use the same directory as the current buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 current use the current directory
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 For example, when you are in the directory "/usr", editing the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 "/usr/local/share/readme", then the command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 :set browsedir=buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 :browse edit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 Will start the browser in "/usr/local/share". Alternatively: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 :set browsedir=current
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 :browse edit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 Will start the browser in "/usr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 Note:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 To avoid using the mouse, most file browsers offer using key presses
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 to navigate. Since this is different for every system, it is not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 explained here. Vim uses a standard browser when possible, your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 system documentation should contain an explanation on the keyboard
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 shortcuts somewhere.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 When you are not using the GUI version, you could use the file explorer window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 to select files like in a file browser. However, this doesn't work for the
697
f08390485cd3 updated for version 7.0210
vimboss
parents: 7
diff changeset
79 ":browse" command. See |netrw-browse|.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 *31.2* Confirmation
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 Vim protects you from accidentally overwriting a file and other ways to lose
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 changes. If you do something that might be a bad thing to do, Vim produces an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 error message and suggests appending ! if you really want to do it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 To avoid retyping the command with the !, you can make Vim give you a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 dialog. You can then press "OK" or "Cancel" to tell Vim what you want.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 For example, you are editing a file and made changes to it. You start
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 editing another file with: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 :confirm edit foo.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 Vim will pop up a dialog that looks something like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 +-----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 | ? Save changes to "bar.txt"? |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 | |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 | YES NO CANCEL |
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 +-----------------------------------+
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 Now make your choice. If you do want to save the changes, select "YES". If
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 you want to lose the changes for ever: "NO". If you forgot what you were
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 doing and want to check what really changed use "CANCEL". You will be back in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 the same file, with the changes still there.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 Just like ":browse", the ":confirm" command can be prepended to most commands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 that edit another file. They can also be combined: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 :confirm browse edit
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 This will produce a dialog when the current buffer was changed. Then it will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 pop up a file browser to select the file to edit.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 Note:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 In the dialog you can use the keyboard to select the choice.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 Typically the <Tab> key and the cursor keys change the choice.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 Pressing <Enter> selects the choice. This depends on the system
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 though.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 When you are not using the GUI, the ":confirm" command works as well. Instead
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 of popping up a dialog, Vim will print the message at the bottom of the Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 window and ask you to press a key to make a choice. >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 :confirm edit main.c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 < Save changes to "Untitled"? ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 [Y]es, (N)o, (C)ancel: ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 You can now press the single key for the choice. You don't have to press
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 <Enter>, unlike other typing on the command line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 *31.3* Menu shortcuts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 The keyboard is used for all Vim commands. The menus provide a simple way to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 select commands, without knowing what they are called. But you have to move
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 your hand from the keyboard and grab the mouse.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 Menus can often be selected with keys as well. This depends on your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 system, but most often it works this way. Use the <Alt> key in combination
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 with the underlined letter of a menu. For example, <A-w> (<Alt> and w) pops
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 up the Window menu.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 In the Window menu, the "split" item has the p underlined. To select it,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 let go of the <Alt> key and press p.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 After the first selection of a menu with the <Alt> key, you can use the cursor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 keys to move through the menus. <Right> selects a submenu and <left> closes
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 it. <Esc> also closes a menu. <Enter> selects a menu item.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 There is a conflict between using the <Alt> key to select menu items, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 using <Alt> key combinations for mappings. The 'winaltkeys' option tells Vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 what it should do with the <Alt> key.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 The default value "menu" is the smart choice: If the key combination is a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 menu shortcut it can't be mapped. All other keys are available for mapping.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 The value "no" doesn't use any <Alt> keys for the menus. Thus you must use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 the mouse for the menus, and all <Alt> keys can be mapped.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 The value "yes" means that Vim will use any <Alt> keys for the menus. Some
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 <Alt> key combinations may also do other things than selecting a menu.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 *31.4* Vim window position and size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 To see the current Vim window position on the screen use: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 :winpos
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 This will only work in the GUI. The output may look like this:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 Window position: X 272, Y 103 ~
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 The position is given in screen pixels. Now you can use the numbers to move
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 Vim somewhere else. For example, to move it to the left a hundred pixels: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 :winpos 172 103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 Note:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 There may be a small offset between the reported position and where
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 the window moves. This is because of the border around the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 This is added by the window manager.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 You can use this command in your startup script to position the window at a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 specific position.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 The size of the Vim window is computed in characters. Thus this depends on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 the size of the font being used. You can see the current size with this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 command: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 :set lines columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 To change the size set the 'lines' and/or 'columns' options to a new value: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 :set lines=50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 :set columns=80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 Obtaining the size works in a terminal just like in the GUI. Setting the size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 is not possible in most terminals.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 You can start the X-Windows version of gvim with an argument to specify the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 size and position of the window: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 gvim -geometry {width}x{height}+{x_offset}+{y_offset}
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 {width} and {height} are in characters, {x_offset} and {y_offset} are in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 pixels. Example: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 gvim -geometry 80x25+100+300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 *31.5* Various
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 You can use gvim to edit an e-mail message. In your e-mail program you must
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 select gvim to be the editor for messages. When you try that, you will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 see that it doesn't work: The mail program thinks that editing is finished,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 while gvim is still running!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 What happens is that gvim disconnects from the shell it was started in.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 That is fine when you start gvim in a terminal, so that you can do other work
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 in that terminal. But when you really want to wait for gvim to finish, you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 must prevent it from disconnecting. The "-f" argument does this: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 gvim -f file.txt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 The "-f" stands for foreground. Now Vim will block the shell it was started
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 in until you finish editing and exit.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 DELAYED START OF THE GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 On Unix it's possible to first start Vim in a terminal. That's useful if you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 do various tasks in the same shell. If you are editing a file and decide you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 want to use the GUI after all, you can start it with: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 :gui
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 Vim will open the GUI window and no longer use the terminal. You can continue
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 using the terminal for something else. The "-f" argument is used here to run
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 the GUI in the foreground. You can also use ":gui -f".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 THE GVIM STARTUP FILE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 When gvim starts, it reads the gvimrc file. That's similar to the vimrc file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 used when starting Vim. The gvimrc file can be used for settings and commands
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 that are only to be used when the GUI is going to be started. For example,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 you can set the 'lines' option to set a different window size: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 :set lines=55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
2033
de5a43c5eedc Update documentation files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
248 You don't want to do this in a terminal, since its size is fixed (except for
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 an xterm that supports resizing).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 The gvimrc file is searched for in the same locations as the vimrc file.
1215
1d08aac0aea9 updated for version 7.1b
vimboss
parents: 1123
diff changeset
251 Normally its name is "~/.gvimrc" for Unix and "$VIM/_gvimrc" for MS-Windows.
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
252 The $MYGVIMRC environment variable is set to it, thus you can use this command
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
253 to edit the file, if you have one: >
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
254
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
255 :edit $MYGVIMRC
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 810
diff changeset
256 <
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 If for some reason you don't want to use the normal gvimrc file, you can
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 specify another one with the "-U" argument: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 gvim -U thisrc ...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 That allows starting gvim for different kinds of editing. You could set
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 another font size, for example.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 To completely skip reading a gvimrc file: >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 gvim -U NONE ...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 ==============================================================================
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
800
d8f905020502 updated for version 7.0b
vimboss
parents: 697
diff changeset
270 Next chapter: |usr_32.txt| The undo tree
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271
14519
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13963
diff changeset
272 Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: