1*usr_90.txt* For Vim version 8.2. Last change: 2020 Jun 11 2 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 18 Previous chapter: |usr_46.txt| Write plugins using Vim9 script 19Table 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 39 http://www.vim.org/binaries.html ~ 40 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 62 ftp://ftp.vim.org/pub/vim/MIRRORS ~ 63 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. 67 You can get the files for Unix in one big archive that contains everything: 68 69 vim-8.2.tar.bz2 ~ 70 71You need the bzip2 program to uncompress it. 72 73 74COMPILING 75 76First create a top directory to work in, for example: > 77 78 mkdir ~/vim 79 cd ~/vim 80 81Then unpack the archives there. You can unpack it like this: > 82 83 tar xf path/vim-8.2.tar.bz2 84 85If your tar command doesn't support bz2 directly: > 86 87 bzip2 -d -c path/vim-8.2.tar.bz2 | tar xf - 88 89Change "path" to where you have downloaded the file. 90If 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 93 cd vim82/src 94 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 117If 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. 123 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 176 --with-features=tiny Compile with many features disabled. 177 --with-features=small Compile with some features disabled. 178 --with-features=big Compile with more features enabled. 179 --with-features=huge Compile with most features enabled. 180 See |+feature-list| for which feature 181 is enabled in which case. 182 183 --enable-perlinterp Enable the Perl interface. There are 184 similar arguments for ruby, python and 185 tcl. 186 187 --disable-gui Do not compile the GUI interface. 188 --without-x Do not compile X-windows features. 189 When both of these are used, Vim will 190 not connect to the X server, which 191 makes startup faster. 192 193To see the whole list use: > 194 195 ./configure --help 196 197You can find a bit of explanation for each feature, and links for more 198information here: |feature-list|. 199 For the adventurous, edit the file "feature.h". You can also change the 200source code yourself! 201 202============================================================================== 203*90.2* MS-Windows 204 205There are two ways to install the Vim program for Microsoft Windows. You can 206uncompress several archives, or use a self-installing big archive. Most users 207with fairly recent computers will prefer the second method. For the first 208one, you will need: 209 210 - An archive with binaries for Vim. 211 - The Vim runtime archive. 212 - A program to unpack the zip files. 213 214To get the Vim archives, look in this file for a mirror near you, this should 215provide the fastest download: 216 217 ftp://ftp.vim.org/pub/vim/MIRRORS ~ 218 219Or use the home site ftp.vim.org, if you think it's fast enough. Go to the 220"pc" directory and you'll find a list of files there. The version number is 221embedded in the file name. You will want to get the most recent version. 222We will use "82" here, which is version 8.2. 223 224 gvim82.exe The self-installing archive. 225 226This is all you need for the second method. Just launch the executable, and 227follow the prompts. 228 229For the first method you must choose one of the binary archives. These are 230available: 231 232 gvim82.zip The normal MS-Windows GUI version. 233 gvim82ole.zip The MS-Windows GUI version with OLE support. 234 Uses more memory, supports interfacing with 235 other OLE applications. 236 vim82w32.zip 32 bit MS-Windows console version. 237 238You only need one of them. Although you could install both a GUI and a 239console version. You always need to get the archive with runtime files. 240 241 vim82rt.zip The runtime files. 242 243Use your un-zip program to unpack the files. For example, using the "unzip" 244program: > 245 246 cd c:\ 247 unzip path\gvim82.zip 248 unzip path\vim82rt.zip 249 250This will unpack the files in the directory "c:\vim\vim82". If you already 251have a "vim" directory somewhere, you will want to move to the directory just 252above it. 253 Now change to the "vim\vim82" directory and run the install program: > 254 255 install 256 257Carefully look through the messages and select the options you want to use. 258If you finally select "do it" the install program will carry out the actions 259you selected. 260 The install program doesn't move the runtime files. They remain where you 261unpacked them. 262 263In case you are not satisfied with the features included in the supplied 264binaries, you could try compiling Vim yourself. Get the source archive from 265the same location as where the binaries are. You need a compiler for which a 266makefile exists. Microsoft Visual C, MinGW and Cygwin compilers can be used. 267Check the file src/INSTALLpc.txt for hints. 268 269============================================================================== 270*90.3* Upgrading 271 272If you are running one version of Vim and want to install another, here is 273what to do. 274 275 276UNIX 277 278When you type "make install" the runtime files will be copied to a directory 279which is specific for this version. Thus they will not overwrite a previous 280version. This makes it possible to use two or more versions next to 281each other. 282 The executable "vim" will overwrite an older version. If you don't care 283about keeping the old version, running "make install" will work fine. You can 284delete the old runtime files manually. Just delete the directory with the 285version number in it and all files below it. Example: > 286 287 rm -rf /usr/local/share/vim/vim74 288 289There are normally no changed files below this directory. If you did change 290the "filetype.vim" file, for example, you better merge the changes into the 291new version before deleting it. 292 293If you are careful and want to try out the new version for a while before 294switching to it, install the new version under another name. You need to 295specify a configure argument. For example: > 296 297 ./configure --with-vim-name=vim8 298 299Before running "make install", you could use "make -n install" to check that 300no valuable existing files are overwritten. 301 When you finally decide to switch to the new version, all you need to do is 302to rename the binary to "vim". For example: > 303 304 mv /usr/local/bin/vim8 /usr/local/bin/vim 305 306 307MS-WINDOWS 308 309Upgrading is mostly equal to installing a new version. Just unpack the files 310in the same place as the previous version. A new directory will be created, 311e.g., "vim82", for the files of the new version. Your runtime files, vimrc 312file, viminfo, etc. will be left alone. 313 If you want to run the new version next to the old one, you will have to do 314some handwork. Don't run the install program, it will overwrite a few files 315of the old version. Execute the new binaries by specifying the full path. 316The program should be able to automatically find the runtime files for the 317right version. However, this won't work if you set the $VIMRUNTIME variable 318somewhere. 319 If you are satisfied with the upgrade, you can delete the files of the 320previous version. See |90.5|. 321 322============================================================================== 323*90.4* Common installation issues 324 325This section describes some of the common problems that occur when installing 326Vim and suggests some solutions. It also contains answers to many 327installation questions. 328 329 330Q: I Do Not Have Root Privileges. How Do I Install Vim? (Unix) 331 332Use the following configuration command to install Vim in a directory called 333$HOME/vim: > 334 335 ./configure --prefix=$HOME 336 337This gives you a personal copy of Vim. You need to put $HOME/bin in your 338path to execute the editor. Also see |install-home|. 339 340 341Q: The Colors Are Not Right on My Screen. (Unix) 342 343Check your terminal settings by using the following command in a shell: > 344 345 echo $TERM 346 347If the terminal type listed is not correct, fix it. For more hints, see 348|06.2|. Another solution is to always use the GUI version of Vim, called 349gvim. This avoids the need for a correct terminal setup. 350 351 352Q: My Backspace And Delete Keys Don't Work Right 353 354The definition of what key sends what code is very unclear for backspace <BS> 355and Delete <Del> keys. First of all, check your $TERM setting. If there is 356nothing wrong with it, try this: > 357 358 :set t_kb=^V<BS> 359 :set t_kD=^V<Del> 360 361In the first line you need to press CTRL-V and then hit the backspace key. 362In the second line you need to press CTRL-V and then hit the Delete key. 363You can put these lines in your vimrc file, see |05.1|. A disadvantage is 364that it won't work when you use another terminal some day. Look here for 365alternate solutions: |:fixdel|. 366 367 368Q: I Am Using RedHat Linux. Can I Use the Vim That Comes with the System? 369 370By default RedHat installs a minimal version of Vim. Check your RPM packages 371for something named "Vim-enhanced-version.rpm" and install that. 372 373 374Q: How Do I Turn Syntax Coloring On? How do I make plugins work? 375 376Use the example vimrc script. You can find an explanation on how to use it 377here: |not-compatible|. 378 379See chapter 6 for information about syntax highlighting: |usr_06.txt|. 380 381 382Q: What Is a Good vimrc File to Use? 383 384See the www.vim.org Web site for several good examples. 385 386 387Q: Where Do I Find a Good Vim Plugin? 388 389See the Vim-online site: http://vim.sf.net. Many users have uploaded useful 390Vim scripts and plugins there. 391 392 393Q: Where Do I Find More Tips? 394 395See the Vim-online site: http://vim.sf.net. There is an archive with hints 396from Vim users. You might also want to search in the |maillist-archive|. 397 398============================================================================== 399*90.5* Uninstalling Vim 400 401In the unlikely event you want to uninstall Vim completely, this is how you do 402it. 403 404 405UNIX 406 407When you installed Vim as a package, check your package manager to find out 408how to remove the package again. 409 If you installed Vim from sources you can use this command: > 410 411 make uninstall 412 413However, if you have deleted the original files or you used an archive that 414someone supplied, you can't do this. Do delete the files manually, here is an 415example for when "/usr/local" was used as the root: > 416 417 rm -rf /usr/local/share/vim/vim82 418 rm /usr/local/bin/eview 419 rm /usr/local/bin/evim 420 rm /usr/local/bin/ex 421 rm /usr/local/bin/gview 422 rm /usr/local/bin/gvim 423 rm /usr/local/bin/gvim 424 rm /usr/local/bin/gvimdiff 425 rm /usr/local/bin/rgview 426 rm /usr/local/bin/rgvim 427 rm /usr/local/bin/rview 428 rm /usr/local/bin/rvim 429 rm /usr/local/bin/rvim 430 rm /usr/local/bin/view 431 rm /usr/local/bin/vim 432 rm /usr/local/bin/vimdiff 433 rm /usr/local/bin/vimtutor 434 rm /usr/local/bin/xxd 435 rm /usr/local/man/man1/eview.1 436 rm /usr/local/man/man1/evim.1 437 rm /usr/local/man/man1/ex.1 438 rm /usr/local/man/man1/gview.1 439 rm /usr/local/man/man1/gvim.1 440 rm /usr/local/man/man1/gvimdiff.1 441 rm /usr/local/man/man1/rgview.1 442 rm /usr/local/man/man1/rgvim.1 443 rm /usr/local/man/man1/rview.1 444 rm /usr/local/man/man1/rvim.1 445 rm /usr/local/man/man1/view.1 446 rm /usr/local/man/man1/vim.1 447 rm /usr/local/man/man1/vimdiff.1 448 rm /usr/local/man/man1/vimtutor.1 449 rm /usr/local/man/man1/xxd.1 450 451 452MS-WINDOWS 453 454If you installed Vim with the self-installing archive you can run 455the "uninstall-gui" program located in the same directory as the other Vim 456programs, e.g. "c:\vim\vim82". You can also launch it from the Start menu if 457installed the Vim entries there. This will remove most of the files, menu 458entries and desktop shortcuts. Some files may remain however, as they need a 459Windows restart before being deleted. 460 You will be given the option to remove the whole "vim" directory. It 461probably contains your vimrc file and other runtime files that you created, so 462be careful. 463 464Else, if you installed Vim with the zip archives, the preferred way is to use 465the "uninstall" program. You can find it in the same directory as the 466"install" program, e.g., "c:\vim\vim82". This should also work from the usual 467"install/remove software" page. 468 However, this only removes the registry entries for Vim. You have to 469delete the files yourself. Simply select the directory "vim\vim82" and delete 470it recursively. There should be no files there that you changed, but you 471might want to check that first. 472 The "vim" directory probably contains your vimrc file and other runtime 473files that you created. You might want to keep that. 474 475============================================================================== 476 477Table of contents: |usr_toc.txt| 478 479Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: 480