blob: d144303ee25fc0c538ca66dd43c0c369430f48e7 [file] [log] [blame]
Christian Brabandtfb792372025-03-03 08:16:27 +01001*usr_90.txt* For Vim version 9.1. Last change: 2025 Mar 03
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
Christian Brabandtfb792372025-03-03 08:16:27 +010031base. The files will be placed in subdirectories like "bin" and "share/vim".
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
33
34FROM A PACKAGE
35
Christian Brabandtfb792372025-03-03 08:16:27 +010036Depending on the Unix/Linux system used, there may exist pre-compiled binary
37packages. You need to search for this. We used to keep a list for different
38UNIX systems, but that list was outdated so the list was removed.
Bram Moolenaar071d4272004-06-13 20:20:40 +000039
Christian Brabandtfb792372025-03-03 08:16:27 +010040It is a good idea to compile your own UNIX version from the source. Also,
41creating the editor from the source allows you to control which features are
42compiled. This does require a compiler though.
Bram Moolenaar071d4272004-06-13 20:20:40 +000043
44If you have a Linux distribution, the "vi" program is probably a minimal
45version of Vim. It doesn't do syntax highlighting, for example. Try finding
46another Vim package in your distribution, or search on the web site.
47
48
49FROM SOURCES
50
51To compile and install Vim, you will need the following:
52
Christian Brabandtfb792372025-03-03 08:16:27 +010053 - A C compiler (GCC or clang preferred)
54 - git (optionally, only when cloning from github)
55 - zip/unzip (to uncompress the archive)
56 - The Vim source archives
Bram Moolenaar071d4272004-06-13 20:20:40 +000057
Christian Brabandtfb792372025-03-03 08:16:27 +010058To download the Vim source, you can either clone it from the Github project
59page: >
60 git clone https://github.com/vim/vim.git
61<
62or download the archive directly using:
Bram Moolenaar071d4272004-06-13 20:20:40 +000063
Christian Brabandtfb792372025-03-03 08:16:27 +010064 https://github.com/vim/vim/archive/refs/heads/master.zip
Bram Moolenaar071d4272004-06-13 20:20:40 +000065
66
67COMPILING
68
69First create a top directory to work in, for example: >
70
71 mkdir ~/vim
72 cd ~/vim
73
Bram Moolenaar8024f932020-01-14 19:29:13 +010074Then unpack the archives there. You can unpack it like this: >
Bram Moolenaar071d4272004-06-13 20:20:40 +000075
Christian Brabandtfb792372025-03-03 08:16:27 +010076 unzip vim-master.zip
Bram Moolenaar071d4272004-06-13 20:20:40 +000077
Bram Moolenaar071d4272004-06-13 20:20:40 +000078If you are satisfied with getting the default features, and your environment
79is setup properly, you should be able to compile Vim with just this: >
80
Christian Brabandtfb792372025-03-03 08:16:27 +010081 cd vim-master/src
Bram Moolenaar071d4272004-06-13 20:20:40 +000082 make
83
84The make program will run configure and compile everything. Further on we
85will explain how to compile with different features.
86 If there are errors while compiling, carefully look at the error messages.
87There should be a hint about what went wrong. Hopefully you will be able to
88correct it. You might have to disable some features to make Vim compile.
89Look in the Makefile for specific hints for your system.
90
91
92TESTING
93
94Now you can check if compiling worked OK: >
95
96 make test
97
98This will run a sequence of test scripts to verify that Vim works as expected.
99Vim will be started many times and all kinds of text and messages flash by.
100If it is alright you will finally see:
101
102 test results: ~
103 ALL DONE ~
104
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100105If you get "TEST FAILURE" some test failed. If there are one or two messages
106about failed tests, Vim might still work, but not perfectly. If you see a lot
107of error messages or Vim doesn't finish until the end, there must be something
108wrong. Either try to find out yourself, or find someone who can solve it.
109You could look in the |maillist-archive| for a solution. If everything else
110fails, you could ask in the vim |maillist| if someone can help you.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111
112
113INSTALLING
114 *install-home*
115If you want to install in your home directory, edit the Makefile and search
116for a line:
117
118 #prefix = $(HOME) ~
119
120Remove the # at the start of the line.
121 When installing for the whole system, Vim has most likely already selected
122a good installation directory for you. You can also specify one, see below.
123You need to become root for the following.
124
125To install Vim do: >
126
127 make install
128
129That should move all the relevant files to the right place. Now you can try
130running vim to verify that it works. Use two simple tests to check if Vim can
131find its runtime files: >
132
133 :help
134 :syntax enable
135
136If this doesn't work, use this command to check where Vim is looking for the
137runtime files: >
138
139 :echo $VIMRUNTIME
140
141You can also start Vim with the "-V" argument to see what happens during
142startup: >
143
144 vim -V
145
146Don't forget that the user manual assumes you Vim in a certain way. After
147installing Vim, follow the instructions at |not-compatible| to make Vim work
148as assumed in this manual.
149
150
151SELECTING FEATURES
152
153Vim has many ways to select features. One of the simple ways is to edit the
154Makefile. There are many directions and examples. Often you can enable or
155disable a feature by uncommenting a line.
156 An alternative is to run "configure" separately. This allows you to
157specify configuration options manually. The disadvantage is that you have to
158figure out what exactly to type.
159 Some of the most interesting configure arguments follow. These can also be
160enabled from the Makefile.
161
162 --prefix={directory} Top directory where to install Vim.
163
RestorerZac9c6d52023-10-05 22:25:12 +0200164 --with-features=tiny Compile with some features disabled.
165 --with-features=normal Compile with more features enabled.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000166 --with-features=huge Compile with most features enabled.
167 See |+feature-list| for which feature
168 is enabled in which case.
169
170 --enable-perlinterp Enable the Perl interface. There are
171 similar arguments for ruby, python and
172 tcl.
173
174 --disable-gui Do not compile the GUI interface.
175 --without-x Do not compile X-windows features.
176 When both of these are used, Vim will
177 not connect to the X server, which
178 makes startup faster.
179
180To see the whole list use: >
181
182 ./configure --help
183
184You can find a bit of explanation for each feature, and links for more
185information here: |feature-list|.
186 For the adventurous, edit the file "feature.h". You can also change the
187source code yourself!
188
189==============================================================================
190*90.2* MS-Windows
191
192There are two ways to install the Vim program for Microsoft Windows. You can
193uncompress several archives, or use a self-installing big archive. Most users
194with fairly recent computers will prefer the second method. For the first
195one, you will need:
196
197 - An archive with binaries for Vim.
198 - The Vim runtime archive.
199 - A program to unpack the zip files.
200
201To get the Vim archives, look in this file for a mirror near you, this should
202provide the fastest download:
203
Milly89872f52024-10-05 17:16:18 +0200204 ftp://ftp.vim.org/pub/vim/MIRRORS
Bram Moolenaar071d4272004-06-13 20:20:40 +0000205
206Or use the home site ftp.vim.org, if you think it's fast enough. Go to the
207"pc" directory and you'll find a list of files there. The version number is
208embedded in the file name. You will want to get the most recent version.
Bram Moolenaar8024f932020-01-14 19:29:13 +0100209We will use "82" here, which is version 8.2.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000210
Bram Moolenaar8024f932020-01-14 19:29:13 +0100211 gvim82.exe The self-installing archive.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000212
213This is all you need for the second method. Just launch the executable, and
214follow the prompts.
215
Bram Moolenaar2547aa92020-07-26 17:00:44 +0200216For the first method you must choose one of the binary archives. These are
Bram Moolenaar071d4272004-06-13 20:20:40 +0000217available:
218
Bram Moolenaar8024f932020-01-14 19:29:13 +0100219 gvim82.zip The normal MS-Windows GUI version.
220 gvim82ole.zip The MS-Windows GUI version with OLE support.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000221 Uses more memory, supports interfacing with
222 other OLE applications.
Bram Moolenaar8024f932020-01-14 19:29:13 +0100223 vim82w32.zip 32 bit MS-Windows console version.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000224
225You only need one of them. Although you could install both a GUI and a
226console version. You always need to get the archive with runtime files.
227
Bram Moolenaar8024f932020-01-14 19:29:13 +0100228 vim82rt.zip The runtime files.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229
230Use your un-zip program to unpack the files. For example, using the "unzip"
231program: >
232
233 cd c:\
Bram Moolenaar8024f932020-01-14 19:29:13 +0100234 unzip path\gvim82.zip
235 unzip path\vim82rt.zip
Bram Moolenaar071d4272004-06-13 20:20:40 +0000236
Bram Moolenaar8024f932020-01-14 19:29:13 +0100237This will unpack the files in the directory "c:\vim\vim82". If you already
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238have a "vim" directory somewhere, you will want to move to the directory just
239above it.
Bram Moolenaar8024f932020-01-14 19:29:13 +0100240 Now change to the "vim\vim82" directory and run the install program: >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000241
242 install
243
244Carefully look through the messages and select the options you want to use.
245If you finally select "do it" the install program will carry out the actions
246you selected.
247 The install program doesn't move the runtime files. They remain where you
248unpacked them.
249
250In case you are not satisfied with the features included in the supplied
251binaries, you could try compiling Vim yourself. Get the source archive from
252the same location as where the binaries are. You need a compiler for which a
Bram Moolenaar8024f932020-01-14 19:29:13 +0100253makefile exists. Microsoft Visual C, MinGW and Cygwin compilers can be used.
254Check the file src/INSTALLpc.txt for hints.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000255
256==============================================================================
257*90.3* Upgrading
258
259If you are running one version of Vim and want to install another, here is
260what to do.
261
262
263UNIX
264
265When you type "make install" the runtime files will be copied to a directory
266which is specific for this version. Thus they will not overwrite a previous
267version. This makes it possible to use two or more versions next to
268each other.
269 The executable "vim" will overwrite an older version. If you don't care
270about keeping the old version, running "make install" will work fine. You can
271delete the old runtime files manually. Just delete the directory with the
272version number in it and all files below it. Example: >
273
Bram Moolenaar8024f932020-01-14 19:29:13 +0100274 rm -rf /usr/local/share/vim/vim74
Bram Moolenaar071d4272004-06-13 20:20:40 +0000275
276There are normally no changed files below this directory. If you did change
277the "filetype.vim" file, for example, you better merge the changes into the
278new version before deleting it.
279
280If you are careful and want to try out the new version for a while before
281switching to it, install the new version under another name. You need to
282specify a configure argument. For example: >
283
Bram Moolenaar8024f932020-01-14 19:29:13 +0100284 ./configure --with-vim-name=vim8
Bram Moolenaar071d4272004-06-13 20:20:40 +0000285
286Before running "make install", you could use "make -n install" to check that
287no valuable existing files are overwritten.
288 When you finally decide to switch to the new version, all you need to do is
289to rename the binary to "vim". For example: >
290
Bram Moolenaar8024f932020-01-14 19:29:13 +0100291 mv /usr/local/bin/vim8 /usr/local/bin/vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000292
293
294MS-WINDOWS
295
296Upgrading is mostly equal to installing a new version. Just unpack the files
297in the same place as the previous version. A new directory will be created,
Bram Moolenaar8024f932020-01-14 19:29:13 +0100298e.g., "vim82", for the files of the new version. Your runtime files, vimrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000299file, viminfo, etc. will be left alone.
300 If you want to run the new version next to the old one, you will have to do
301some handwork. Don't run the install program, it will overwrite a few files
302of the old version. Execute the new binaries by specifying the full path.
303The program should be able to automatically find the runtime files for the
304right version. However, this won't work if you set the $VIMRUNTIME variable
305somewhere.
306 If you are satisfied with the upgrade, you can delete the files of the
307previous version. See |90.5|.
308
309==============================================================================
310*90.4* Common installation issues
311
312This section describes some of the common problems that occur when installing
313Vim and suggests some solutions. It also contains answers to many
314installation questions.
315
316
317Q: I Do Not Have Root Privileges. How Do I Install Vim? (Unix)
318
319Use the following configuration command to install Vim in a directory called
320$HOME/vim: >
321
322 ./configure --prefix=$HOME
323
324This gives you a personal copy of Vim. You need to put $HOME/bin in your
325path to execute the editor. Also see |install-home|.
326
327
328Q: The Colors Are Not Right on My Screen. (Unix)
329
330Check your terminal settings by using the following command in a shell: >
331
332 echo $TERM
333
334If the terminal type listed is not correct, fix it. For more hints, see
335|06.2|. Another solution is to always use the GUI version of Vim, called
336gvim. This avoids the need for a correct terminal setup.
337
338
339Q: My Backspace And Delete Keys Don't Work Right
340
341The definition of what key sends what code is very unclear for backspace <BS>
342and Delete <Del> keys. First of all, check your $TERM setting. If there is
343nothing wrong with it, try this: >
344
345 :set t_kb=^V<BS>
346 :set t_kD=^V<Del>
347
348In the first line you need to press CTRL-V and then hit the backspace key.
349In the second line you need to press CTRL-V and then hit the Delete key.
350You can put these lines in your vimrc file, see |05.1|. A disadvantage is
351that it won't work when you use another terminal some day. Look here for
352alternate solutions: |:fixdel|.
353
354
355Q: I Am Using RedHat Linux. Can I Use the Vim That Comes with the System?
356
357By default RedHat installs a minimal version of Vim. Check your RPM packages
358for something named "Vim-enhanced-version.rpm" and install that.
359
360
361Q: How Do I Turn Syntax Coloring On? How do I make plugins work?
362
363Use the example vimrc script. You can find an explanation on how to use it
364here: |not-compatible|.
365
366See chapter 6 for information about syntax highlighting: |usr_06.txt|.
367
368
369Q: What Is a Good vimrc File to Use?
370
371See the www.vim.org Web site for several good examples.
372
373
374Q: Where Do I Find a Good Vim Plugin?
375
376See the Vim-online site: http://vim.sf.net. Many users have uploaded useful
377Vim scripts and plugins there.
378
379
380Q: Where Do I Find More Tips?
381
382See the Vim-online site: http://vim.sf.net. There is an archive with hints
383from Vim users. You might also want to search in the |maillist-archive|.
384
385==============================================================================
386*90.5* Uninstalling Vim
387
388In the unlikely event you want to uninstall Vim completely, this is how you do
389it.
390
391
392UNIX
393
394When you installed Vim as a package, check your package manager to find out
395how to remove the package again.
396 If you installed Vim from sources you can use this command: >
397
398 make uninstall
399
400However, if you have deleted the original files or you used an archive that
401someone supplied, you can't do this. Do delete the files manually, here is an
402example for when "/usr/local" was used as the root: >
403
Bram Moolenaar8024f932020-01-14 19:29:13 +0100404 rm -rf /usr/local/share/vim/vim82
Bram Moolenaar071d4272004-06-13 20:20:40 +0000405 rm /usr/local/bin/eview
406 rm /usr/local/bin/evim
407 rm /usr/local/bin/ex
408 rm /usr/local/bin/gview
409 rm /usr/local/bin/gvim
410 rm /usr/local/bin/gvim
411 rm /usr/local/bin/gvimdiff
412 rm /usr/local/bin/rgview
413 rm /usr/local/bin/rgvim
414 rm /usr/local/bin/rview
415 rm /usr/local/bin/rvim
416 rm /usr/local/bin/rvim
417 rm /usr/local/bin/view
418 rm /usr/local/bin/vim
419 rm /usr/local/bin/vimdiff
420 rm /usr/local/bin/vimtutor
421 rm /usr/local/bin/xxd
422 rm /usr/local/man/man1/eview.1
423 rm /usr/local/man/man1/evim.1
424 rm /usr/local/man/man1/ex.1
425 rm /usr/local/man/man1/gview.1
426 rm /usr/local/man/man1/gvim.1
427 rm /usr/local/man/man1/gvimdiff.1
428 rm /usr/local/man/man1/rgview.1
429 rm /usr/local/man/man1/rgvim.1
430 rm /usr/local/man/man1/rview.1
431 rm /usr/local/man/man1/rvim.1
432 rm /usr/local/man/man1/view.1
433 rm /usr/local/man/man1/vim.1
434 rm /usr/local/man/man1/vimdiff.1
435 rm /usr/local/man/man1/vimtutor.1
436 rm /usr/local/man/man1/xxd.1
437
438
439MS-WINDOWS
440
441If you installed Vim with the self-installing archive you can run
442the "uninstall-gui" program located in the same directory as the other Vim
Bram Moolenaar8024f932020-01-14 19:29:13 +0100443programs, e.g. "c:\vim\vim82". You can also launch it from the Start menu if
Bram Moolenaar071d4272004-06-13 20:20:40 +0000444installed the Vim entries there. This will remove most of the files, menu
445entries and desktop shortcuts. Some files may remain however, as they need a
446Windows restart before being deleted.
447 You will be given the option to remove the whole "vim" directory. It
448probably contains your vimrc file and other runtime files that you created, so
449be careful.
450
451Else, if you installed Vim with the zip archives, the preferred way is to use
Bram Moolenaar38f1eea2019-09-27 14:19:09 +0200452the "uninstall" program. You can find it in the same directory as the
Bram Moolenaar8024f932020-01-14 19:29:13 +0100453"install" program, e.g., "c:\vim\vim82". This should also work from the usual
Bram Moolenaar38f1eea2019-09-27 14:19:09 +0200454"install/remove software" page.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000455 However, this only removes the registry entries for Vim. You have to
Bram Moolenaar8024f932020-01-14 19:29:13 +0100456delete the files yourself. Simply select the directory "vim\vim82" and delete
Bram Moolenaar071d4272004-06-13 20:20:40 +0000457it recursively. There should be no files there that you changed, but you
458might want to check that first.
459 The "vim" directory probably contains your vimrc file and other runtime
460files that you created. You might want to keep that.
461
462==============================================================================
463
464Table of contents: |usr_toc.txt|
465
Bram Moolenaard473c8c2018-08-11 18:00:22 +0200466Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: