NVIM on Windows: A Simple Guide

Posted by:

|

On:

|

NVIM on Windows

I’ve been struggling with setting up a good workflow for NVIM on Windows for a long time. While I am a fairly advanced NVIM user on Ubuntu, replicating my setup on Windows has always been challenging.

With a fresh Windows install, I decided it was the perfect time to tackle this issue once and for all. To achieve this, I used NVIM as my sole text editor and updated it as necessary.

NVIM Init File

The init file is crucial for updating settings in NVIM. On Windows, this file is located at:

~\AppData\Local\nvim\init.vim

To use ~/_vimrc for your settings, you can add the following lines to the init file:

set runtimepath+=~/vimfiles,~/vimfiles/after
set packpath+=~/vimfiles
source ~/_vimrc

Plug Installation

To get plug working, I had to download a file to ~\AppData\Local\nvim\autoload\. Plug is essential for managing NVIM plugins. On Windows, I removed all plugins and re-added them one by one to ensure compatibility.

Microsoft Copilot Installation

The installation process for Microsoft Copilot is straightforward. First, install NodeJS, then run the PowerShell command provided in the README. Afterward, running :Copilot setup in NVIM completed the installation.

Update: I ended up not using copilot for very long, but am keeping this here in case anyone is interested.

Other Considerations

Navigating the file system in NVIM on Windows can be a bit awkward since I rely heavily on terminal commands for file navigation on Ubuntu. While this isn’t a dealbreaker, it requires some adjustment. Learning a few PowerShell commands or using the GUI file explorer are potential solutions.

Init File

Putting the init file here for reference later:

" The must haves
set nocompatible
filetype off
set norelativenumber
set number
imap jk <esc>


set clipboard+=unnamedplus
let mapleader=","


""""""""""" Plugins """""""""""""
call plug#begin('~/AppData/Local/nvim/plugged')

" Git Stuff ====================
Plug 'tpope/vim-fugitive'

" Easy Motion ==================
Plug 'easymotion/vim-easymotion'

" File browser =================
Plug 'preservim/nerdtree'

" Colorschemes ==============
Plug 'EdenEast/nightfox.nvim' " Vim-Plug

" Navigation =================
Plug 'christoomey/vim-tmux-navigator' " ctrl+h and ctr+j movement

" all done
hi Normal guibg=NONE ctermbg=NONE
call plug#end()

colorscheme nightfox

" Easy motion config ================
" " <Leader>f{char} to move to {char}
map  <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)

" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-overwin-f2)

" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)

" Move to word
map  <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)