Commit graph

22 commits

Author SHA1 Message Date
cc328cebf2 fix: round 2 — completion speed, octal numbers, dead files
- Reduce asyncomplete popup delay 200ms→50ms for snappier completion
- Add nrformats-=octal: Ctrl-A on 007 now goes to 008, not 010
- Add formatoptions+=j: joining comment lines removes duplicate leaders
- Remove coc-settings.json (vestigial, CoC not used)
- Fix .gitignore: was blocking all *.json files unnecessarily
- Update README: Python LSP is pylsp only (pyright removed)
2026-04-21 23:32:59 +08:00
575ff2c489 fix: comprehensive bug audit — 14 fixes for performance and usability
Critical bugs:
- Statusline colors never applied on startup (SLDefineColors called after colorscheme)
- noremap 0 ^ broke operator-pending mode (d0, c0, y0 all wrong)
- Two Python LSPs running simultaneously (pyright requires Node.js)
- asyncomplete_auto_completeopt=1 overriding completeopt settings
- ALE/vim-lsp diagnostic overlap (tsserver, gopls duplicated)
- Ctrl-s in insert mode shifted cursor right by one
- Startify buftype= clearing made buffer writable

Performance & usability:
- Switch to vim-solarized8 (proper termguicolors, maintained)
- Add ale_disable_lsp=1 for clean ALE/vim-lsp coexistence
- Remove redundant gofmt from Go fixers (goimports is superset)
- Add isort --profile black for formatter compatibility
- Remove dead godef references (unmaintained since 2020)
- Set lazyredraw globally, tw=0 default
- Remove vestigial coc-settings.json symlink from install.sh
2026-04-21 23:28:59 +08:00
4fb20177ef
Fix Previm browser opener
Configure Previm to open Markdown previews via /usr/bin/open on macOS, with an xdg-open fallback for Linux desktop environments.
2026-04-15 17:47:19 +08:00
5604eddbdb fix: remaining usability and design improvements
.vimrc:
- Remove path+=** (hangs on large repos with node_modules)
- Add plugin guards for FZF, Git, ALE, Markdown, EasyMotion, UndoTree
  mappings (prevent E492 when plugins not loaded)
- Replace SmartFiles system() subprocess with isdirectory/finddir
  (no more synchronous fork on every Ctrl+p)
- Remove duplicate SLDefineColors VimEnter call (ColorScheme alone suffices)
- Convert all remaining nmap/map to nnoremap/noremap (eliminate recursive
  mapping risk and visual/operator-pending mode contamination)
- Expand cheat sheet with spell checking, utilities, window resize,
  F-key toggles, EasyMotion line motions, buffer management

get.sh:
- Support NO_COLOR and non-TTY output
- Show version tag or commit hash after clone/pull

QUICKSTART.md:
- Warn about first-launch plugin install (30-60s wait)
- Note that some language servers need Node.js
2026-04-15 10:15:07 +08:00
233ceabf53 fix: usability and design improvements across .vimrc, install.sh, README
.vimrc:
- Remove global eventignore+=FileType corruption in large file handler
- Add t_8f/t_8b for tmux true color support
- Fix vnoremap J/K shadowing built-in J (join); use Alt+j/k in visual mode
- Replace map with nnoremap for buffer/tab/spell/misc mappings (prevents
  visual/operator-pending mode contamination)
- Change BufEnter to FileType for formatoptions (fires less frequently)
- Remove duplicate whitespace trim (ALE already handles it via fix_on_save)
- Guard <leader>so to only source vim files
- Guard <leader>cp/<leader>cf with has('clipboard')
- Add completeopt=popup for floating completion docs (Vim 8.1.1517+)
- Change Startify header from "MINGSAMA" to "chopsticks"
- Make Startify bookmarks conditional (only show shell rc files that exist)
- EasyMotion <Leader>j/k: map → nmap (prevent visual mode leak)
- Move-line: nnoremap instead of nmap for normal mode variant

install.sh:
- Add --help flag
- Support NO_COLOR and non-TTY output (no ANSI codes when redirected)
- Include $BASH_COMMAND in ERR trap for better debugging
- Use mktemp for secure temp files instead of predictable /tmp paths
- Warn user when pip falls back to --break-system-packages

README:
- Add missing mappings: jk, F2-F6, gV, //, ,ev, ,sv, ,cp, ,cf, ,*, ,F, ,W, ,ms, ,ss
- Note that some language servers require Node.js even though vim-lsp doesn't
- Clarify Alt+j/k works in both normal and visual mode
2026-04-15 10:08:10 +08:00
0ba2e84e0c fix: correct 13 bugs across .vimrc, install.sh, and docs
.vimrc:
- Fix syntax=OFF no-op in large file handler (syntax= is correct)
- Fix <leader>rG broken -F flag (new RgWord command with -F before --)
- Fix :Gdiff → :Gdiffsplit (fugitive v3+ compat)
- Fix go_def_mode/go_info_mode conflicting with go_gopls_enabled=0
- Fix <leader>m prefix collision with mt/mp (renamed to <leader>ms)
- Wrap PlugInstall autocmd in augroup (prevent doubling on re-source)

install.sh:
- Guard against empty version string in hadolint/marksman downloads
- Add HAS_SUDO check in _do_binary_apt before sudo mv
- Add PlugClean warning when existing plugins directory is non-empty
- Fix pkg_install brew-first priority (macOS-only now, Linux fallback)
- Fix menu double-draw flicker on first render
- Fix Fedora deselected tools not tracked in SKIPPED array

docs:
- Remove nonexistent nvm install step from README
- Fix TOC description (side window, not quickfix) in README/QUICKSTART
- Fix TTY detection description (add dumb, empty, builtin)
- Add missing ,cd and ,wa mappings to README
- Remove dead CoC formatOnSaveFiletypes from coc-settings.json
2026-04-15 09:57:26 +08:00
0b3f631e98 fix: correct non-TTY vim-plug install; add real plugin count check
- _vim_run non-TTY branch: remove </dev/null (caused "Error reading
  input, exiting" before downloads finished → 0 plugins installed) and
  >/dev/null (broke async job callbacks → partial install of ~13/26).
  Now only redirects stderr; stdin inherits from caller so vim's event
  loop runs to completion.
- Add post-install verification: count ~/.vim/plugged entries and die
  if empty, replacing the unconditional "ok Plugins installed" that
  masked failures silently.
- .vimrc, install.sh, QUICKSTART.md, README.md: carry forward the full
  v1.2 rewrite (checkbox module selection, solarized palette, LSP
  stack) that accumulated in the previous session.

Tested: macOS (27 plugins, exit 0) and Arch Linux SSH (26 plugins,
exit 0). shellcheck: zero warnings.
2026-04-10 18:43:52 +08:00
4a9c9354a2 fix: restore original art header as static list (no system() call) 2026-04-09 22:49:52 +08:00
b2b1632857 fix: terminal garble, black screen on startup, Unicode in header
.vimrc:
- TTY detection: add empty($TERM) and dumb — fixes black screen when
  TERM is unset (non-interactive SSH, minimal environments)
- Replace StartifyHeader() with a static ASCII list — removes the
  synchronous system('git ...') call that caused the black screen while
  vim waited for git before rendering, and removes Unicode block chars
  (███╗) that rendered as garbage on terminals without full UTF-8

install.sh:
- _vim_run() helper: uses </dev/tty when accessible so vim properly
  manages the alternate screen buffer and restores terminal state on
  exit — this was the root cause of garbled output after PlugInstall
  and CocInstall steps; falls back to --not-a-term for CI environments
- Remove 'screen may go dark' warning — no longer needed since terminal
  state is properly managed via /dev/tty

Remove CHANGELOG.md — use git log
2026-04-09 22:48:55 +08:00
74071f7464 feat: absorb 15 best practices from top global vim configs (amix, tpope, ThePrimeagen, YADR, spf13)
Settings (vim-sensible / community consensus):
- set ttimeoutlen=10 — eliminates ESC lag in terminal Vim
- set display+=lastline — show truncated last line instead of @@@
- set complete-=i — faster Ctrl+n/p by not scanning included files
- set wildignorecase — case-insensitive filename completion
- set path+=** — recursive :find with wildignore exclusions
- set sessionoptions — clean session saves without stale plugin options
- Expand wildignore: node_modules, __pycache__, dist, build

Visible whitespace:
- set listchars (TTY: ASCII; GUI: Unicode symbols) — F6 to toggle

Line-length guides (textwidth + colorcolumn=+1):
- Python: 88, Go: 120, JS/TS: 100, Rust: 100, Shell: 80
- Markdown: no limit (colorcolumn=0), all others via +1

Autocmds:
- ChopstickFormatOptions: formatoptions-=cro on BufEnter (disables
  auto-comment-continuation — universally desired, overrides filetype plugins)
- ChopstickPaste: InsertLeave → set nopaste (prevents broken indent)

Key mappings:
- vnoremap J/K — move selected lines with =gv re-indent (ThePrimeagen)
- gV — reselect last pasted text (`[v`] — spf13, YADR)
- cnoremap Ctrl+p/n — command history navigation (amix, spf13)
- <leader>e — :Explore (built-in file browser, plugin-free fallback)
- <leader>cd — lcd to current file's directory (was: cd, now window-local)
- F6 — toggle visible whitespace
- <leader>sv — reload vimrc with confirmation echo
2026-04-09 12:43:47 +08:00
23ad2e5b7a feat: ergonomics overhaul, tmux integration, and beginner onboarding (v1.1.0)
Keybindings:
- Add jk → Esc in insert mode (ergonomic escape)
- Add Ctrl+s save in normal and insert mode
- Add // visual search (very-nomagic escaped)
- Add <leader>p/P clipboard paste
- Add <leader>rG ripgrep word under cursor (-F literal)
- Add <leader>u / <leader>tt as leader aliases for F5/F8
- Fix ALE [e/]e navigation direction (was reversed)
- Remove dead <C-h/j/k/l> maps (owned by vim-tmux-navigator)
- Remove <leader>pp (duplicate of F2, caused 500ms delay on <leader>p)

