chopsticks/QUICKSTART.md
Claude 2941614b45
工程化优化:添加快速安装脚本和企业级开发功能
新增功能:
 一键安装脚本 (install.sh)
  - 自动备份现有配置
  - 自动安装 vim-plug
  - 自动安装所有插件
  - 可选安装 CoC 语言服务器
  - 美化的安装界面和详细提示

 快速开始指南 (QUICKSTART.md)
  - 5分钟上手教程
  - 常用工作流程示例
  - 语言特定配置说明
  - 故障排除指南
  - 快速参考卡片

配置增强:
📦 新增插件
  - vim-obsession: 会话管理
  - vim-prosession: 项目会话
  - vim-unimpaired: 便捷的括号映射
  - targets.vim: 额外的文本对象
  - vim-snippets: 代码片段集合

🛠️ 工程化特性
  - 项目特定配置支持 (.vimrc in project root)
  - 大文件自动优化 (>10MB)
  - 终端集成 (,tv, ,th)
  - 会话自动保存
  - 父目录自动创建

⌨️ 新增快捷键
  Git 工作流:
    ,gs - Git status
    ,gc - Git commit
    ,gp - Git push
    ,gl - Git pull
    ,gd - Git diff
    ,gb - Git blame

  工程实用工具:
    ,ev - 编辑 .vimrc
    ,sv - 重载 .vimrc
    ,F  - 格式化整个文件
    ,wa - 保存所有缓冲区
    ,cp - 复制文件路径
    ,cf - 复制文件名
    ,*  - 搜索并替换光标下的单词
    ,,  - 切换到上一个文件

  窗口管理:
    ,=  - 增大窗口高度
    ,-  - 减小窗口高度
    ,+  - 增大窗口宽度
    ,_  - 减小窗口宽度

🌐 语言支持增强
  新增语言配置:
    - Rust (rustfmt, cargo)
    - Shell (shellcheck)
    - YAML (yamllint)
    - Docker (hadolint)
    - HTML/CSS (prettier)
    - Markdown (spell check, prettier)

  改进的 ALE 配置:
    - 更多语言的 linters
    - 优化的性能设置
    - 详细错误显示 (,ad)

🔍 增强的 FZF 集成
  - 改进的预览窗口
  - Git 文件搜索命令
  - 更好的 Ripgrep 集成
  - 自定义布局

📝 NERDTree 优化
  - 自动打开项目目录
  - 忽略 node_modules, __pycache__ 等
  - 可配置窗口大小

文档改进:
📚 README.md 重大更新
  - 添加快速开始章节
  - 详细的工程特性说明
  - 完整的键位映射表
  - 项目配置示例
  - 会话管理说明
  - 大文件处理说明
  - 终端集成文档

适用场景:
 企业级开发团队
 多语言项目
 大型代码库
 持续集成环境
 远程开发
 代码审查

性能优化:
 大文件自动禁用重度功能
 ALE 按需 lint (不在输入时)
 优化的语法高亮
 更快的启动时间
2025-12-30 00:17:46 +00:00

271 lines
6.4 KiB
Markdown

