« Beautiful Bing Images on Your Computer’s Desktop
  
Using Vim to Store Passwords and Other Secrets in an Encrypted File »

Installing GVim and Vim on Windows
Updated  2022-March-27

Page contents

News

2021-September-26  Published this evolving⁠[1] article.

 

Prerequisites

This article assumes…

  • you know the basics about the Vim text editor,

  • you know how to launch PowerShell in a terminal emulator,

  • and you are using Windows.

 

Terminology

In this article:

  • GVim means GUI Vim.

  • Vim usually⁠[2] means TUI Vim. TUI Vim is also known as terminal user interface Vim, terminal Vim, and console Vim.

  • [G]Vim means either GUI or TUI Vim.

Note that this terminology is specific to this article. Usually Vim means any Vim (GUI or TUI).

 

Research and download

One of the first things I do on a new Windows device is install GVim and Vim. Here’s how I do that.

  1. Visit www.vim.org/download.php#pc and see if anything has changed since the last time I visited www.vim.org.

  2. Visit github.com/vim/vim-win32-installer/releases and download the newest “Signed 32-⁠bit installer,” for example gvim_8.2.5085_x86_signed.exe.

 

The GitHub vim/vim-win32-installer project includes Win32 and Win64 installers. 32-⁠bit GVim is recommended for most users because 64-bit GVim uses “a lot more memory.”⁠[3][4]

 

Install

This section lists the install options I prefer but of course you can choose the options you prefer.

  1. Run the newly downloaded installer and…

  1. in the Choose Components window, choose all components:

    • Uninstall Existing Version(s)  (can’t be unchecked)

    • Vim GUI and runtime files  (can’t be unchecked)

    • Vim console program

    • Create .bat files

    • Create icons for Vim

      • On the Desktop

      • In the Start Menu Programs Folder

    • Add Vim Context Menu

    • Create Default Config

    • Create Plugin Directories

      • Private

      • Shared

    • Native Language Support

 

  1. in the Choose _vimrc settings window, choose:

    • Vim with all enhancements (load vimrc_example.vim) (Default)

    • Remap a few keys

    • Right: popup menu, Left: select mode (Windows)

 

Test

Launch from desktop shortcuts

  1. Use Win+D to view your Windows desktop and double click each of the following three shortcuts.

    1. gVim 8.2

    2. gVim Easy 8.2

    3. gVim Read only 8.2

To exit each of these GVims, choose Exit from the File menu.

 

In documentation and app interfaces, the app that’s launched by the gvim command is referred to as

  • GUI Vim,

  • GVim,

  • and gVim.

I prefer GVim (upper case G), but the default Windows desktop shortcuts use gVim (lower case g) so that’s what I use in A, B, and C above.

 

Launch from File Explorer’s context menu

  1. Use Win+E to launch Windows File Explorer, right click a plain text file, and choose Edit with Vim.⁠[2]

 

PowerShell

  1. Launch PowerShell and run the following four commands.

 

Get the paths

  1. gcm gvim or equivalently get-command gvim (this displays the path to the gvim command). On my system, the following is displayed.

    CommandType     Name           Version    Source
    -----------     ----           -------    ------
    Application     gvim.bat       0.0.0.0    C:\WINDOWS\gvim.bat
  2. gcm vim or equivalently get-command vim (this displays the path to the vim command). On my system, the following is displayed.

    CommandType     Name           Version    Source
    -----------     ----           -------    ------
    Application     vim.bat        0.0.0.0    C:\WINDOWS\vim.bat

 

Launch from a command line

  1. gvim (this should launch GUI Vim from a PowerShell command line)

  2. vim (this should launch TUI Vim from a PowerShell command line)

 

:version

  1. To display information about this instance of [G]Vim, including locations of vimrc files it can use, do the following.

    1. Press the Esc[5] key to make sure you are in normal mode.⁠[6]

    2. Type :version, which is a colon command.[7] Here is part of what is displayed on my system:

      ⋮
         system vimrc file: "$VIM\vimrc"
           user vimrc file: "$HOME\_vimrc"
       2nd user vimrc file: "$HOME\vimfiles\vimrc"
       3rd user vimrc file: "$VIM\_vimrc"
            user exrc file: "$HOME\_exrc"
        2nd user exrc file: "$VIM\_exrc"
        system gvimrc file: "$VIM\gvimrc"
          user gvimrc file: "$HOME\_gvimrc"
      2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
      3rd user gvimrc file: "$VIM\_gvimrc"
             defaults file: "$VIMRUNTIME\defaults.vim"
          system menu file: "$VIMRUNTIME\menu.vim"
      ⋮

       

💡
In GVim, another way to display this information is to choose Version from the Help menu.

 

:echo $MYVIMRC

  1. To display the path to the vimrc that is currently in use, do the following.

    1. Press Esc to be sure you are in normal mode.⁠[6]

    2. Type :echo $MYVIMRC. Just after a clean install, here is what is displayed on my system:

      C:\Program Files (x86)\Vim\_vimrc
      --------------------------
                  👆
      this part of the path is $VIM

 

Note that this _vimrc file…

  • is one of the items listed in the previous section (3rd user vimrc file: "$VIM\_vimrc")

  • and is where the _vimrc settings you chose during installation (in step 3B above) are stored.

 

Exit

How to exit Vim is one of the most frequently asked questions on the internet. Almost all possible ways are discussed in this entertaining and highly-⁠active stackoverflow.com thread.  

 

💡
In GVim, another way to exit is to choose Exit from the File menu.

 

Celebrate

After I’ve installed GVim and Vim on Windows, life is better. 🎉 🙌 🎈 🎆 🍾 🎇 💃

 

About TUI Vims on Windows

If you have installed a Unix-⁠like system on your Windows device, for example Git Bash or WSL, you probably have another TUI Vim on your device because Unix-⁠like systems often include the vim or vi[8] command.

 

References

To view the results of the above two :help commands, either follow the links (each of which go to vimhelp.org) or run these commands within [G]Vim.

 

See also

Endnotes


1. Many Infinite Ink articles, including this one, are evergreen and regularly updated.
2. The Windows File Explorer pop-up context menu says Edit with Vim, but it actually edits with GVim.
3. This is a quote from www.vim.org/download.php#pc.
4. For an example of 64-⁠bit GVim being needed, see mc.boringcactus.com’s Windows, Vim, and Python: An Unholy Trinity of Pain.
5. On an English US keyboard, pressing Ctrl+[ (Ctrl+left bracket) is equivalent to pressing the Esc key. This is useful if you are using a keyboard that does not have an Esc key or if you prefer to not take your fingers off the “home row” of your keyboard. More about this is at vim.fandom.com/wiki/Avoid_the_escape_key.
6. Vim and apps with Vim-style key bindings are modal. Usually you are either in normal mode or insert mode. Normal mode is also known as command mode.
7. A Vim command that starts with a colon (:) is sometimes called a “colon command” or “Ex command.”
8. Nowadays (2022+) vi usually launches vim.

Comments and questions 📝 🤔 👎 👍

Your public comment or question might immediately improve this page or help me to (eventually) improve this page.