Plugins:
- Add vim-tmux-navigator for seamless Vim/tmux pane navigation
- Fix <leader>rG: pass -F so regex metacharacters don't corrupt matches
- Fix LargeFileSettings: disable ALE for files >10MB

In-Vim UX:
- Add ,? cheat sheet (read-only buffer, q to close)
- ALE lint triggers: normal/enter/insert-leave now active

install.sh:
- Add tmux.conf auto-configuration step with C-l warning
- Add post-install survival guide for first-time Vim users

Docs:
- README: full badge row (release, stars, issues, last-commit, PRs, plugins, languages)
- README: Contributing section with bug/PR guidelines
- QUICKSTART: Step 0 — Vim modes and 4 survival commands for beginners
- CHANGELOG: v1.1.0 entry
2026-04-09 12:20:10 +08:00
9442aa0499 ux: dashboard-style startup — fullscreen Startify, m1ngsama header
- Remove NERDTree auto-open on bare `vim` — Startify now renders
  fullscreen like neovim's snacks dashboard (use Ctrl+n for tree)
- `vim .` keeps NERDTree left + Startify right (directory workflow)
- Replace minimal text header with centered m1ngsama ASCII block art
  (mirrors neovim config aesthetic)
- Center art and info subheader dynamically based on window width
- Add startify_padding_left = 4 for list item breathing room
- Reorder lists: Sessions → Recent Files → Current Dir → Bookmarks
2026-03-29 19:54:44 +08:00
3daf725ad8
audit: wrap loose autocmds in augroups, fix install.sh robustness (#13)
.vimrc:
- Wrap all loose autocmds in named augroups with autocmd! (prevents
  doubling on :source $MYVIMRC): ChopstickTabHistory, ChopstickResize,
  ChopstickStdin, CocHighlight, ChopstickCleanup, ChopstickFiletype,
  ChopstickTTYLargeFile, ChopstickWhichKey, ChopstickStartify

install.sh:
- Add Arch Linux (pacman) branch for system tools
- Add hadolint to system tools (brew/apt binary download/pacman)
- Add staticcheck to Go tools
- Add yamllint to pip tools
- Remove sqlfmt from npm (SQL unified to sqlfluff via pip)
- Remove coc-marksman (package does not exist on npm)
- Add coc-settings.json symlink step with backup
- Add pip3 bootstrap when python3 present but pip3 absent
- Fix PlugInstall and CocInstall to use </dev/null (TTY-safe)

coc-settings.json:
- New file: configures marksman as Markdown LSP server for CoC
  (replaces the broken coc-marksman npm package approach)
2026-03-29 16:36:43 +08:00
db16c2f8fc
fix: vim-go startup hang, E495 errors, and afile guard safety (#12)
vim-go / install hang:
- Remove { 'do': ':GoUpdateBinaries' } from vim-go Plug declaration.
  This hook downloads gopls, dlv, gotest and ~10 other binaries during
  PlugInstall, causing multi-minute hangs that look like vim is frozen.
  Run :GoUpdateBinaries manually if Go debugging tools are needed.

vim-go / CoC conflict:
- Add g:go_gopls_enabled = 0 — disables vim-go's own gopls client.
  Without this, vim-go registers a BufWinEnter * autocmd that calls
  go#lsp#DidOpen(expand('<afile>:p')), which fires on NERDTree/Startify
  buffers (no file name), triggers E495, and makes vim wait for Enter.
- g:go_fmt_autosave = 0, g:go_imports_autosave = 0 — CoC/ALE handle
  format-on-save; vim-go's auto-save would double-format.
- g:go_code_completion_enabled = 0 — CoC handles completion.
- Keep vim-go syntax highlights (go_highlight_*) which CoC doesn't provide.

<afile> guard (E495 hardening):
- BWCCreateDir (BufWritePre): wrap in !empty(expand('<afile>')) guard.
- LargeFile (BufReadPre): same guard — special buffers have no file name.
- CleanExtraSpaces (BufWritePre): guard with empty(&buftype) in addition,
  so it only runs for normal file buffers, not terminals or help windows.
- TTY BufReadPre size check: same guard.
2026-03-29 12:22:21 +08:00
6b8d691c61
UX audit: startup experience, ergonomics, and interaction fixes (#9)
Startup / welcome screen:
- Startify header is now dynamic: shows config name, Vim version,
  current dir, git branch, and key usage hints (leader, Ctrl-p, ,rg)
- Reorder Startify sections: Sessions first (project restore), then
  directory files, recent files, bookmarks
- Add default bookmarks: ~/.vimrc, ~/.zshrc, ~/.bashrc
- vim <dir>: NERDTree opens left, Startify opens right (replaces the
  broken `ene` empty-buffer hack that left an unnamed buffer)
- vim (no args): NERDTree opens alongside Startify via User Startified
  event, keeping Startify focused — both panels visible from the start
- Consolidate StdinReadPre into a single top-level autocmd so pipe/
  heredoc input is correctly detected in all startup branches

Mapping fixes:
- <leader>bd: remove `:tabclose<cr>gT` chain — it was closing the
  entire tab on every buffer close regardless of other open buffers
- tnoremap <Esc>: change to <Esc><Esc> — single Esc now passes through
  to the running terminal program (fzf, htop, etc.); double Esc exits
- <C-p>: smart file search — uses GFiles (respects .gitignore) inside
  git repos, falls back to Files outside git trees

General UX:
- set lazyredraw moved to TTY-only block — it caused CoC floating
  window flicker in capable terminals; still active in TTY for perf
- Markdown FileType: add tw=0 — prevents global tw=500 from mangling
  gq line wrapping in markdown buffers
- CleanExtraSpaces: expand from 6 hardcoded extensions to all files;
  function is cursor-safe (saves/restores position) so it is harmless
  when ALE trim_whitespace also runs

which-key:
- Add 'd': 'diagnostics' to [a] group — <leader>ad was mapped to
  CocDiagnostics but invisible in the key hint overlay
2026-03-28 18:45:25 +08:00
43baa9753a
Expand LSP and lint coverage for full-stack development languages (#7)
ALE linters:
- Add css/scss: stylelint
- Add markdown: markdownlint
- Add sql: sqlfluff

ALE fixers:
- Add scss, less: prettier
- Add sql: sqlfmt

vim-lsp fallback (no Node.js path):
- Add html, css, scss, json, yaml: vscode language servers
- Add markdown: marksman
- Add sql: sqls

install.sh (CoC path):
- Add coc-go, coc-rust-analyzer, coc-marksman, coc-sql to auto-install
- Expand optional tools section with stylelint, markdownlint, sqlfluff, marksman
2026-03-28 18:30:19 +08:00
323bf4a6b3
LSP 分层后端、UI 增强、UX 修复与完整文档
合并 PR #5:tiered LSP backend (CoC/vim-lsp), vim-which-key, vim-startify, indentLine, 修复按键冲突,UX 改进。
2026-02-21 12:30:06 +08:00
0e61537142 Fix critical installation and configuration bugs
This commit addresses multiple issues discovered during code review:

1. Fix variable definition order in .vimrc
   - Move g:is_tty and g:has_true_color definitions to top of file
   - Previously used at line 32 but defined at line 263
   - Ensures variables are available before first use

2. Remove duplicate configuration settings in .vimrc
   - Remove duplicate set number, wildmenu, ruler
   - Remove duplicate search settings (ignorecase, smartcase, hlsearch, incsearch)
   - Remove duplicate backspace and wildignore settings
   - Reduces file size and eliminates confusion

3. Enhance install.sh reliability
   - Add directory validation to ensure script runs from ~/.vim
   - Add symlink validation after creation
   - Fix CoC installation command syntax (vim -c to vim +)
   - Move helper functions before usage
   - Prevents symlink-to-self errors

4. Improve installation documentation
   - Add warnings in README.md about running from correct directory
   - Add IMPORTANT notes in QUICKSTART.md
   - Update installation step descriptions
   - Prevents common user installation mistakes

These fixes improve installation reliability and prevent configuration errors.
2025-12-30 09:53:14 +08:00
Claude
3bb1a442c7
Optimize for basic terminal environments (TTY users)
Changes:
- Add automatic TTY detection (TERM=linux, screen, builtin)
- Disable true color mode in TTY for compatibility
- Use ASCII separators instead of powerline fonts in TTY
- Fallback to default colorscheme for 16-color terminals
- Disable cursorline in TTY for better performance
- Simplify signcolumn to 'auto' in TTY
- Disable FZF preview windows in TTY
- Skip auto-opening NERDTree in TTY for faster startup
- Use simpler status line in TTY environments
- Reduce syntax highlighting complexity (synmaxcol=120)
- Disable syntax for files >512KB in TTY
- Add informative message on first TTY run

Benefits for TTY users:
- Faster startup time
- Better performance in resource-constrained environments
- No font dependency issues
- Compatible with basic 16-color terminals
- Works on Linux console, serial terminals
- Optimized for remote sessions over slow connections

All optimizations are automatic - no configuration needed.
2025-12-30 00:32:33 +00:00
Claude
0ea76e6ae7
Remove all icons and emojis - keep it simple (KISS principle)
Changes:
- Replaced checkmarks with plain text in README.md
- Replaced emoji icons with [OK] in install.sh
- Changed ALE error/warning signs from unicode to ASCII (X and !)
- Removed rocket emoji from QUICKSTART.md
- All output now uses simple ASCII characters

Follows KISS (Keep It Simple, Stupid) principle for better:
- Terminal compatibility
- Accessibility
- Readability in all environments
- No font dependencies
2025-12-30 00:29:35 +00:00
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
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