blob: 9d75989571cd0587fcf15f2855efef529cc84f6e [file] [log] [blame]
Milly89872f52024-10-05 17:16:18 +02001*usr_90.txt* For Vim version 9.1. Last change: 2024 Oct 05
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3 VIM USER MANUAL - by Bram Moolenaar
4
5 Installing Vim
6
7 *install*
8Before you can use Vim you have to install it. Depending on your system it's
9simple or easy. This chapter gives a few hints and also explains how
10upgrading to a new version is done.
11
12|90.1| Unix
13|90.2| MS-Windows
14|90.3| Upgrading
15|90.4| Common installation issues
16|90.5| Uninstalling Vim
17
Bram Moolenaar30ab04e2022-05-14 13:33:50 +010018 Previous chapter: |usr_52.txt| Write plugins using Vim9 script
Bram Moolenaar071d4272004-06-13 20:20:40 +000019Table of contents: |usr_toc.txt|
20
21==============================================================================
22*90.1* Unix
23
24First you have to decide if you are going to install Vim system-wide or for a
25single user. The installation is almost the same, but the directory where Vim
26is installed in differs.
27 For a system-wide installation the base directory "/usr/local" is often
28used. But this may be different for your system. Try finding out where other
29packages are installed.
30 When installing for a single user, you can use your home directory as the
31base. The files will be placed in subdirectories like "bin" and "shared/vim".
32
33
34FROM A PACKAGE
35
36You can get precompiled binaries for many different UNIX systems. There is a
37long list with links on this page:
38
Milly89872f52024-10-05 17:16:18 +020039 http://www.vim.org/binaries.html
Bram Moolenaar071d4272004-06-13 20:20:40 +000040
41Volunteers maintain the binaries, so they are often out of date. It is a
42good idea to compile your own UNIX version from the source. Also, creating
43the editor from the source allows you to control which features are compiled.
44This does require a compiler though.
45
46If you have a Linux distribution, the "vi" program is probably a minimal
47version of Vim. It doesn't do syntax highlighting, for example. Try finding
48another Vim package in your distribution, or search on the web site.
49
50
51FROM SOURCES
52
53To compile and install Vim, you will need the following:
54
55 - A C compiler (GCC preferred)
56 - The GZIP program (you can get it from www.gnu.org)
57 - The Vim source and runtime archives
58
59To get the Vim archives, look in this file for a mirror near you, this should
60provide the fastest download:
61
Milly89872f52024-10-05 17:16:18 +020062 ftp://ftp.vim.org/pub/vim/MIRRORS
Bram Moolenaar071d4272004-06-13 20:20:40 +000063
64Or use the home site ftp.vim.org, if you think it's fast enough. Go to the
65"unix" directory and you'll find a list of files there. The version number is
66embedded in the file name. You will want to get the most recent version.
Bram Moolenaar8024f932020-01-14 19:29:13 +010067 You can get the files for Unix in one big archive that contains everything:
Bram Moolenaar071d4272004-06-13 20:20:40 +000068
Bram Moolenaar8024f932020-01-14 19:29:13 +010069 vim-8.2.tar.bz2 ~
Bram Moolenaar071d4272004-06-13 20:20:40 +000070
Bram Moolenaar8024f932020-01-14 19:29:13 +010071You need the bzip2 program to uncompress it.
Bram Moolenaar071d4272004-06-13 20:20:40 +000072
73
74COMPILING
75
76First create a top directory to work in, for example: >
77
78 mkdir ~/vim
79 cd ~/vim
80
Bram Moolenaar8024f932020-01-14 19:29:13 +010081Then unpack the archives there. You can unpack it like this: >
Bram Moolenaar071d4272004-06-13 20:20:40 +000082
Bram Moolenaar8024f932020-01-14 19:29:13 +010083 tar xf path/vim-8.2.tar.bz2
Bram Moolenaar071d4272004-06-13 20:20:40 +000084
Bram Moolenaar8024f932020-01-14 19:29:13 +010085If your tar command doesn't support bz2 directly: >
Bram Moolenaar071d4272004-06-13 20:20:40 +000086
Bram Moolenaar8024f932020-01-14 19:29:13 +010087 bzip2 -d -c path/vim-8.2.tar.bz2 | tar xf -
Bram Moolenaar071d4272004-06-13 20:20:40 +000088
Bram Moolenaar8024f932020-01-14 19:29:13 +010089Change "path" to where you have downloaded the file.
Bram Moolenaar071d4272004-06-13 20:20:40 +000090If you are satisfied with getting the default features, and your environment
91is setup properly, you should be able to compile Vim with just this: >
92
Bram Moolenaar8024f932020-01-14 19:29:13 +010093 cd vim82/src
Bram Moolenaar071d4272004-06-13 20:20:40 +000094 make
95
96The make program will run configure and compile everything. Further on we
97will explain how to compile with different features.
98 If there are errors while compiling, carefully look at the error messages.
99There should be a hint about what went wrong. Hopefully you will be able to
100correct it. You might have to disable some features to make Vim compile.
101Look in the Makefile for specific hints for your system.
102
103
104TESTING
105
106Now you can check if compiling worked OK: >
107
108 make test
109
110This will run a sequence of test scripts to verify that Vim works as expected.
111Vim will be started many times and all kinds of text and messages flash by.
112If it is alright you will finally see:
113
114 test results: ~
115 ALL DONE ~
116
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100117If you get "TEST FAILURE" some test failed. If there are one or two messages
118about failed tests, Vim might still work, but not perfectly. If you see a lot
119of error messages or Vim doesn't finish until the end, there must be something
120wrong. Either try to find out yourself, or find someone who can solve it.
121You could look in the |maillist-archive| for a solution. If everything else
122fails, you could ask in the vim |maillist| if someone can help you.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000123
124
125INSTALLING
126 *install-home*
127If you want to install in your home directory, edit the Makefile and search
128for a line:
129
130 #prefix = $(HOME) ~
131
132Remove the # at the start of the line.
133 When installing for the whole system, Vim has most likely already selected
134a good installation directory for you. You can also specify one, see below.
135You need to become root for the following.
136
137To install Vim do: >
138
139 make install
140
141That should move all the relevant files to the right place. Now you can try
142running vim to verify that it works. Use two simple tests to check if Vim can
143find its runtime files: >
144
145 :help
146 :syntax enable
147
148If this doesn't work, use this command to check where Vim is looking for the
149runtime files: >
150
151 :echo $VIMRUNTIME
152
153You can also start Vim with the "-V" argument to see what happens during
154startup: >
155
156 vim -V
157
158Don't forget that the user manual assumes you Vim in a certain way. After
159installing Vim, follow the instructions at |not-compatible| to make Vim work
160as assumed in this manual.
161
162
163SELECTING FEATURES
164
165Vim has many ways to select features. One of the simple ways is to edit the
166Makefile. There are many directions and examples. Often you can enable or
167disable a feature by uncommenting a line.
168 An alternative is to run "configure" separately. This allows you to
169specify configuration options manually. The disadvantage is that you have to
170figure out what exactly to type.
171 Some of the most interesting configure arguments follow. These can also be
172enabled from the Makefile.
173
174 --prefix={directory} Top directory where to install Vim.
175
RestorerZac9c6d52023-10-05 22:25:12 +0200176 --with-features=tiny Compile with some features disabled.
177 --with-features=normal Compile with more features enabled.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000178 --with-features=huge Compile with most features enabled.
179 See |+feature-list| for which feature
180 is enabled in which case.
181
182 --enable-perlinterp Enable the Perl interface. There are
183 similar arguments for ruby, python and
184 tcl.
185
186 --disable-gui Do not compile the GUI interface.
187 --without-x Do not compile X-windows features.
188 When both of these are used, Vim will
189 not connect to the X server, which
190 makes startup faster.
191
192To see the whole list use: >
193
194 ./configure --help
195
196You can find a bit of explanation for each feature, and links for more
197information here: |feature-list|.
198 For the adventurous, edit the file "feature.h". You can also change the
199source code yourself!
200
201==============================================================================
202*90.2* MS-Windows
203
204There are two ways to install the Vim program for Microsoft Windows. You can
205uncompress several archives, or use a self-installing big archive. Most users
206with fairly recent computers will prefer the second method. For the first
207one, you will need:
208
209 - An archive with binaries for Vim.
210 - The Vim runtime archive.
211 - A program to unpack the zip files.
212
213To get the Vim archives, look in this file for a mirror near you, this should
214provide the fastest download:
215
Milly89872f52024-10-05 17:16:18 +0200216 ftp://ftp.vim.org/pub/vim/MIRRORS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000217
218Or use the home site ftp.vim.org, if you think it's fast enough. Go to the
219"pc" directory and you'll find a list of files there. The version number is
220embedded in the file name. You will want to get the most recent version.
Bram Moolenaar8024f932020-01-14 19:29:13 +0100221We will use "82" here, which is version 8.2.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000222
Bram Moolenaar8024f932020-01-14 19:29:13 +0100223 gvim82.exe The self-installing archive.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000224
225This is all you need for the second method. Just launch the executable, and
226follow the prompts.
227
Bram Moolenaar2547aa92020-07-26 17:00:44 +0200228For the first method you must choose one of the binary archives. These are
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229available:
230
Bram Moolenaar8024f932020-01-14 19:29:13 +0100231 gvim82.zip The normal MS-Windows GUI version.
232 gvim82ole.zip The MS-Windows GUI version with OLE support.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000233 Uses more memory, supports interfacing with
234 other OLE applications.
Bram Moolenaar8024f932020-01-14 19:29:13 +0100235 vim82w32.zip 32 bit MS-Windows console version.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000236
237You only need one of them. Although you could install both a GUI and a
238console version. You always need to get the archive with runtime files.
239
Bram Moolenaar8024f932020-01-14 19:29:13 +0100240 vim82rt.zip The runtime files.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000241
242Use your un-zip program to unpack the files. For example, using the "unzip"
243program: >
244
245 cd c:\
Bram Moolenaar8024f932020-01-14 19:29:13 +0100246 unzip path\gvim82.zip
247 unzip path\vim82rt.zip
Bram Moolenaar071d4272004-06-13 20:20:40 +0000248
Bram Moolenaar8024f932020-01-14 19:29:13 +0100249This will unpack the files in the directory "c:\vim\vim82". If you already
Bram Moolenaar071d4272004-06-13 20:20:40 +0000250have a "vim" directory somewhere, you will want to move to the directory just
251above it.
Bram Moolenaar8024f932020-01-14 19:29:13 +0100252 Now change to the "vim\vim82" directory and run the install program: >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253
254 install
255
256Carefully look through the messages and select the options you want to use.
257If you finally select "do it" the install program will carry out the actions
258you selected.
259 The install program doesn't move the runtime files. They remain where you
260unpacked them.
261
262In case you are not satisfied with the features included in the supplied
263binaries, you could try compiling Vim yourself. Get the source archive from
264the same location as where the binaries are. You need a compiler for which a
Bram Moolenaar8024f932020-01-14 19:29:13 +0100265makefile exists. Microsoft Visual C, MinGW and Cygwin compilers can be used.
266Check the file src/INSTALLpc.txt for hints.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000267
268==============================================================================
269*90.3* Upgrading
270
271If you are running one version of Vim and want to install another, here is
272what to do.
273
274
275UNIX
276
277When you type "make install" the runtime files will be copied to a directory
278which is specific for this version. Thus they will not overwrite a previous
279version. This makes it possible to use two or more versions next to
280each other.
281 The executable "vim" will overwrite an older version. If you don't care
282about keeping the old version, running "make install" will work fine. You can
283delete the old runtime files manually. Just delete the directory with the
284version number in it and all files below it. Example: >
285
Bram Moolenaar8024f932020-01-14 19:29:13 +0100286 rm -rf /usr/local/share/vim/vim74
Bram Moolenaar071d4272004-06-13 20:20:40 +0000287
288There are normally no changed files below this directory. If you did change
289the "filetype.vim" file, for example, you better merge the changes into the
290new version before deleting it.
291
292If you are careful and want to try out the new version for a while before
293switching to it, install the new version under another name. You need to
294specify a configure argument. For example: >
295
Bram Moolenaar8024f932020-01-14 19:29:13 +0100296 ./configure --with-vim-name=vim8
Bram Moolenaar071d4272004-06-13 20:20:40 +0000297
298Before running "make install", you could use "make -n install" to check that
299no valuable existing files are overwritten.
300 When you finally decide to switch to the new version, all you need to do is
301to rename the binary to "vim". For example: >
302
Bram Moolenaar8024f932020-01-14 19:29:13 +0100303 mv /usr/local/bin/vim8 /usr/local/bin/vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000304
305
306MS-WINDOWS
307
308Upgrading is mostly equal to installing a new version. Just unpack the files
309in the same place as the previous version. A new directory will be created,
Bram Moolenaar8024f932020-01-14 19:29:13 +0100310e.g., "vim82", for the files of the new version. Your runtime files, vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000311file, viminfo, etc. will be left alone.
312 If you want to run the new version next to the old one, you will have to do
313some handwork. Don't run the install program, it will overwrite a few files
314of the old version. Execute the new binaries by specifying the full path.
315The program should be able to automatically find the runtime files for the
316right version. However, this won't work if you set the $VIMRUNTIME variable
317somewhere.
318 If you are satisfied with the upgrade, you can delete the files of the
319previous version. See |90.5|.
320
321==============================================================================
322*90.4* Common installation issues
323
324This section describes some of the common problems that occur when installing
325Vim and suggests some solutions. It also contains answers to many
326installation questions.
327
328
329Q: I Do Not Have Root Privileges. How Do I Install Vim? (Unix)
330
331Use the following configuration command to install Vim in a directory called
332$HOME/vim: >
333
334 ./configure --prefix=$HOME
335
336This gives you a personal copy of Vim. You need to put $HOME/bin in your
337path to execute the editor. Also see |install-home|.
338
339
340Q: The Colors Are Not Right on My Screen. (Unix)
341
342Check your terminal settings by using the following command in a shell: >
343
344 echo $TERM
345
346If the terminal type listed is not correct, fix it. For more hints, see
347|06.2|. Another solution is to always use the GUI version of Vim, called
348gvim. This avoids the need for a correct terminal setup.
349
350
351Q: My Backspace And Delete Keys Don't Work Right
352
353The definition of what key sends what code is very unclear for backspace <BS>
354and Delete <Del> keys. First of all, check your $TERM setting. If there is
355nothing wrong with it, try this: >
356
357 :set t_kb=^V<BS>
358 :set t_kD=^V<Del>
359
360In the first line you need to press CTRL-V and then hit the backspace key.
361In the second line you need to press CTRL-V and then hit the Delete key.
362You can put these lines in your vimrc file, see |05.1|. A disadvantage is
363that it won't work when you use another terminal some day. Look here for
364alternate solutions: |:fixdel|.
365
366
367Q: I Am Using RedHat Linux. Can I Use the Vim That Comes with the System?
368
369By default RedHat installs a minimal version of Vim. Check your RPM packages
370for something named "Vim-enhanced-version.rpm" and install that.
371
372
373Q: How Do I Turn Syntax Coloring On? How do I make plugins work?
374
375Use the example vimrc script. You can find an explanation on how to use it
376here: |not-compatible|.
377
378See chapter 6 for information about syntax highlighting: |usr_06.txt|.
379
380
381Q: What Is a Good vimrc File to Use?
382
383See the www.vim.org Web site for several good examples.
384
385
386Q: Where Do I Find a Good Vim Plugin?
387
388See the Vim-online site: http://vim.sf.net. Many users have uploaded useful
389Vim scripts and plugins there.
390
391
392Q: Where Do I Find More Tips?
393
394See the Vim-online site: http://vim.sf.net. There is an archive with hints
395from Vim users. You might also want to search in the |maillist-archive|.
396
397==============================================================================
398*90.5* Uninstalling Vim
399
400In the unlikely event you want to uninstall Vim completely, this is how you do
401it.
402
403
404UNIX
405
406When you installed Vim as a package, check your package manager to find out
407how to remove the package again.
408 If you installed Vim from sources you can use this command: >
409
410 make uninstall
411
412However, if you have deleted the original files or you used an archive that
413someone supplied, you can't do this. Do delete the files manually, here is an
414example for when "/usr/local" was used as the root: >
415
Bram Moolenaar8024f932020-01-14 19:29:13 +0100416 rm -rf /usr/local/share/vim/vim82
Bram Moolenaar071d4272004-06-13 20:20:40 +0000417 rm /usr/local/bin/eview
418 rm /usr/local/bin/evim
419 rm /usr/local/bin/ex
420 rm /usr/local/bin/gview
421 rm /usr/local/bin/gvim
422 rm /usr/local/bin/gvim
423 rm /usr/local/bin/gvimdiff
424 rm /usr/local/bin/rgview
425 rm /usr/local/bin/rgvim
426 rm /usr/local/bin/rview
427 rm /usr/local/bin/rvim
428 rm /usr/local/bin/rvim
429 rm /usr/local/bin/view
430 rm /usr/local/bin/vim
431 rm /usr/local/bin/vimdiff
432 rm /usr/local/bin/vimtutor
433 rm /usr/local/bin/xxd
434 rm /usr/local/man/man1/eview.1
435 rm /usr/local/man/man1/evim.1
436 rm /usr/local/man/man1/ex.1
437 rm /usr/local/man/man1/gview.1
438 rm /usr/local/man/man1/gvim.1
439 rm /usr/local/man/man1/gvimdiff.1
440 rm /usr/local/man/man1/rgview.1
441 rm /usr/local/man/man1/rgvim.1
442 rm /usr/local/man/man1/rview.1
443 rm /usr/local/man/man1/rvim.1
444 rm /usr/local/man/man1/view.1
445 rm /usr/local/man/man1/vim.1
446 rm /usr/local/man/man1/vimdiff.1
447 rm /usr/local/man/man1/vimtutor.1
448 rm /usr/local/man/man1/xxd.1
449
450
451MS-WINDOWS
452
453If you installed Vim with the self-installing archive you can run
454the "uninstall-gui" program located in the same directory as the other Vim
Bram Moolenaar8024f932020-01-14 19:29:13 +0100455programs, e.g. "c:\vim\vim82". You can also launch it from the Start menu if
Bram Moolenaar071d4272004-06-13 20:20:40 +0000456installed the Vim entries there. This will remove most of the files, menu
457entries and desktop shortcuts. Some files may remain however, as they need a
458Windows restart before being deleted.
459 You will be given the option to remove the whole "vim" directory. It
460probably contains your vimrc file and other runtime files that you created, so
461be careful.
462
463Else, if you installed Vim with the zip archives, the preferred way is to use
Bram Moolenaar38f1eea2019-09-27 14:19:09 +0200464the "uninstall" program. You can find it in the same directory as the
Bram Moolenaar8024f932020-01-14 19:29:13 +0100465"install" program, e.g., "c:\vim\vim82". This should also work from the usual
Bram Moolenaar38f1eea2019-09-27 14:19:09 +0200466"install/remove software" page.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467 However, this only removes the registry entries for Vim. You have to
Bram Moolenaar8024f932020-01-14 19:29:13 +0100468delete the files yourself. Simply select the directory "vim\vim82" and delete
Bram Moolenaar071d4272004-06-13 20:20:40 +0000469it recursively. There should be no files there that you changed, but you
470might want to check that first.
471 The "vim" directory probably contains your vimrc file and other runtime
472files that you created. You might want to keep that.
473
474==============================================================================
475
476Table of contents: |usr_toc.txt|
477
Bram Moolenaard473c8c2018-08-11 18:00:22 +0200478Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: