Skip to content

Windows Setup.md

Shubham Sourabh edited this page Apr 14, 2025 · 1 revision

Neovim Setup Guide for Windows

This guide details the steps to set up the Neovim configuration from this repository on a Windows system (tested on Windows 11).

Prerequisites

Before linking the configuration, ensure you have the following installed and configured:

  1. Neovim: Latest stable version (0.9+). Install via winget, scoop, choco, or download from the Neovim GitHub releases. Ensure nvim.exe is in your system PATH.
  2. Git: Required for cloning this repository and for lazy.nvim. Install from git-scm.com.
  3. Visual Studio Build Tools: Essential for nvim-treesitter.
    • Download "Build Tools for Visual Studio" from the Visual Studio Downloads page (under "Tools for Visual Studio").
    • During installation, select the "Desktop development with C++" workload.
  4. Java Development Kit (JDK):
    • JDK 21 (or newer): Required to run the jdtls Language Server. The configuration explicitly points to this JDK's java.exe. Find your JDK 21 path.
    • Target JDK(s): Install any other JDKs needed for your projects (e.g., JDK 1.8). Your system JAVA_HOME can point to this target JDK.
  5. Python: Install Python 3.x from python.org or the Microsoft Store. Ensure Python and pip are added to your PATH during installation.
  6. Nerd Font (Recommended): For UI icons. Download from Nerd Fonts, install (right-click -> Install for all users), and configure your terminal (e.g., Windows Terminal) to use it.
  7. Terminal (Recommended): Windows Terminal provides a much better experience than default cmd.exe or PowerShell windows.
  8. External Tools (Recommended): Install via winget or scoop:
    • winget install BurntSushi.ripgrep (or scoop install ripgrep) - For Telescope live_grep.
    • winget install sharkdp.fd (or scoop install fd) - Improves Telescope file finding.
    • winget install 7zip.7zip (or scoop install 7zip) - Required by mason.nvim for some package installations.

Setup Steps

  1. Clone this Dotfiles Repository:

    git clone <URL_OF_YOUR_DOTFILES_REPO> C:\path\to\your\dotfiles
    # Replace <URL_OF_YOUR_DOTFILES_REPO> and choose a local path
  2. Backup/Remove Existing Neovim Config:

    • Neovim's configuration lives at %LOCALAPPDATA%\nvim (usually C:\Users\YourUsername\AppData\Local\nvim).
    • If this folder exists, rename or delete it. Make a backup first!
      # Optional: Backup existing config
      Move-Item -Path $env:LOCALAPPDATA\nvim -Destination $env:LOCALAPPDATA\nvim.bak -ErrorAction SilentlyContinue
  3. Create Symbolic Link:

    • Open PowerShell or Command Prompt as Administrator (Right-click -> Run as administrator).
    • Run the mklink command to link the location Neovim expects to the configuration within your cloned repository:
      mklink /D "%LOCALAPPDATA%\nvim" "C:\path\to\your\dotfiles\windows\nvim"
      # IMPORTANT: Replace C:\path\to\your\dotfiles with the actual path where you cloned the repo.
    • You should see a "symbolic link created" message.
  4. Launch Neovim (IMPORTANT!):

    • Due to how Visual Studio Build Tools sets up its environment, you MUST launch Neovim from the "Developer PowerShell for VS" or "Developer Command Prompt for VS" (find it in your Start Menu). This ensures nvim-treesitter can find the C compiler (cl.exe).
    • Run nvim inside the Developer Prompt.
  5. Install Plugins & Tools:

    • On the first launch, lazy.nvim should automatically start cloning plugins. Wait for this to complete.
    • Run :Lazy sync to ensure everything is up-to-date.
    • Run :checkhealth to verify the setup. Address any critical errors (other than expected warnings about missing optional tools/providers).
    • Run :Mason to check the status of LSPs (jdtls, pyright) and formatters. Install any missing required tools (like stylua, black, isort, google-java-format if you intend to use them with conform.nvim).
    • Treesitter parsers for Java and Python should install automatically (because of the ensure_installed and auto_install settings) now that cl.exe is found. You can check with :TSInstallInfo.

Key Troubleshooting Summary

  • cl.exe / C Compiler Not Found: Launch Neovim from the Developer Prompt for VS.
  • jdtls Requires Java 21+ Error: The configuration in windows/nvim/init.lua explicitly sets the java.exe path for jdtls in the lspconfig setup. Ensure this path points correctly to your actual JDK 21+ installation (not the Oracle javapath symlinks).
  • Completion Not Working: Ensure nvim-cmp is loaded (loads on InsertEnter). Use <C-Space> to trigger manually, <C-y> to accept. Check :Lazy status and :messages for errors.

Finding JDK 21 Path

Use this PowerShell command to find the installation directory (avoid C:\Program Files\Common Files\Oracle\Java\javapath):

Get-ChildItem -Path "C:\Program Files\Java", "C:\Program Files" -Filter "jdk-21*" -Directory -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
# Look for paths like C:\Program Files\Java\jdk-21.x.y

Navigation



Status

Work in Progress 🚧

Clone this wiki locally