Installing and starting to use Vim with gVim in Windows
I’ve been using the Vim extension for VSCode for the past year and now I want to deepen my knowledge and practice more with Vim by using the gVim application on my Windows system.
First I downloaded and installed gVim from the official Vim website.
To enable opening gVim from the terminal (Git Bash), I added its path ’C:\Program Files\Vim\vim91' to the Windows system Path. So then I can open a gitbash terminal in a folder and open the folder with gVim:
Next I wanted to increase the font size and change the color scheme. To do this, I cloned the dracula vim repository into ‘C:\Users\MyUser\vimfiles\pack\themes\start’. (The ‘pack’ directory didn’t exist prior to cloning the repository, so I created this directory and its subdirectories before cloning.)
Then, I created a _vimrc file in the C:\Users\MyUser\ folder with the following configuration:
set nocompatible
syntax enable
set termguicolors
set guifont=Consolas:h14
colorscheme dracula
Additionally, I configured netrw (the native file explorer in gVim) to display as a vertical tree with 30% width. Using the leader key (default: ) combined with ‘e’, I can toggle the tree view.
let g:netrw_browse_split="v"
let g:netrw_altv=1
let g:netrw_winsize=30
let g:netrw_liststyle=3
nnoremap <Leader>e :Lexplore<CR>
Finally, I mapped keys for sharing the Windows clipboard. This allows me to use Ctrl+C to copy selected text from gVim to the Windows clipboard and Ctrl+V to paste text from the clipboard into gVim:
nnoremap <Leader>e :Lexplore<CR>
vnoremap <C-c> "+y
nnoremap <C-v> "+p
inoremap <C-v> <Esc>"+pa