CommandType Name Version Source ----------- ---- ------- ------ Application gvim.bat 0.0.0.0 C:\WINDOWS\gvim.bat
2022-September-26
As of today, this evolving[1]
article
has been on
the web
for
2022-June-28 (Tau Day) Vim v9.0 released. For details, see www.vim.org/vim90.php.
This article assumes…
you are using Windows,
you know the basics about the Vim text editor,
and you know how to launch PowerShell in a terminal emulator.
One of the first things I do on a new Windows device is install Vim and GVim. Here’s how I do that.
Visit www.vim.org/download.php#pc and see if anything has changed since the last time I visited www.vim.org.
Visit
github.com/vim/vim-win32-installer/releases
and download the newest
🔒️Signed 32-bit installer,
for example
.
‼ | The
GitHub project vim/vim-win32-installer includes Win32 and Win64 installers.
32-bit GVim
is recommended
for most users
because
64-bit GVim
uses
“a lot more memory.”[3][4] |
This section lists the install options I prefer but of course you can choose the options you prefer.
Run the newly downloaded installer and…
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
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)
Use Win+D to view your Windows desktop and double click each of the following three shortcuts.
gVim 9.0
gVim Easy 9.0
gVim Read only 9.0
To exit
each
of these GVims, choose Exit
from the File
menu.
ℹ | In documentation and app interfaces,
the
app that is launched by the
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. |
Use
Win+E
to launch
Windows File Explorer, right click a plain text file, and choose
Edit with Vim
.[2]
Launch PowerShell and run the following four commands.
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
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
gvim
(this should launch GUI Vim from a PowerShell command line)
vim
(this should launch TUI Vim from a PowerShell command line)
To display information about this instance of [G]Vim, including locations of vimrc files it can use, do the following.
Press the Esc[5] key to make sure you are in normal mode.[6]
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. |
To display the path to the vimrc that is currently in use, do the following.
Press Esc to be sure you are in normal mode.[6]
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.
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. |
After I’ve installed
Vim and GVim
on Windows,
life is
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.
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.
For more about GVim and Vim, see Infinite Ink’s…
Edit with Vim
, but it actually edits with GVim.:
) is sometimes called a “colon command” or “Ex command.”@nm@mathstodon.xyz
or
#InfiniteInk
in it.