diff --git a/.vimrc b/.vimrc index 827d725..fc64f3b 100644 --- a/.vimrc +++ b/.vimrc @@ -1,8 +1,13 @@ +let g:chopsticks_dir = fnamemodify(resolve(expand('')), ':h') +let s:local_config = expand(get(g:, 'chopsticks_local_config', + \ '~/.config/chopsticks.vim')) +if filereadable(s:local_config) + execute 'source ' . fnameescape(s:local_config) +endif + if exists('g:chopsticks_loaded') | finish | endif let g:chopsticks_loaded = 1 -let g:chopsticks_dir = fnamemodify(resolve(expand('')), ':h') - function! s:load(mod) abort execute 'source ' . g:chopsticks_dir . '/modules/' . a:mod . '.vim' endfunction diff --git a/CHANGELOG.md b/CHANGELOG.md index 15580c7..16ed8b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Added +- `~/.config/chopsticks.vim` local pre-load config for profile and user choices +- `g:chopsticks_enable_markdown_preview` to control Previm independently - `g:chopsticks_profile` with `minimal`, `engineer`, and `full` profiles - `.markdownlint.json` aligned with the project's README/changelog style - `:ChopsticksStatus` diagnostic command — checks system tools, LSP servers, linters, formatters @@ -24,6 +26,9 @@ - Swap files are enabled again and stored under `~/.vim/.swap` for crash recovery - Installer defaults are slimmer: only core search tools stay selected by default; language and lint suites are opt-in +- `:ChopsticksStatus` now respects disabled LSP/lint profiles instead of reporting + intentionally disabled tools as missing +- `,sv` now clears the load guard before sourcing `$MYVIMRC` - CI now verifies key plugin directories, Markdown quiet defaults, markdownlint, and an explicit startup-time threshold - Skip 2 more built-in plugins: openPlugin, manpager (10 → 12 total) diff --git a/QUICKSTART.md b/QUICKSTART.md index cc054d6..4f2b0c1 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -10,8 +10,8 @@ curl -fsSL https://raw.githubusercontent.com/m1ngsama/chopsticks/main/get.sh | b Open vim. First launch auto-installs plugins — **wait 30-60s, don't close vim**. Restart when done. -Default profile is `engineer`. Put `let g:chopsticks_profile = 'minimal'` -before loading chopsticks for a smaller core-only setup, or use `full` for the +Default profile is `engineer`. Put `let g:chopsticks_profile = 'minimal'` in +`~/.config/chopsticks.vim` for a smaller core-only setup, or use `full` for the heavier Markdown/LSP feedback. ## Modes diff --git a/README.md b/README.md index 927cca4..5cbe958 100644 --- a/README.md +++ b/README.md @@ -67,15 +67,18 @@ First launch installs plugins automatically (30-60s). Restart vim when done. Default profile: `engineer`. ```vim -" Put this before sourcing chopsticks. +" Put this in ~/.config/chopsticks.vim. let g:chopsticks_profile = 'minimal' " core navigation/editing/git/markdown let g:chopsticks_profile = 'engineer' " default: LSP, ALE, syntax extras let g:chopsticks_profile = 'full' " engineer + heavier Markdown feedback ``` `minimal` avoids LSP, ALE, completion plugins, extra language syntax plugins, -Startify, and UndoTree. `full` keeps those and opts into Markdown lint, format, -spell, conceal, Marksman, and LSP virtual text. +Startify, UndoTree, and browser Markdown preview. `full` keeps those and opts +into Markdown lint, format, spell, conceal, Marksman, and LSP virtual text. + +Project updates leave `~/.config/chopsticks.vim` alone, so put local choices +there instead of editing the managed `.vimrc`. ## Keys diff --git a/install.sh b/install.sh index 1af57df..a660e0f 100755 --- a/install.sh +++ b/install.sh @@ -2,7 +2,7 @@ # install.sh - chopsticks vim configuration installer # Usage: cd /path/to/chopsticks && ./install.sh [--yes] [--help] # -# --yes non-interactive: install all optional components automatically +# --yes non-interactive: use default component selections # --help show this help and exit set -eo pipefail @@ -16,7 +16,7 @@ for arg in "$@"; do echo "Usage: ./install.sh [OPTIONS]" echo "" echo "Options:" - echo " --yes Non-interactive mode: select all defaults automatically" + echo " --yes Non-interactive mode: use default component selections" echo " --help Show this help and exit" echo "" echo "Supported platforms: macOS (brew), Debian/Ubuntu (apt), Arch (pacman), Fedora (dnf)" diff --git a/modules/env.vim b/modules/env.vim index 99f83fe..004f019 100644 --- a/modules/env.vim +++ b/modules/env.vim @@ -22,6 +22,8 @@ let g:chopsticks_enable_extra_languages = get(g:, \ 'chopsticks_enable_extra_languages', !s:profile_minimal) let g:chopsticks_enable_ui_extras = get(g:, 'chopsticks_enable_ui_extras', \ !s:profile_minimal) +let g:chopsticks_enable_markdown_preview = get(g:, + \ 'chopsticks_enable_markdown_preview', !s:profile_minimal) let g:chopsticks_markdown_lint = get(g:, 'chopsticks_markdown_lint', \ s:profile_full) diff --git a/modules/plugins.vim b/modules/plugins.vim index ad5e82b..508f1f7 100644 --- a/modules/plugins.vim +++ b/modules/plugins.vim @@ -44,10 +44,12 @@ endif " ── Language Syntax ────────────────────────────────────────────────────────── Plug 'preservim/vim-markdown', { 'for': 'markdown' } +if g:chopsticks_enable_markdown_preview + Plug 'previm/previm', { 'on': 'PrevimOpen' } +endif if g:chopsticks_enable_extra_languages Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] } Plug 'HerringtonDarkholme/yats.vim', { 'for': ['typescript', 'typescript.tsx'] } - Plug 'previm/previm', { 'on': 'PrevimOpen' } Plug 'fatih/vim-go', { 'for': 'go' } endif diff --git a/modules/tools.vim b/modules/tools.vim index 862604e..7867809 100644 --- a/modules/tools.vim +++ b/modules/tools.vim @@ -34,7 +34,7 @@ nnoremap W :%s/\s\+$//:let @/='' vnoremap W :s/\s\+$//:let @/=''gv nnoremap ev :edit $MYVIMRC -nnoremap sv :source $MYVIMRC:echo "vimrc reloaded" +nnoremap sv :unlet! g:chopsticks_loaded:source $MYVIMRC:echo "vimrc reloaded" nnoremap * :%s/\<\>//g vnoremap * :s///g @@ -123,7 +123,14 @@ function! s:Check(name, cmd) abort return executable(a:cmd) ? ' OK ' . a:name : ' -- ' . a:name . ' (missing: ' . a:cmd . ')' endfunction +function! s:Off(name, reason) abort + return ' off ' . a:name . ' (' . a:reason . ')' +endfunction + function! s:LspCheck(ft, server) abort + if !get(g:, 'chopsticks_enable_lsp', 1) + return s:Off(a:ft, 'LSP disabled by profile') + endif if !exists('*lsp#get_server_names') return ' -- ' . a:ft . ' (vim-lsp not loaded)' endif @@ -165,32 +172,40 @@ function! s:ChopsticksStatus() abort call add(l:lines, '') call add(l:lines, '── linters ──') - call add(l:lines, s:Check('flake8 (python)', 'flake8')) - call add(l:lines, s:Check('pylint (python)', 'pylint')) - call add(l:lines, s:Check('eslint (js/ts)', 'eslint')) - call add(l:lines, s:Check('staticcheck (go)', 'staticcheck')) - call add(l:lines, s:Check('shellcheck (sh)', 'shellcheck')) - call add(l:lines, s:Check('yamllint (yaml)', 'yamllint')) - call add(l:lines, s:Check('hadolint (docker)', 'hadolint')) - if get(g:, 'chopsticks_markdown_lint', 0) - call add(l:lines, s:Check('markdownlint (md)', 'markdownlint')) + if get(g:, 'chopsticks_enable_lint', 1) + call add(l:lines, s:Check('flake8 (python)', 'flake8')) + call add(l:lines, s:Check('pylint (python)', 'pylint')) + call add(l:lines, s:Check('eslint (js/ts)', 'eslint')) + call add(l:lines, s:Check('staticcheck (go)', 'staticcheck')) + call add(l:lines, s:Check('shellcheck (sh)', 'shellcheck')) + call add(l:lines, s:Check('yamllint (yaml)', 'yamllint')) + call add(l:lines, s:Check('hadolint (docker)', 'hadolint')) + if get(g:, 'chopsticks_markdown_lint', 0) + call add(l:lines, s:Check('markdownlint (md)', 'markdownlint')) + else + call add(l:lines, s:Off('markdownlint (md)', 'disabled by default')) + endif else - call add(l:lines, ' off markdownlint (md) (disabled by default)') + call add(l:lines, s:Off('ALE linters', 'lint disabled by profile')) endif call add(l:lines, '') call add(l:lines, '── formatters ── (format-on-save is ' . (get(g:, 'ale_fix_on_save', 0) ? 'ON' : 'OFF') . ')') - call add(l:lines, s:Check('black (python)', 'black')) - call add(l:lines, s:Check('isort (python)', 'isort')) - call add(l:lines, s:Check('prettier (js/ts/json)', 'prettier')) - if get(g:, 'chopsticks_markdown_format_on_save', 0) - call add(l:lines, s:Check('prettier (md)', 'prettier')) + if get(g:, 'chopsticks_enable_lint', 1) + call add(l:lines, s:Check('black (python)', 'black')) + call add(l:lines, s:Check('isort (python)', 'isort')) + call add(l:lines, s:Check('prettier (js/ts/json)', 'prettier')) + if get(g:, 'chopsticks_markdown_format_on_save', 0) + call add(l:lines, s:Check('prettier (md)', 'prettier')) + else + call add(l:lines, s:Off('prettier (md)', 'disabled by default')) + endif + call add(l:lines, s:Check('goimports (go)', 'goimports')) + call add(l:lines, s:Check('rustfmt (rust)', 'rustfmt')) + call add(l:lines, s:Check('clang-format (c)', 'clang-format')) else - call add(l:lines, ' off prettier (md) (disabled by default)') + call add(l:lines, s:Off('ALE formatters', 'lint disabled by profile')) endif - call add(l:lines, s:Check('goimports (go)', 'goimports')) - call add(l:lines, s:Check('rustfmt (rust)', 'rustfmt')) - call add(l:lines, s:Check('clang-format (c)', 'clang-format')) call add(l:lines, '') let l:ok = len(filter(copy(l:lines), 'v:val =~# " OK "')) @@ -199,7 +214,9 @@ function! s:ChopsticksStatus() abort call add(l:lines, ' ' . l:ok . ' ready, ' . l:miss . ' missing') call add(l:lines, '') call add(l:lines, ' Install missing tools with ./install.sh') - call add(l:lines, ' Install LSP servers with :LspInstallServer') + if get(g:, 'chopsticks_enable_lsp', 1) + call add(l:lines, ' Install LSP servers with :LspInstallServer') + endif let l:name = '__ChopsticksStatus__' if bufwinnr(l:name) > 0