An open API service indexing awesome lists of open source software.

https://github.com/edwinhere/nvim

My Neovim Config
https://github.com/edwinhere/nvim

Last synced: 10 months ago
JSON representation

My Neovim Config

Awesome Lists containing this project

README

          

# Neovim Configuration Keybindings

This document outlines all keybindings and their functionalities in this Neovim configuration.

## LSP (Language Server Protocol)

*These keybindings are provided by lsp-zero default mappings*

| Keybinding | Mode | Description |
|--------------|--------|---------------------------|
| `K` | Normal | Hover documentation |
| `gd` | Normal | Go to definition |
| `gD` | Normal | Go to declaration |
| `gi` | Normal | Go to implementation |
| `gr` | Normal | Show references |
| `gs` | Normal | Show signature help |
| `rn` | Normal | Rename symbol |
| `ca` | Normal | Code actions |
| `f` | Normal | Format file (LSP) |
| `[d` | Normal | Previous diagnostic |
| `]d` | Normal | Next diagnostic |

## Autocompletion

| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `` | Insert | Trigger autocompletion |
| `` | Insert | Confirm selection |
| `` | Insert | Jump forward in snippet |
| `` | Insert | Jump backward in snippet |

## Telescope

| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `e` | Normal | Find files |
| `gf` | Normal | Git files |
| `f` | Normal | Live grep (Telescope) |
| `b` | Normal | Buffers |
| `?` | Normal | Help tags |
| `m` | Normal | Man pages |
| `` | Normal | Colorscheme picker |
| `r` | Normal | Registers |
| `k` | Normal | Keymaps |
| `t` | Normal | Treesitter |

## File Explorer (NvimTree)

| Keybinding | Mode | Description |
|------------|--------|----------------------------|
| `` | Normal | Toggle file explorer |
| `` | Normal | Find current file in tree |

## Git

| Keybinding | Mode | Description |
|--------------|--------|--------------------|
| `gg` | Normal | Open LazyGit |

## Buffer Navigation

| Keybinding | Mode | Description |
|--------------|--------|-----------------------|
| `z` | Normal | Previous buffer |
| `q` | Normal | Previous buffer |
| `x` | Normal | Next buffer |
| `w` | Normal | Next buffer |
| `c` | Normal | Close buffer |

## Window Management

| Keybinding | Mode | Description |
|--------------|--------|-----------------------|
| `h` | Normal | Split horizontal |
| `v` | Normal | Split vertical |
| `` | Normal | Move to left window |
| `` | Normal | Move to bottom window|
| `` | Normal | Move to top window |
| `` | Normal | Move to right window |

## Terminal

| Keybinding | Mode | Description |
|--------------|--------|--------------------|
| `sh` | Normal | Open terminal |
| `` | Terminal | Escape to normal mode |
| `h` | Terminal | Move to left window |
| `j` | Terminal | Move to bottom window |
| `k` | Terminal | Move to top window |
| `l` | Terminal | Move to right window |

## Clipboard Operations

| Keybinding | Mode | Description |
|--------------|--------|--------------------|
| `YY` | Normal | Copy to clipboard |
| `p` | Normal | Paste from clipboard|
| `XX` | Normal | Cut to clipboard |

## Visual Mode Operations

| Keybinding | Mode | Description |
|------------|--------|----------------------------|
| `J` | Visual | Move block down |
| `K` | Visual | Move block up |
| `<` | Visual | Indent left (keeps selection) |
| `>` | Visual | Indent right (keeps selection)|

## Search

| Keybinding | Mode | Description |
|-------------------|--------|--------------------|
| `n` | Normal | Next search result (centered) |
| `N` | Normal | Previous search result (centered) |
| `` | Normal | Clear search highlighting |

## AI Assistant (Claude Code)

| Keybinding | Mode | Description |
|--------------|--------|--------------------------------|
| `` | Normal | Toggle Claude Code terminal |
| `cc` | Normal | Continue Claude Code conversation |
| `cv` | Normal | Start Claude Code in verbose mode |
| `cn` | Normal | Start new Claude Code chat |

## AI Pair Programming (Aider)

| Keybinding | Mode | Description |
|--------------|--------|--------------------------------|
| `Ao` | Normal | Open Aider |
| `Am` | Normal | Add modified files to Aider |
| `af` | Normal | Add files to Aider (supports multi-selection with Tab) |

## Go Development

### Building & Running
| Keybinding | Mode | Description |
|--------------|--------|--------------------|
| `gb` | Normal | Build Go project |
| `gr` | Normal | Run Go main |

### Testing
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `gt` | Normal | Run Go tests |
| `gT` | Normal | Run Go test function |
| `gc` | Normal | Toggle Go coverage |
| `tn` | Normal | Run nearest test |
| `tf` | Normal | Run file tests |
| `ts` | Normal | Test summary |

### Debugging
| Keybinding | Mode | Description |
|--------------|--------|--------------------|
| `gd` | Normal | Go Debug continue |
| `gD` | Normal | Toggle breakpoint |

### Go Commands
- `:GoTest` - Run tests
- `:GoTestFunc` - Test function under cursor
- `:GoBuild` - Build with error list
- `:GoRun` - Run current file
- `:GoCoverage` - Show coverage
- `:GoDoc` - Show documentation
- `:GoRename` - Rename symbol
- `:GoFillStruct` - Fill struct literals
- `:GoInstallBinaries` - Install Go tools

### Features
- Auto-formatting with `goimports` on save
- Static analysis via gopls
- Syntax highlighting for Go constructs
- Unused parameter detection
- Import management
- Code completion and diagnostics

## Haskell Development

### Building & Running
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `hc` | Normal | Compile with GHC |
| `hr` | Normal | Run with runhaskell |
| `hi` | Normal | Open GHCi REPL |

### Cabal Projects
| Keybinding | Mode | Description |
|--------------|--------|--------------------|
| `cb` | Normal | Build project |
| `ct` | Normal | Run tests |
| `cr` | Normal | Run executable |

### Stack Projects
| Keybinding | Mode | Description |
|--------------|--------|--------------------|
| `sb` | Normal | Stack build |
| `st` | Normal | Stack test |
| `sr` | Normal | Stack run |
| `sg` | Normal | Stack GHCi |

### Formatting
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `hf` | Normal | Format with Ormolu |
| `f` | Normal | LSP formatting |

### Features
- Haskell Language Server (HLS) integration
- Advanced syntax highlighting (forall, mdo, proc, patterns)
- Auto-indentation with hindent (runs on save)
- Ormolu formatting support
- Real-time error diagnostics
- Code completion and hover documentation
- Cabal and Stack project support

### Prerequisites
Install Haskell toolchain:
```bash
ghcup install ghc
ghcup install cabal
ghcup install stack
ghcup install hls
cabal install ormolu
cabal install hindent
```

## Node.js/JavaScript/TypeScript Development

### Package Management
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `ns` | Normal | Show package info |
| `nc` | Normal | Hide package info |
| `nt` | Normal | Toggle package info |
| `nu` | Normal | Update package |
| `nd` | Normal | Delete package |
| `ni` | Normal | Install package |
| `np` | Normal | Change package version |

### NPM Commands
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `nr` | Normal | Run npm script |
| `nI` | Normal | npm install |
| `nT` | Normal | npm test |
| `nS` | Normal | npm start |
| `nB` | Normal | npm run build |
| `nD` | Normal | npm run dev |

### Testing
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jt` | Normal | Run nearest JS test |
| `jf` | Normal | Run JS file tests |
| `js` | Normal | JS Test summary |

### Debugging
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jd` | Normal | JS Debug continue |
| `jD` | Normal | JS Toggle breakpoint |
| `jr` | Normal | JS Debug REPL |

### Formatting
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jp` | Normal | Format with Prettier |

### Features
- **TypeScript Language Server** with inlay hints for parameters, types, and return values
- **ESLint integration** for real-time linting and code actions
- **Prettier formatting** with customizable rules and auto-format on save
- **Package.json management** with visual dependency info and version updates
- **Jest and Vitest test runners** with nearest test execution
- **VS Code JS Debug** adapter for Node.js debugging with breakpoints
- **Auto-formatting on save** for JS/TS files
- **Enhanced syntax highlighting** for JavaScript, TypeScript, JSX, TSX
- **Spell checking** with cspell (when available)
- **null-ls integration** for additional formatting and linting tools
- **Graceful degradation** - Features only activate when plugins are installed

### Prerequisites
Install Node.js toolchain:
```bash
# Install Node.js via nvm (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install --lts
nvm use --lts

# Install global development tools
npm install -g typescript eslint prettier @typescript-eslint/parser @typescript-eslint/eslint-plugin
npm install -g ts-node jest @types/node
npm install -g js-debug-adapter # For debugging support

# Optional: Install spell checker
npm install -g cspell
```

## Python Development

### Python Execution
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `pr` | Normal | Run Python file |
| `pi` | Normal | Run Python interactive |
| `pp` | Normal | Run Python3 file |
| `pR` | Normal | Open Python REPL |

### Virtual Environment Management
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `pv` | Normal | Activate virtual environment |

### Package Management
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `pI` | Normal | pip install |
| `pU` | Normal | pip upgrade |
| `pS` | Normal | pip show |
| `pF` | Normal | pip freeze to requirements.txt |
| `pR` | Normal | pip install from requirements.txt |

### Django Development
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `dm` | Normal | Django migrate |
| `dmm`| Normal | Django makemigrations |
| `dr` | Normal | Django runserver |
| `ds` | Normal | Django shell |
| `dt` | Normal | Django test |
| `dc` | Normal | Django collectstatic |

### Testing
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `pt` | Normal | Run pytest |
| `ptv`| Normal | Run pytest verbose |
| `ptf`| Normal | Run pytest on current file |
| `ptc`| Normal | Run pytest with coverage |
| `pnt`| Normal | Run nearest Python test (neotest) |
| `pnf`| Normal | Run Python file tests (neotest) |
| `pns`| Normal | Python Test summary (neotest) |
| `pno`| Normal | Show test output (neotest) |

### Debugging
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `pd` | Normal | Python Debug continue |
| `pD` | Normal | Python Toggle breakpoint |
| `pdr`| Normal | Python Debug REPL |
| `pdl`| Normal | Python Debug run last |

### Formatting & Linting
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `pb` | Normal | Format with Black |
| `pB` | Normal | Format all files with Black |
| `pl` | Normal | Lint with ruff |
| `pL` | Normal | Lint all files with ruff |
| `pf` | Normal | Fix with ruff |

### Jupyter Notebook
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `pj` | Normal | Convert to Jupyter notebook |
| `pJ` | Normal | Convert from Jupyter notebook |

### Features
- **Pyright Language Server** for type checking and intelligent code completion
- **Ruff integration** for fast linting and code formatting
- **Black formatter** with auto-format on save
- **pytest integration** with neotest for visual test running
- **debugpy support** for Python debugging with breakpoints
- **Django/FastAPI/Flask** debug configurations
- **Virtual environment detection** and management
- **Auto-indentation** with 4-space tabs (PEP 8 compliant)
- **Code folding** based on indentation
- **Jupyter notebook** conversion support
- **REPL integration** for interactive development
- **Graceful degradation** - Features only activate when tools are installed

### Prerequisites
Install Python development tools:
```bash
# Install Python (if not already installed)
# macOS: brew install python
# Ubuntu: sudo apt install python3 python3-pip python3-venv
# Windows: Download from python.org

# Install Python development tools
pip install --upgrade pip
pip install debugpy pytest black ruff pyright
pip install jupytext # Optional: for Jupyter notebook support

# For Django development
pip install django

# For FastAPI development
pip install fastapi uvicorn

# For Flask development
pip install flask

