Skip to content

PhilippTheServer/neovim-dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neovim Development Setup

A complete Neovim configuration for Python, C/C++, and Angular development on Arch Linux and Windows 11.

Features

  • 🚀 Modern Plugin Manager: lazy.nvim for fast startup times
  • 🎨 Beautiful UI: Tokyo Night theme, Lualine statusline, Bufferline
  • 📝 LSP Support: Full language server protocol integration for Python, C/C++, TypeScript/Angular
  • Auto-completion: Intelligent code completion with nvim-cmp
  • 🌳 Treesitter: Advanced syntax highlighting and code understanding
  • 🔍 Fuzzy Finding: Telescope for file and text searching
  • 📁 File Explorer: nvim-tree for project navigation
  • 🔧 Git Integration: Gitsigns for git status in the gutter
  • 🎯 Smart Editing: Auto-pairs, comments, indent guides

Prerequisites

System Packages (Arch Linux)

Install the required packages using pacman:

# Core dependencies
sudo pacman -S neovim git nodejs npm python python-pip

# Build tools for C/C++ and native extensions
sudo pacman -S base-devel gcc clang cmake make

# Optional but recommended
sudo pacman -S ripgrep fd fzf

System Packages (Windows 11)

Install Chocolatey package manager first, then open PowerShell as Administrator and run:

# Core dependencies
choco install neovim git nodejs-lts python -y

# Build tools for C/C++ (optional, for C/C++ development)
choco install llvm -y

# Recommended tools for Telescope
choco install ripgrep fd -y

Note: After installing packages with Chocolatey, close and reopen your terminal for PATH changes to take effect.

Installation Steps

1. Clone the Configuration

Arch Linux

git clone https://github.com/yourusername/neovim-dotfiles.git ~/.config/nvim

Windows 11

git clone https://github.com/yourusername/neovim-dotfiles.git $env:LOCALAPPDATA\nvim

Or if you already have the files, copy them to the config location:

Copy-Item -Path "path\to\neovim-dotfiles\*" -Destination "$env:LOCALAPPDATA\nvim" -Recurse -Force

2. Install Language Servers

The configuration uses the native Neovim 0.11+ LSP API. Install language servers system-wide:

Arch Linux

Python LSP (Pyright)
sudo npm install -g pyright
C/C++ LSP (clangd)
sudo pacman -S clang
TypeScript/Angular LSP
sudo npm install -g typescript typescript-language-server
sudo npm install -g @angular/language-server
HTML/CSS/JSON LSP
sudo npm install -g vscode-langservers-extracted
Lua LSP (for editing Neovim config)
sudo pacman -S lua-language-server

Windows 11

Open PowerShell (regular or Administrator) and run:

All npm-based Language Servers (one command)
npm install -g pyright typescript typescript-language-server @angular/language-server vscode-langservers-extracted
Lua LSP (optional, for editing Neovim config)
# Run as Administrator
choco install lua-language-server -y
C/C++ LSP (clangd)

clangd is included when you install LLVM:

# Run as Administrator
choco install llvm -y

3. First Launch

  1. Open Neovim:

    nvim
  2. Wait for lazy.nvim to automatically install all plugins (this happens on first launch)

  3. After plugins are installed, run:

    :checkhealth
    

    This will show you if anything is missing

  4. Install Treesitter parsers:

    :TSInstall python c cpp typescript javascript html css lua
    

Key Bindings

Leader Key

The leader key is set to Space

General

  • <leader>w - Save file
  • <leader>q - Quit
  • <leader>Q - Quit all (force)
  • <leader>nh - Clear search highlights

Window Navigation

  • <C-h> - Move to left window
  • <C-j> - Move to bottom window
  • <C-k> - Move to top window
  • <C-l> - Move to right window

Window Management

  • <leader>sv - Split vertically
  • <leader>sh - Split horizontally
  • <leader>se - Make splits equal size
  • <leader>sx - Close current split

Buffer Navigation

  • <S-l> - Next buffer
  • <S-h> - Previous buffer

