updated configuration
This commit is contained in:
182
README.md
182
README.md
@@ -1,4 +1,180 @@
|
||||
# 💤 LazyVim
|
||||
# Neovim Configuration with LazyVim
|
||||
|
||||
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
|
||||
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.
|
||||
A comprehensive Neovim setup with LSP support, AI chat, database integration, and debugging.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Neovim >= 0.9.0 (installed via Homebrew)
|
||||
- Git
|
||||
- A Nerd Font (for icons)
|
||||
- Node.js (for some LSP servers and formatters)
|
||||
- Go (for gopls and delve)
|
||||
|
||||
## Installation
|
||||
|
||||
1. **Backup existing configuration** (if any):
|
||||
```bash
|
||||
mv ~/.config/nvim ~/.config/nvim.bak
|
||||
mv ~/.local/share/nvim ~/.local/share/nvim.bak
|
||||
mv ~/.local/state/nvim ~/.local/state/nvim.bak
|
||||
mv ~/.cache/nvim ~/.cache/nvim.bak
|
||||
```
|
||||
|
||||
2. **Clone this configuration**:
|
||||
```bash
|
||||
git clone <your-repo-url> ~/.config/nvim
|
||||
```
|
||||
|
||||
3. **Start Neovim**:
|
||||
```bash
|
||||
nvim
|
||||
```
|
||||
Lazy.nvim will automatically install all plugins on first launch.
|
||||
|
||||
4. **Install LSP servers and tools**:
|
||||
After plugins load, run:
|
||||
```
|
||||
:Mason
|
||||
```
|
||||
All required tools should install automatically.
|
||||
|
||||
## Features
|
||||
|
||||
### Language Support (LSP + Treesitter)
|
||||
- Go, Lua, TypeScript, JavaScript, HTML, CSS, JSON, YAML, Markdown, SQL, Makefile
|
||||
|
||||
### AI Chat Integration
|
||||
Supports multiple providers via [avante.nvim](https://github.com/yetone/avante.nvim):
|
||||
- Anthropic Claude
|
||||
- OpenAI GPT
|
||||
- Google Gemini
|
||||
- And more
|
||||
|
||||
Set your API keys as environment variables:
|
||||
```bash
|
||||
export ANTHROPIC_API_KEY="your-key"
|
||||
export OPENAI_API_KEY="your-key"
|
||||
export GEMINI_API_KEY="your-key"
|
||||
```
|
||||
|
||||
Switch providers: `:AvanteProvider claude|openai|gemini`
|
||||
|
||||
### Database Integration (vim-dadbod)
|
||||
- `:DBUIToggle` - Open database UI
|
||||
- `:DBUIAddConnection` - Add a new connection
|
||||
|
||||
Connection string examples:
|
||||
```
|
||||
postgresql://user:pass@localhost:5432/dbname
|
||||
mysql://user:pass@localhost:3306/dbname
|
||||
sqlite:path/to/db.sqlite
|
||||
```
|
||||
|
||||
### Go Debugging (DAP + Delve)
|
||||
Full debugging support with breakpoints, stepping, variable inspection.
|
||||
|
||||
## Key Bindings
|
||||
|
||||
### Terminal
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<leader>th` | Open terminal (horizontal split) |
|
||||
| `<leader>tv` | Open terminal (vertical split) |
|
||||
| `<C-\>` | Toggle floating terminal |
|
||||
| `<Esc><Esc>` | Exit terminal mode |
|
||||
|
||||
### File Explorer (Snacks explorer)
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<C-S-e>` | Toggle explorer |
|
||||
| `<C-S-v>` or `<C-v>` | Open file in vertical split |
|
||||
| `<C-S-h>` or `<C-x>` | Open file in horizontal split |
|
||||
| `<leader>e` | Focus explorer (LazyVim default) |
|
||||
|
||||
### AI Chat
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<leader>aa` | Ask AI (with selection in visual mode) |
|
||||
| `<leader>ac` | Open AI chat |
|
||||
| `<leader>at` | Toggle AI sidebar |
|
||||
|
||||
### Database
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<leader>db` | Toggle database UI |
|
||||
| `<leader>da` | Add database connection |
|
||||
|
||||
### Debugging
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<leader>db` | Toggle breakpoint |
|
||||
| `<leader>dB` | Breakpoint with condition |
|
||||
| `<leader>dc` | Continue |
|
||||
| `<leader>di` | Step into |
|
||||
| `<leader>do` | Step out |
|
||||
| `<leader>dO` | Step over |
|
||||
| `<leader>du` | Toggle DAP UI |
|
||||
| `<leader>dT` | Debug Go test |
|
||||
| `<leader>dt` | Terminate debug session |
|
||||
|
||||
### Formatting
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<leader>cf` | Format buffer |
|
||||
| `:FormatToggle` | Toggle auto-format on save |
|
||||
| `:FormatDisable` | Disable auto-format |
|
||||
| `:FormatEnable` | Enable auto-format |
|
||||
|
||||
### General
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `<C-s>` | Save file |
|
||||
| `<S-h>` / `<S-l>` | Previous/Next buffer |
|
||||
| `<C-h/j/k/l>` | Navigate windows |
|
||||
| `<A-j>` / `<A-k>` | Move line down/up |
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
~/.config/nvim/
|
||||
├── init.lua # Entry point
|
||||
├── lua/
|
||||
│ ├── config/
|
||||
│ │ ├── lazy.lua # Lazy.nvim bootstrap & LazyVim setup
|
||||
│ │ ├── options.lua # General Neovim options
|
||||
│ │ ├── keymaps.lua # Custom key bindings
|
||||
│ │ └── autocmds.lua # Auto commands
|
||||
│ └── plugins/
|
||||
│ ├── lsp.lua # LSP & Treesitter configuration
|
||||
│ ├── ai.lua # AI chat integration (avante.nvim)
|
||||
│ ├── dadbod.lua # Database integration
|
||||
│ ├── dap.lua # Debugging configuration
|
||||
│ ├── formatting.lua # Auto-formatting (conform.nvim)
|
||||
│ └── editor.lua # Editor enhancements (snacks explorer, etc.)
|
||||
```
|
||||
|
||||
## Formatters by File Type
|
||||
|
||||
| File Type | Formatter |
|
||||
|-----------|-----------|
|
||||
| Go | gofumpt, goimports |
|
||||
| Lua | stylua |
|
||||
| JS/TS/JSX/TSX | prettier |
|
||||
| HTML/CSS | prettier |
|
||||
| JSON/YAML | prettier |
|
||||
| Markdown | prettier |
|
||||
| SQL | sql-formatter |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### LSP not working
|
||||
Run `:LspInfo` to check status. Run `:Mason` to verify tools are installed.
|
||||
|
||||
### Formatting not working
|
||||
Run `:ConformInfo` to check formatter status.
|
||||
|
||||
### Icons not displaying
|
||||
Install a Nerd Font and configure your terminal to use it.
|
||||
|
||||
### Ctrl+Shift keybindings not working
|
||||
Some terminals don't properly send Ctrl+Shift combinations. Use the alternative mappings (`<C-v>` and `<C-x>` in snacks explorer).
|
||||
|
||||
Reference in New Issue
Block a user