# Create and activate virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

## Java Development

### Building & Running
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jb` | Normal | Build Java project |
| `jr` | Normal | Run Java project |
| `jc` | Normal | Compile current Java file |
| `jR` | Normal | Run current Java file |

### Maven Commands
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `mc` | Normal | Maven clean |
| `mC` | Normal | Maven compile |
| `mt` | Normal | Maven test |
| `mp` | Normal | Maven package |
| `mi` | Normal | Maven install |
| `me` | Normal | Maven exec:java |

### Gradle Commands
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `gc` | Normal | Gradle clean |
| `gC` | Normal | Gradle compile |
| `gt` | Normal | Gradle test |
| `gb` | Normal | Gradle build |
| `gr` | Normal | Gradle run |

### Testing
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jt` | Normal | Run Java tests |
| `jtf`| Normal | Run tests for current file |
| `jnt`| Normal | Run nearest Java test (JDTLS) |
| `jnc`| Normal | Run Java test class (JDTLS) |

### JDTLS Code Actions
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jo` | Normal | Organize imports |
| `jv` | Normal | Extract variable |
| `jV` | Normal | Extract variable (visual) |
| `jm` | Normal | Extract method |
| `jM` | Normal | Extract method (visual) |
| `jc` | Normal | Extract constant |
| `ju` | Normal | Update project config |

### Debugging
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jd` | Normal | Java Debug continue |
| `jD` | Normal | Java Toggle breakpoint |
| `jdr`| Normal | Java Debug REPL |
| `jdl`| Normal | Java Debug run last |

### Dependency Management
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jdm`| Normal | Show dependencies |

### JAR Operations
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jj` | Normal | Create JAR file |
| `jJ` | Normal | Run JAR file |

### Code Generation
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `jg` | Normal | Generate class template |

### Spring Boot Development
| Keybinding | Mode | Description |
|--------------|--------|--------------------------|
| `spr`| Normal | Spring Boot run (Maven) |
| `spg`| Normal | Spring Boot run (Gradle) |
| `spt`| Normal | Spring Boot test (Maven) |
| `spb`| Normal | Spring Boot build image (Maven) |

### Features
- **Eclipse JDT Language Server** with advanced Java support
- **Automatic project detection** (Maven, Gradle, or plain Java)
- **Code completion** with intelligent suggestions
- **Refactoring tools** (extract method, variable, constant)
- **Import organization** and dependency management
- **JUnit/TestNG integration** through JDTLS for test execution
- **Debugging support** with breakpoints and REPL
- **Maven and Gradle** build system integration
- **Spring Boot** development support
- **Code formatting** with Google Java Style (configurable)
- **JAR creation and execution** tools
- **Auto-indentation** with 4-space tabs
- **Syntax-based code folding**
- **Graceful degradation** - Features only activate when tools are installed

### Prerequisites
Install Java development tools:
```bash
# Install Java (JDK 11 or higher recommended)
# macOS: brew install openjdk@11 or openjdk@17
# Ubuntu: sudo apt install openjdk-11-jdk or openjdk-17-jdk
# Windows: Download from Oracle or use OpenJDK

# Set JAVA_HOME environment variable
export JAVA_HOME=/path/to/your/java/installation

# Install Maven (optional, for Maven projects)
# macOS: brew install maven
# Ubuntu: sudo apt install maven
# Windows: Download from maven.apache.org

# Install Gradle (optional, for Gradle projects)
# macOS: brew install gradle
# Ubuntu: sudo apt install gradle
# Windows: Download from gradle.org

# Verify installation
java --version
javac --version
mvn --version # if Maven installed
gradle --version # if Gradle installed
```

## Environment Setup Guide

### Initial Setup
1. **Clone this Neovim configuration** to `~/.config/nvim/`
2. **Install Packer** (plugin manager):
```bash
git clone --depth 1 https://github.com/wbthomason/packer.nvim \
~/.local/share/nvim/site/pack/packer/start/packer.nvim
```

### Language-Specific Setup

#### Go Development
```bash
# Install Go toolchain (if not already installed)
# Install via official installer or package manager

# In Neovim:
:PackerSync
:GoInstallBinaries
```

#### Haskell Development
```bash
# Install GHCup and Haskell toolchain
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

# Install Haskell tools
ghcup install ghc
ghcup install cabal
ghcup install stack
ghcup install hls
cabal install ormolu
cabal install hindent

# In Neovim:
:TSInstall! haskell
```

#### Node.js/JavaScript/TypeScript Development
```bash
# Install Node.js via nvm (if not already installed)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc # or restart terminal
nvm install --lts
nvm use --lts

# Install global development tools
npm install -g typescript eslint prettier @typescript-eslint/parser @typescript-eslint/eslint-plugin
npm install -g ts-node jest @types/node
npm install -g js-debug-adapter # For debugging support
npm install -g cspell # Optional: spell checker

# In Neovim:
:PackerSync
:Mason
# Install: typescript-language-server, eslint-lsp (if not auto-installed)
:TSInstall! javascript typescript tsx
```

#### Python Development
```bash
# Install Python development tools
pip install --upgrade pip
pip install debugpy pytest black ruff pyright
pip install jupytext # Optional: for Jupyter notebook support

# Framework-specific installations (optional)
pip install django # For Django development
pip install fastapi uvicorn # For FastAPI development
pip install flask # For Flask development

# In Neovim:
:PackerSync
:Mason
# Install: pyright, ruff-lsp (if not auto-installed)
:TSInstall! python
```

#### Java Development
```bash
# Install Java JDK (11 or higher recommended)
# macOS: brew install openjdk@17
# Ubuntu: sudo apt install openjdk-17-jdk
# Windows: Download from Oracle or use OpenJDK

# Set JAVA_HOME environment variable
export JAVA_HOME=/path/to/your/java/installation

# Install build tools (optional but recommended)
# Maven:
# macOS: brew install maven
# Ubuntu: sudo apt install maven

# Gradle:
# macOS: brew install gradle
# Ubuntu: sudo apt install gradle

# In Neovim:
:PackerSync
:Mason
# Install: jdtls (Java LSP server will be auto-configured)
:TSInstall! java
```

### Final Setup Steps
1. **Start Neovim** and run `:PackerSync`
2. **Install LSP servers** via `:Mason`
3. **Install Treesitter parsers** as needed
4. **Restart Neovim** to ensure all configurations load properly

### Troubleshooting

#### Common Issues
- **"module not found" errors**: Run `:PackerSync` and restart Neovim
- **LSP not working**: Check `:Mason` for missing language servers
- **Treesitter parser failures**: Run `:TSUpdate` to refresh parsers
- **Features not working**: Some features only activate after installing their corresponding plugins

#### Error-Free Loading
This configuration uses **safe module loading** with `pcall()` to prevent crashes:
- Missing plugins won't break Neovim startup
- Features gracefully degrade when dependencies aren't available
- Keybindings only register for installed plugins
- You can run `:PackerSync` without errors even before plugins are installed

#### Feature Availability
| Feature | Requires Plugin | Auto-detects |
|---------|----------------|--------------|
| Package.json management | `package-info.nvim` | ✅ |
| Prettier formatting | `prettier.nvim` | ✅ |
| Debug support | `nvim-dap` | ✅ |
| Test runners | `neotest-*` | ✅ |
| Linting/formatting | `null-ls.nvim` | ✅ |

## Notes
- The leader key in this configuration is set to `,`
- Some commands may require specific plugins to be installed
- Visual mode keybindings can be used after selecting text (v)
- Run `:PackerSync` after adding new plugins
- Run `:GoInstallBinaries` to install Go development tools
- Run `:TSInstall! haskell` to ensure Haskell treesitter parser
- Run `:TSInstall! javascript typescript tsx` for Node.js development
- Run `:TSInstall! python` for Python development
- Run `:TSInstall! java` for Java development