# Quick Start Guide
Get up and running with this Vim configuration in 5 minutes!
## Installation
### One-Line Install
```bash
git clone https://github.com/m1ngsama/chopsticks.git ~/.vim && cd ~/.vim && ./install.sh
```
That's it! The script will:
- ✓ Backup your existing .vimrc
- ✓ Create symlink to the new configuration
- ✓ Install vim-plug
- ✓ Install all plugins automatically
### Manual Install
```bash
# 1. Clone the repository
git clone https://github.com/m1ngsama/chopsticks.git ~/.vim
# 2. Create symlink
ln -sf ~/.vim/.vimrc ~/.vimrc
# 3. Install vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# 4. Open Vim and install plugins
vim +PlugInstall +qall
```
## Essential Key Mappings
### File Operations
| Key | Action |
|-----|--------|
| `,w` | Quick save |
| `,q` | Quick quit |
| `,x` | Save and quit |
### Navigation
| Key | Action |
|-----|--------|
| `Ctrl+n` | Toggle file explorer (NERDTree) |
| `Ctrl+p` | Fuzzy file search (FZF) |
| `Ctrl+h/j/k/l` | Navigate between windows |
| `,b` | Search open buffers |
### Code Intelligence
| Key | Action |
|-----|--------|
| `gd` | Go to definition |
| `gr` | Find references |
| `K` | Show documentation |
| `Tab` | Autocomplete (when popup is visible) |
### Editing
| Key | Action |
|-----|--------|
| `gc` | Comment/uncomment (in visual mode) |
| `Space` | Toggle fold |
| `,,+Enter` | Clear search highlight |
## Common Workflows
### Opening a Project
```bash
# Navigate to your project directory
cd ~/my-project
# Open Vim
vim
# Press Ctrl+n to open file explorer
# Press Ctrl+p to fuzzy search files
```
### Editing Code
1. Open a file with `Ctrl+p` or through NERDTree
2. Use `gd` to jump to definitions
3. Use `K` to view documentation
4. Use `Tab` for autocomplete while typing
5. Save with `,w`
### Working with Git
| Command | Action |
|---------|--------|
| `:Git status` | View git status |
| `:Git diff` | View changes |
| `:Git commit` | Commit changes |
| `:Git push` | Push to remote |
| `,gb` | Open git blame window |
### Search and Replace
```vim
" Search in current file
/searchterm
" Search across project (with FZF)
,rg
" Replace in file
:%s/old/new/g
" Replace with confirmation
:%s/old/new/gc
```
## Language-Specific Features
### Python
- Auto-formatting with Black (on save)
- Linting with flake8/pylint
- 4-space indentation
- 88-character line limit
**Setup:**
```bash
pip install black flake8 pylint
vim -c "CocInstall coc-pyright" -c "q"
```
### JavaScript/TypeScript
- Prettier formatting (on save)
- ESLint integration
- 2-space indentation
**Setup:**
```bash
npm install -g prettier eslint
vim -c "CocInstall coc-tsserver coc-prettier coc-eslint" -c "q"
```
### Go
- Auto-formatting with gofmt
- Auto-imports with goimports
- Tab indentation
**Setup:**
```bash
go install golang.org/x/tools/gopls@latest
vim -c "CocInstall coc-go" -c "q"
```
## Troubleshooting
### Plugins not working?
```vim
:PlugInstall
:PlugUpdate
```
### Autocomplete not working?
Make sure Node.js is installed:
```bash
node --version # Should be >= 14.14
```
Then install CoC language servers:
```vim
:CocInstall coc-json coc-tsserver coc-pyright
```
### FZF not finding files?
Install FZF and ripgrep:
```bash
# Ubuntu/Debian
sudo apt install fzf ripgrep
# macOS
brew install fzf ripgrep
```
### Colors look weird?
Add to your `~/.bashrc` or `~/.zshrc`:
```bash
export TERM=xterm-256color
```
## Customization
The `.vimrc` file is well-organized into sections:
1. **General Settings** (lines 1-150) - Basic Vim behavior
2. **Plugin Management** (lines 151-230) - Plugin list
3. **Key Mappings** (lines 300-400) - Custom shortcuts
4. **Plugin Settings** (lines 400-600) - Plugin configurations
To customize:
1. Open `~/.vim/.vimrc`
2. Find the section you want to modify
3. Make your changes
4. Reload with `:source ~/.vimrc` or restart Vim
### Common Customizations
**Change colorscheme:**
```vim
" In .vimrc, find the colorscheme line and change to:
colorscheme dracula
" or: solarized, onedark, gruvbox
```
**Change leader key:**
```vim
" Default is comma (,), change to space:
let mapleader = " "
```
**Disable relative line numbers:**
```vim
set norelativenumber
```
## Next Steps
1. Read the full [README.md](README.md) for complete documentation
2. Check out `:help` in Vim for built-in documentation
3. Customize the configuration to your needs
4. Share your improvements!
## Quick Reference Card
Print this for your desk:
```
┌─────────────────────────────────────────────┐
│ Vim Quick Reference │
├─────────────────────────────────────────────┤
│ FILES │
│ Ctrl+n File explorer │
│ Ctrl+p Fuzzy find files │
│ ,w Save │
│ ,q Quit │
├─────────────────────────────────────────────┤
│ NAVIGATION │
│ gd Go to definition │
│ gr Find references │
│ K Show docs │
│ Ctrl+o Jump back │
│ Ctrl+i Jump forward │
├─────────────────────────────────────────────┤
│ EDITING │
│ gc Comment (visual mode) │
│ Tab Autocomplete │
│ Space Toggle fold │
├─────────────────────────────────────────────┤
│ SEARCH │
│ /text Search forward │
│ ?text Search backward │
│ ,rg Project-wide search │
│ ,,Enter Clear highlight │
└─────────────────────────────────────────────┘
```
Happy Vimming! 🚀