File Explorer (nvim-tree)

  • <leader>e - Toggle file explorer

Fuzzy Finder (Telescope)

  • <leader>ff - Find files
  • <leader>fg - Live grep (search in files)
  • <leader>fb - Find buffers
  • <leader>fh - Help tags

LSP

  • <leader>d - Go to definition
  • <leader>D - Go to declaration
  • <leader>i - Go to implementation
  • <leader>r - Show references
  • K - Hover documentation
  • <leader>rn - Rename symbol
  • <leader>ca - Code actions

Diagnostics

  • <leader>do - Open diagnostic float
  • [d - Go to previous diagnostic
  • ]d - Go to next diagnostic

Git (Gitsigns)

  • <leader>gb - Blame line
  • <leader>gp - Preview hunk
  • <leader>gr - Reset hunk

Code Editing

  • gcc - Toggle line comment
  • gc (in visual mode) - Toggle comment for selection
  • <C-space> - Trigger completion
  • <C-k> - Select previous completion item
  • <C-j> - Select next completion item

Project Structure

~/.config/nvim/                 # Linux
%LOCALAPPDATA%\nvim\            # Windows
├── init.lua                    # Main entry point
├── lua/
│   ├── config/
│   │   ├── options.lua         # Neovim options
│   │   └── keymaps.lua         # Key mappings
│   └── plugins/
│       ├── lsp.lua             # LSP configuration
│       ├── nvim-cmp.lua        # Autocompletion
│       ├── treesitter.lua      # Syntax highlighting
│       ├── nvim-tree.lua       # File explorer
│       ├── telescope.lua       # Fuzzy finder
│       ├── gitsigns.lua        # Git integration
│       ├── lualine.lua         # Statusline
│       ├── bufferline.lua      # Buffer tabs
│       ├── colorscheme.lua     # Color theme
│       ├── autopairs.lua       # Auto pairs
│       ├── comment.lua         # Comment toggling
│       ├── indent-blankline.lua # Indent guides
│       └── which-key.lua       # Keybinding hints

Customization

Change Color Scheme

Edit lua/plugins/colorscheme.lua. Some popular alternatives:

  • catppuccin/nvim - Catppuccin theme
  • rose-pine/neovim - Rose Pine theme
  • EdenEast/nightfox.nvim - Nightfox theme

Modify Key Bindings

Edit lua/config/keymaps.lua to customize key mappings.

Add More Plugins

Create a new file in lua/plugins/ with your plugin configuration. lazy.nvim will automatically load it.

Example:

-- lua/plugins/my-plugin.lua
return {
  "author/plugin-name",
  config = function()
    -- Plugin configuration
  end,
}

Language-Specific Tips

Python Development

  • Virtual environments are automatically detected
  • Use :!python % to run current file
  • Pyright provides type checking

C/C++ Development

  • clangd provides compilation database support
  • Create a compile_commands.json for best results
  • Use CMake or bear to generate compilation database

Angular Development

  • Make sure you're in an Angular project directory
  • The Angular language server provides template support
  • TypeScript LSP handles .ts files

Troubleshooting

LSP not working

  1. Check if language server is installed:
    • Linux: :!which pyright (or clangd, typescript-language-server)
    • Windows: :!where pyright (or clangd, typescript-language-server)
  2. Check LSP status: :LspInfo
  3. Check health: :checkhealth

Treesitter errors

  • Update parsers: :TSUpdate
  • Reinstall specific parser: :TSInstall python

Plugins not loading

  • Update plugins: :Lazy sync
  • Check for errors: :Lazy

Performance issues

  • Check startup time: nvim --startuptime startup.log
  • Disable unused plugins in their respective files

Updating

To update all plugins:

:Lazy sync

To update Neovim:

Arch Linux

sudo pacman -S neovim

Windows 11

choco upgrade neovim -y

Additional Resources

License

This configuration is free to use and modify as you wish.

About

dotfiles for neovim configuration

Resources

Stars

Watchers

Forks

Contributors