No description
Find a file
Claude d457e832be
完全重构:从Neovim迁移到原生Vim配置
重大变更:
- 移除所有Neovim Lua配置(init.lua, lua/目录)
- 创建全新的.vimrc配置文件,汲取互联网优秀实践
- 使用vim-plug作为插件管理器
- 集成20+精选插件,涵盖文件导航、Git、代码编辑、语法检查等

核心特性:
- NERDTree文件浏览器
- FZF模糊查找
- vim-fugitive Git集成
- ALE异步语法检查
- CoC智能补全和LSP支持
- vim-airline美化状态栏
- Gruvbox配色方案

插件列表:
- 文件导航:NERDTree, FZF, CtrlP
- Git工具:vim-fugitive, vim-gitgutter
- 代码编辑:vim-surround, vim-commentary, auto-pairs
- 语言支持:vim-polyglot, vim-go
- 生产力工具:UndoTree, Tagbar, EasyMotion
- 配色方案:Gruvbox, Dracula, Solarized, OneDark

配置亮点:
- 智能行号(绝对+相对)
- 自动安装vim-plug
- 丰富的键位映射(leader键为逗号)
- 多语言支持和自动格式化
- 详细的功能分区和注释

文档:
- 全新的README.md,包含详细的安装指南
- 完整的键位映射表
- 插件配置说明
- 故障排除指南

参考来源:
- amix/vimrc
- vim-plug官方文档
- 2025年现代Vim最佳实践
2025-12-29 14:15:46 +00:00
.gitignore lazyvim, autocmds, options, keymaps, plugins added 2024-12-10 00:40:12 +08:00
.vimrc 完全重构:从Neovim迁移到原生Vim配置 2025-12-29 14:15:46 +00:00
LICENSE Initial commit 2024-11-16 17:57:38 +08:00
README.md 完全重构:从Neovim迁移到原生Vim配置 2025-12-29 14:15:46 +00:00

The Ultimate Vim Configuration

A comprehensive, modern Vim configuration inspired by the best practices from the Vim community. This configuration transforms vanilla Vim into a powerful, feature-rich development environment.

Features

Core Enhancements

  • Smart Line Numbers: Hybrid line numbers (absolute + relative) for efficient navigation
  • Modern UI: Gruvbox color scheme with airline status bar
  • Plugin Management: vim-plug for easy plugin installation and updates
  • Auto-completion: CoC (Conquer of Completion) for intelligent code completion
  • Syntax Checking: ALE (Asynchronous Lint Engine) for real-time linting

File Navigation

  • NERDTree: Visual file explorer (Ctrl+n)
  • FZF: Blazing fast fuzzy finder (Ctrl+p)
  • CtrlP: Alternative fuzzy file finder
  • Easy Motion: Jump to any location with minimal keystrokes

Git Integration

  • Fugitive: Complete Git wrapper for Vim
  • GitGutter: Show git diff in the sign column

Code Editing

  • Auto-pairs: Automatic bracket/quote pairing
  • Surround: Easily change surrounding quotes, brackets, tags
  • Commentary: Quick code commenting (gc)
  • Multi-language Support: vim-polyglot for 100+ languages

Productivity Tools

  • UndoTree: Visualize and navigate undo history (F5)
  • Tagbar: Code structure browser (F8)
  • Smart Window Management: Easy navigation with Ctrl+hjkl

Installation

1. Clone this repository

git clone https://github.com/m1ngsama/chopsticks.git ~/.vim
cd ~/.vim
ln -s ~/.vim/.vimrc ~/.vimrc

3. Install vim-plug and plugins

Open Vim and the plugins will be automatically installed:

vim

Or manually install plugins:

:PlugInstall

For the best experience, install these optional dependencies:

# FZF (fuzzy finder)
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

# ripgrep (better grep)
# On Ubuntu/Debian
sudo apt install ripgrep

# On macOS
brew install ripgrep

# Node.js (for CoC)
# Required for code completion
curl -sL install-node.now.sh/lts | bash

# Universal Ctags (for Tagbar)
# On Ubuntu/Debian
sudo apt install universal-ctags

# On macOS
brew install universal-ctags

5. Install CoC language servers

For intelligent code completion, install language servers:

" Python
:CocInstall coc-pyright

" JavaScript/TypeScript
:CocInstall coc-tsserver

" Go
:CocInstall coc-go

" JSON
:CocInstall coc-json

" HTML/CSS
:CocInstall coc-html coc-css

" See more: https://github.com/neoclide/coc.nvim/wiki/Using-coc-extensions

Key Mappings

General

Key Action
,w Quick save
,q Quick quit
,x Save and quit
,, + Enter Clear search highlight

Window Navigation

Key Action
Ctrl+h Move to left window
Ctrl+j Move to bottom window
Ctrl+k Move to top window
Ctrl+l Move to right window

Buffer Management

Key Action
,l Next buffer
,h Previous buffer
,bd Close current buffer
,ba Close all buffers

Tab Management

Key Action
,tn New tab
,tc Close tab
,tl Toggle to last tab

File Navigation

Key Action
Ctrl+n Toggle NERDTree
,n Find current file in NERDTree
Ctrl+p FZF file search
,b FZF buffer search
,rg Ripgrep search

Code Navigation (CoC)

Key Action
gd Go to definition
gy Go to type definition
gi Go to implementation
gr Go to references
K Show documentation
[g Previous diagnostic
]g Next diagnostic
,rn Rename symbol

Linting (ALE)

Key Action
,aj Next error/warning
,ak Previous error/warning

Other Utilities

Key Action
F2 Toggle paste mode
F3 Toggle line numbers
F4 Toggle relative numbers
F5 Toggle UndoTree
F8 Toggle Tagbar
Space Toggle fold
s + 2 chars EasyMotion jump

Plugin List

  • NERDTree: File system explorer
  • FZF: Fuzzy file finder
  • CtrlP: Alternative fuzzy finder

Git

  • vim-fugitive: Git integration
  • vim-gitgutter: Git diff in sign column

UI

  • vim-airline: Enhanced status line
  • gruvbox: Color scheme

Code Editing

  • vim-surround: Manage surroundings
  • vim-commentary: Code commenting
  • auto-pairs: Auto close brackets
  • ALE: Asynchronous linting

Language Support

  • vim-polyglot: Language pack for 100+ languages
  • vim-go: Go development

Productivity

  • UndoTree: Undo history visualizer
  • Tagbar: Code structure browser
  • EasyMotion: Fast cursor movement
  • CoC: Code completion and LSP

Color Schemes

Available color schemes (change in .vimrc):

  • gruvbox (default) - Warm, retro groove colors
  • dracula - Dark theme with vivid colors
  • solarized - Precision colors for machines and people
  • onedark - Atom's iconic One Dark theme

To change:

colorscheme dracula

Customization

The configuration is organized into sections:

  1. General Settings: Basic Vim behavior
  2. Plugin Management: vim-plug configuration
  3. Colors & Fonts: Visual appearance
  4. Key Mappings: Custom keybindings
  5. Plugin Settings: Individual plugin configurations
  6. Auto Commands: File-type specific settings
  7. Helper Functions: Utility functions

Feel free to modify any section to suit your needs!

Language-Specific Settings

Python

  • 4 spaces indentation
  • 88 character line limit (Black formatter)
  • Auto-formatting with Black on save

JavaScript/TypeScript

  • 2 spaces indentation
  • Prettier formatting on save
  • ESLint integration

Go

  • Tab indentation
  • Auto-formatting with gofmt
  • Auto-import with goimports

Troubleshooting

Plugins not working

:PlugInstall
:PlugUpdate

CoC not working

Make sure Node.js is installed:

node --version  # Should be >= 14.14

Colors look wrong

Enable true colors in your terminal emulator and add to your shell rc:

export TERM=xterm-256color

References

This configuration is inspired by:

License

MIT License - Feel free to use and modify!

Contributing

Suggestions and improvements are welcome! Feel free to open an issue or submit a pull request.