usr_90.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. *usr_90.txt* For Vim version 9.0. Last change: 2022 May 13
  2. VIM USER MANUAL - by Bram Moolenaar
  3. Installing Vim
  4. *install*
  5. Before you can use Vim you have to install it. Depending on your system it's
  6. simple or easy. This chapter gives a few hints and also explains how
  7. upgrading to a new version is done.
  8. |90.1| Unix
  9. |90.2| MS-Windows
  10. |90.3| Upgrading
  11. |90.4| Common installation issues
  12. |90.5| Uninstalling Vim
  13. Previous chapter: |usr_52.txt| Write plugins using Vim9 script
  14. Table of contents: |usr_toc.txt|
  15. ==============================================================================
  16. *90.1* Unix
  17. First you have to decide if you are going to install Vim system-wide or for a
  18. single user. The installation is almost the same, but the directory where Vim
  19. is installed in differs.
  20. For a system-wide installation the base directory "/usr/local" is often
  21. used. But this may be different for your system. Try finding out where other
  22. packages are installed.
  23. When installing for a single user, you can use your home directory as the
  24. base. The files will be placed in subdirectories like "bin" and "shared/vim".
  25. FROM A PACKAGE
  26. You can get precompiled binaries for many different UNIX systems. There is a
  27. long list with links on this page:
  28. http://www.vim.org/binaries.html ~
  29. Volunteers maintain the binaries, so they are often out of date. It is a
  30. good idea to compile your own UNIX version from the source. Also, creating
  31. the editor from the source allows you to control which features are compiled.
  32. This does require a compiler though.
  33. If you have a Linux distribution, the "vi" program is probably a minimal
  34. version of Vim. It doesn't do syntax highlighting, for example. Try finding
  35. another Vim package in your distribution, or search on the web site.
  36. FROM SOURCES
  37. To compile and install Vim, you will need the following:
  38. - A C compiler (GCC preferred)
  39. - The GZIP program (you can get it from www.gnu.org)
  40. - The Vim source and runtime archives
  41. To get the Vim archives, look in this file for a mirror near you, this should
  42. provide the fastest download:
  43. ftp://ftp.vim.org/pub/vim/MIRRORS ~
  44. Or use the home site ftp.vim.org, if you think it's fast enough. Go to the
  45. "unix" directory and you'll find a list of files there. The version number is
  46. embedded in the file name. You will want to get the most recent version.
  47. You can get the files for Unix in one big archive that contains everything:
  48. vim-8.2.tar.bz2 ~
  49. You need the bzip2 program to uncompress it.
  50. COMPILING
  51. First create a top directory to work in, for example: >
  52. mkdir ~/vim
  53. cd ~/vim
  54. Then unpack the archives there. You can unpack it like this: >
  55. tar xf path/vim-8.2.tar.bz2
  56. If your tar command doesn't support bz2 directly: >
  57. bzip2 -d -c path/vim-8.2.tar.bz2 | tar xf -
  58. Change "path" to where you have downloaded the file.
  59. If you are satisfied with getting the default features, and your environment
  60. is setup properly, you should be able to compile Vim with just this: >
  61. cd vim82/src
  62. make
  63. The make program will run configure and compile everything. Further on we
  64. will explain how to compile with different features.
  65. If there are errors while compiling, carefully look at the error messages.
  66. There should be a hint about what went wrong. Hopefully you will be able to
  67. correct it. You might have to disable some features to make Vim compile.
  68. Look in the Makefile for specific hints for your system.
  69. TESTING
  70. Now you can check if compiling worked OK: >
  71. make test
  72. This will run a sequence of test scripts to verify that Vim works as expected.
  73. Vim will be started many times and all kinds of text and messages flash by.
  74. If it is alright you will finally see:
  75. test results: ~
  76. ALL DONE ~
  77. If you get "TEST FAILURE" some test failed. If there are one or two messages
  78. about failed tests, Vim might still work, but not perfectly. If you see a lot
  79. of error messages or Vim doesn't finish until the end, there must be something
  80. wrong. Either try to find out yourself, or find someone who can solve it.
  81. You could look in the |maillist-archive| for a solution. If everything else
  82. fails, you could ask in the vim |maillist| if someone can help you.
  83. INSTALLING
  84. *install-home*
  85. If you want to install in your home directory, edit the Makefile and search
  86. for a line:
  87. #prefix = $(HOME) ~
  88. Remove the # at the start of the line.
  89. When installing for the whole system, Vim has most likely already selected
  90. a good installation directory for you. You can also specify one, see below.
  91. You need to become root for the following.
  92. To install Vim do: >
  93. make install
  94. That should move all the relevant files to the right place. Now you can try
  95. running vim to verify that it works. Use two simple tests to check if Vim can
  96. find its runtime files: >
  97. :help
  98. :syntax enable
  99. If this doesn't work, use this command to check where Vim is looking for the
  100. runtime files: >
  101. :echo $VIMRUNTIME
  102. You can also start Vim with the "-V" argument to see what happens during
  103. startup: >
  104. vim -V
  105. Don't forget that the user manual assumes you Vim in a certain way. After
  106. installing Vim, follow the instructions at |not-compatible| to make Vim work
  107. as assumed in this manual.
  108. SELECTING FEATURES
  109. Vim has many ways to select features. One of the simple ways is to edit the
  110. Makefile. There are many directions and examples. Often you can enable or
  111. disable a feature by uncommenting a line.
  112. An alternative is to run "configure" separately. This allows you to
  113. specify configuration options manually. The disadvantage is that you have to
  114. figure out what exactly to type.
  115. Some of the most interesting configure arguments follow. These can also be
  116. enabled from the Makefile.
  117. --prefix={directory} Top directory where to install Vim.
  118. --with-features=tiny Compile with many features disabled.
  119. --with-features=small Compile with some features disabled.
  120. --with-features=big Compile with more features enabled.
  121. --with-features=huge Compile with most features enabled.
  122. See |+feature-list| for which feature
  123. is enabled in which case.
  124. --enable-perlinterp Enable the Perl interface. There are
  125. similar arguments for ruby, python and
  126. tcl.
  127. --disable-gui Do not compile the GUI interface.
  128. --without-x Do not compile X-windows features.
  129. When both of these are used, Vim will
  130. not connect to the X server, which
  131. makes startup faster.
  132. To see the whole list use: >
  133. ./configure --help
  134. You can find a bit of explanation for each feature, and links for more
  135. information here: |feature-list|.
  136. For the adventurous, edit the file "feature.h". You can also change the
  137. source code yourself!
  138. ==============================================================================
  139. *90.2* MS-Windows
  140. There are two ways to install the Vim program for Microsoft Windows. You can
  141. uncompress several archives, or use a self-installing big archive. Most users
  142. with fairly recent computers will prefer the second method. For the first
  143. one, you will need:
  144. - An archive with binaries for Vim.
  145. - The Vim runtime archive.
  146. - A program to unpack the zip files.
  147. To get the Vim archives, look in this file for a mirror near you, this should
  148. provide the fastest download:
  149. ftp://ftp.vim.org/pub/vim/MIRRORS ~
  150. Or use the home site ftp.vim.org, if you think it's fast enough. Go to the
  151. "pc" directory and you'll find a list of files there. The version number is
  152. embedded in the file name. You will want to get the most recent version.
  153. We will use "82" here, which is version 8.2.
  154. gvim82.exe The self-installing archive.
  155. This is all you need for the second method. Just launch the executable, and
  156. follow the prompts.
  157. For the first method you must choose one of the binary archives. These are
  158. available:
  159. gvim82.zip The normal MS-Windows GUI version.
  160. gvim82ole.zip The MS-Windows GUI version with OLE support.
  161. Uses more memory, supports interfacing with
  162. other OLE applications.
  163. vim82w32.zip 32 bit MS-Windows console version.
  164. You only need one of them. Although you could install both a GUI and a
  165. console version. You always need to get the archive with runtime files.
  166. vim82rt.zip The runtime files.
  167. Use your un-zip program to unpack the files. For example, using the "unzip"
  168. program: >
  169. cd c:\
  170. unzip path\gvim82.zip
  171. unzip path\vim82rt.zip
  172. This will unpack the files in the directory "c:\vim\vim82". If you already
  173. have a "vim" directory somewhere, you will want to move to the directory just
  174. above it.
  175. Now change to the "vim\vim82" directory and run the install program: >
  176. install
  177. Carefully look through the messages and select the options you want to use.
  178. If you finally select "do it" the install program will carry out the actions
  179. you selected.
  180. The install program doesn't move the runtime files. They remain where you
  181. unpacked them.
  182. In case you are not satisfied with the features included in the supplied
  183. binaries, you could try compiling Vim yourself. Get the source archive from
  184. the same location as where the binaries are. You need a compiler for which a
  185. makefile exists. Microsoft Visual C, MinGW and Cygwin compilers can be used.
  186. Check the file src/INSTALLpc.txt for hints.
  187. ==============================================================================
  188. *90.3* Upgrading
  189. If you are running one version of Vim and want to install another, here is
  190. what to do.
  191. UNIX
  192. When you type "make install" the runtime files will be copied to a directory
  193. which is specific for this version. Thus they will not overwrite a previous
  194. version. This makes it possible to use two or more versions next to
  195. each other.
  196. The executable "vim" will overwrite an older version. If you don't care
  197. about keeping the old version, running "make install" will work fine. You can
  198. delete the old runtime files manually. Just delete the directory with the
  199. version number in it and all files below it. Example: >
  200. rm -rf /usr/local/share/vim/vim74
  201. There are normally no changed files below this directory. If you did change
  202. the "filetype.vim" file, for example, you better merge the changes into the
  203. new version before deleting it.
  204. If you are careful and want to try out the new version for a while before
  205. switching to it, install the new version under another name. You need to
  206. specify a configure argument. For example: >
  207. ./configure --with-vim-name=vim8
  208. Before running "make install", you could use "make -n install" to check that
  209. no valuable existing files are overwritten.
  210. When you finally decide to switch to the new version, all you need to do is
  211. to rename the binary to "vim". For example: >
  212. mv /usr/local/bin/vim8 /usr/local/bin/vim
  213. MS-WINDOWS
  214. Upgrading is mostly equal to installing a new version. Just unpack the files
  215. in the same place as the previous version. A new directory will be created,
  216. e.g., "vim82", for the files of the new version. Your runtime files, vimrc
  217. file, viminfo, etc. will be left alone.
  218. If you want to run the new version next to the old one, you will have to do
  219. some handwork. Don't run the install program, it will overwrite a few files
  220. of the old version. Execute the new binaries by specifying the full path.
  221. The program should be able to automatically find the runtime files for the
  222. right version. However, this won't work if you set the $VIMRUNTIME variable
  223. somewhere.
  224. If you are satisfied with the upgrade, you can delete the files of the
  225. previous version. See |90.5|.
  226. ==============================================================================
  227. *90.4* Common installation issues
  228. This section describes some of the common problems that occur when installing
  229. Vim and suggests some solutions. It also contains answers to many
  230. installation questions.
  231. Q: I Do Not Have Root Privileges. How Do I Install Vim? (Unix)
  232. Use the following configuration command to install Vim in a directory called
  233. $HOME/vim: >
  234. ./configure --prefix=$HOME
  235. This gives you a personal copy of Vim. You need to put $HOME/bin in your
  236. path to execute the editor. Also see |install-home|.
  237. Q: The Colors Are Not Right on My Screen. (Unix)
  238. Check your terminal settings by using the following command in a shell: >
  239. echo $TERM
  240. If the terminal type listed is not correct, fix it. For more hints, see
  241. |06.2|. Another solution is to always use the GUI version of Vim, called
  242. gvim. This avoids the need for a correct terminal setup.
  243. Q: My Backspace And Delete Keys Don't Work Right
  244. The definition of what key sends what code is very unclear for backspace <BS>
  245. and Delete <Del> keys. First of all, check your $TERM setting. If there is
  246. nothing wrong with it, try this: >
  247. :set t_kb=^V<BS>
  248. :set t_kD=^V<Del>
  249. In the first line you need to press CTRL-V and then hit the backspace key.
  250. In the second line you need to press CTRL-V and then hit the Delete key.
  251. You can put these lines in your vimrc file, see |05.1|. A disadvantage is
  252. that it won't work when you use another terminal some day. Look here for
  253. alternate solutions: |:fixdel|.
  254. Q: I Am Using RedHat Linux. Can I Use the Vim That Comes with the System?
  255. By default RedHat installs a minimal version of Vim. Check your RPM packages
  256. for something named "Vim-enhanced-version.rpm" and install that.
  257. Q: How Do I Turn Syntax Coloring On? How do I make plugins work?
  258. Use the example vimrc script. You can find an explanation on how to use it
  259. here: |not-compatible|.
  260. See chapter 6 for information about syntax highlighting: |usr_06.txt|.
  261. Q: What Is a Good vimrc File to Use?
  262. See the www.vim.org Web site for several good examples.
  263. Q: Where Do I Find a Good Vim Plugin?
  264. See the Vim-online site: http://vim.sf.net. Many users have uploaded useful
  265. Vim scripts and plugins there.
  266. Q: Where Do I Find More Tips?
  267. See the Vim-online site: http://vim.sf.net. There is an archive with hints
  268. from Vim users. You might also want to search in the |maillist-archive|.
  269. ==============================================================================
  270. *90.5* Uninstalling Vim
  271. In the unlikely event you want to uninstall Vim completely, this is how you do
  272. it.
  273. UNIX
  274. When you installed Vim as a package, check your package manager to find out
  275. how to remove the package again.
  276. If you installed Vim from sources you can use this command: >
  277. make uninstall
  278. However, if you have deleted the original files or you used an archive that
  279. someone supplied, you can't do this. Do delete the files manually, here is an
  280. example for when "/usr/local" was used as the root: >
  281. rm -rf /usr/local/share/vim/vim82
  282. rm /usr/local/bin/eview
  283. rm /usr/local/bin/evim
  284. rm /usr/local/bin/ex
  285. rm /usr/local/bin/gview
  286. rm /usr/local/bin/gvim
  287. rm /usr/local/bin/gvim
  288. rm /usr/local/bin/gvimdiff
  289. rm /usr/local/bin/rgview
  290. rm /usr/local/bin/rgvim
  291. rm /usr/local/bin/rview
  292. rm /usr/local/bin/rvim
  293. rm /usr/local/bin/rvim
  294. rm /usr/local/bin/view
  295. rm /usr/local/bin/vim
  296. rm /usr/local/bin/vimdiff
  297. rm /usr/local/bin/vimtutor
  298. rm /usr/local/bin/xxd
  299. rm /usr/local/man/man1/eview.1
  300. rm /usr/local/man/man1/evim.1
  301. rm /usr/local/man/man1/ex.1
  302. rm /usr/local/man/man1/gview.1
  303. rm /usr/local/man/man1/gvim.1
  304. rm /usr/local/man/man1/gvimdiff.1
  305. rm /usr/local/man/man1/rgview.1
  306. rm /usr/local/man/man1/rgvim.1
  307. rm /usr/local/man/man1/rview.1
  308. rm /usr/local/man/man1/rvim.1
  309. rm /usr/local/man/man1/view.1
  310. rm /usr/local/man/man1/vim.1
  311. rm /usr/local/man/man1/vimdiff.1
  312. rm /usr/local/man/man1/vimtutor.1
  313. rm /usr/local/man/man1/xxd.1
  314. MS-WINDOWS
  315. If you installed Vim with the self-installing archive you can run
  316. the "uninstall-gui" program located in the same directory as the other Vim
  317. programs, e.g. "c:\vim\vim82". You can also launch it from the Start menu if
  318. installed the Vim entries there. This will remove most of the files, menu
  319. entries and desktop shortcuts. Some files may remain however, as they need a
  320. Windows restart before being deleted.
  321. You will be given the option to remove the whole "vim" directory. It
  322. probably contains your vimrc file and other runtime files that you created, so
  323. be careful.
  324. Else, if you installed Vim with the zip archives, the preferred way is to use
  325. the "uninstall" program. You can find it in the same directory as the
  326. "install" program, e.g., "c:\vim\vim82". This should also work from the usual
  327. "install/remove software" page.
  328. However, this only removes the registry entries for Vim. You have to
  329. delete the files yourself. Simply select the directory "vim\vim82" and delete
  330. it recursively. There should be no files there that you changed, but you
  331. might want to check that first.
  332. The "vim" directory probably contains your vimrc file and other runtime
  333. files that you created. You might want to keep that.
  334. ==============================================================================
  335. Table of contents: |usr_toc.txt|
  336. Copyright: see |manual-copyright| vim:tw=78:ts=8:noet:ft=help:norl: