Compare commits

..

No commits in common. "6b8d691c613aa0aba02f136fdb22ac7c313b29be" and "323bf4a6b3614baa1a7ff8a8cbcb0297d7cf4a22" have entirely different histories.

3 changed files with 68 additions and 140 deletions

110
.vimrc
View file

@ -106,6 +106,9 @@ set hid
" Configure backspace so it acts as it should act (enhanced from earlier basic setting) " Configure backspace so it acts as it should act (enhanced from earlier basic setting)
set whichwrap+=<,>,h,l set whichwrap+=<,>,h,l
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on " For regular expressions turn magic on
set magic set magic
@ -321,8 +324,8 @@ map <C-k> <C-W>k
map <C-h> <C-W>h map <C-h> <C-W>h
map <C-l> <C-W>l map <C-l> <C-W>l
" Close the current buffer (Bclose preserves window layout) " Close the current buffer
map <leader>bd :Bclose<cr> map <leader>bd :Bclose<cr>:tabclose<cr>gT
" Close all the buffers " Close all the buffers
map <leader>ba :bufdo bd<cr> map <leader>ba :bufdo bd<cr>
@ -436,40 +439,15 @@ let NERDTreeIgnore=['\.pyc$', '\~$', '\.swp$', '\.git$', '\.DS_Store', 'node_mod
" NERDTree window size " NERDTree window size
let NERDTreeWinSize=35 let NERDTreeWinSize=35
" Track stdin reads so startup autocmds can skip pipe/heredoc input " Automatically open NERDTree when vim starts on a directory
autocmd StdinReadPre * let s:std_in=1 " Disabled in TTY for faster startup
" Startup layout (non-TTY only — keeps TTY startup instant)
if !g:is_tty if !g:is_tty
augroup ChopstickStartup autocmd StdinReadPre * let s:std_in=1
autocmd! autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
" vim <dir> → NERDTree on left + Startify (or blank buffer) on right
autocmd VimEnter *
\ if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
\ exe 'NERDTree ' . fnameescape(argv()[0]) |
\ exe 'cd ' . fnameescape(argv()[0]) |
\ wincmd p |
\ if exists(':Startify') == 2 | Startify | else | enew | endif |
\ endif
" vim (no args) → Startify renders first; open NERDTree alongside it
autocmd User Startified
\ if argc() == 0 && !exists('s:std_in') |
\ NERDTree |
\ wincmd p |
\ endif
augroup END
endif endif
" --- FZF --- " --- FZF ---
" Smart file search: use GFiles (respects .gitignore) inside git repos, Files elsewhere map <C-p> :Files<CR>
function! s:SmartFiles() abort
if !empty(system('git rev-parse --show-toplevel 2>/dev/null'))
GFiles
else
Files
endif
endfunction
map <C-p> :call <SID>SmartFiles()<CR>
map <leader>b :Buffers<CR> map <leader>b :Buffers<CR>
map <leader>rg :Rg<CR> map <leader>rg :Rg<CR>
map <leader>rt :Tags<CR> map <leader>rt :Tags<CR>
@ -543,10 +521,6 @@ let g:ale_linters = {
\ 'sh': ['shellcheck'], \ 'sh': ['shellcheck'],
\ 'yaml': ['yamllint'], \ 'yaml': ['yamllint'],
\ 'dockerfile': ['hadolint'], \ 'dockerfile': ['hadolint'],
\ 'css': ['stylelint'],
\ 'scss': ['stylelint'],
\ 'markdown': ['markdownlint'],
\ 'sql': ['sqlfluff'],
\} \}
let g:ale_fixers = { let g:ale_fixers = {
@ -560,10 +534,7 @@ let g:ale_fixers = {
\ 'yaml': ['prettier'], \ 'yaml': ['prettier'],
\ 'html': ['prettier'], \ 'html': ['prettier'],
\ 'css': ['prettier'], \ 'css': ['prettier'],
\ 'scss': ['prettier'],
\ 'less': ['prettier'],
\ 'markdown': ['prettier'], \ 'markdown': ['prettier'],
\ 'sql': ['sqlfmt'],
\} \}
" Don't fix on save if LSP is handling formatting (avoids double-format) " Don't fix on save if LSP is handling formatting (avoids double-format)
@ -705,13 +676,6 @@ if g:use_vimlsp
let g:lsp_settings_filetype_typescript = ['typescript-language-server'] let g:lsp_settings_filetype_typescript = ['typescript-language-server']
let g:lsp_settings_filetype_javascript = ['typescript-language-server'] let g:lsp_settings_filetype_javascript = ['typescript-language-server']
let g:lsp_settings_filetype_sh = ['bash-language-server'] let g:lsp_settings_filetype_sh = ['bash-language-server']
let g:lsp_settings_filetype_html = ['vscode-html-language-server']
let g:lsp_settings_filetype_css = ['vscode-css-language-server']
let g:lsp_settings_filetype_scss = ['vscode-css-language-server']
let g:lsp_settings_filetype_json = ['vscode-json-language-server']
let g:lsp_settings_filetype_yaml = ['yaml-language-server']
let g:lsp_settings_filetype_markdown = ['marksman']
let g:lsp_settings_filetype_sql = ['sqls']
" Performance: disable virtual text diagnostics in TTY " Performance: disable virtual text diagnostics in TTY
let g:lsp_diagnostics_virtual_text_enabled = !g:is_tty let g:lsp_diagnostics_virtual_text_enabled = !g:is_tty
@ -819,8 +783,7 @@ fun! CleanExtraSpaces()
endfun endfun
if has("autocmd") if has("autocmd")
" Run for all files; ALE trim_whitespace is idempotent so no conflict autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces()
autocmd BufWritePre * call CleanExtraSpaces()
endif endif
" ============================================================================ " ============================================================================
@ -852,7 +815,7 @@ autocmd FileType html,css setlocal expandtab shiftwidth=2 tabstop=2
autocmd FileType yaml setlocal expandtab shiftwidth=2 tabstop=2 autocmd FileType yaml setlocal expandtab shiftwidth=2 tabstop=2
" Markdown specific settings " Markdown specific settings
autocmd FileType markdown setlocal wrap linebreak spell tw=0 autocmd FileType markdown setlocal wrap linebreak spell
" Shell script settings " Shell script settings
autocmd FileType sh setlocal expandtab shiftwidth=2 tabstop=2 autocmd FileType sh setlocal expandtab shiftwidth=2 tabstop=2
@ -1020,8 +983,7 @@ if has('terminal')
nnoremap <leader>th :terminal ++rows=10<CR> nnoremap <leader>th :terminal ++rows=10<CR>
" Terminal mode mappings " Terminal mode mappings
" Double-Esc to exit terminal mode (single Esc passes through to the running program) tnoremap <Esc> <C-\><C-n>
tnoremap <Esc><Esc> <C-\><C-n>
tnoremap <C-h> <C-\><C-n><C-w>h tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-j> <C-\><C-n><C-w>j tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k tnoremap <C-k> <C-\><C-n><C-w>k
@ -1062,9 +1024,6 @@ if g:is_tty
" Reduce syntax highlighting complexity in TTY (global is 200, lower here) " Reduce syntax highlighting complexity in TTY (global is 200, lower here)
set synmaxcol=120 set synmaxcol=120
" lazyredraw is safe in TTY; avoid globally as it causes CoC float flicker
set lazyredraw
endif endif
" Provide helpful message on first run in TTY " Provide helpful message on first run in TTY
@ -1106,11 +1065,10 @@ if exists('g:plugs["vim-which-key"]')
let g:which_key_map['y'] = 'clipboard-yank' let g:which_key_map['y'] = 'clipboard-yank'
let g:which_key_map['Y'] = 'clipboard-yank-line' let g:which_key_map['Y'] = 'clipboard-yank-line'
" [a]LE lint group ([e/]e navigate; <leader>aD for detail; <leader>ad for diagnostics) " [a]LE lint group ([e/]e navigate; <leader>aD for detail)
let g:which_key_map['a'] = { let g:which_key_map['a'] = {
\ 'name': '+ale-lint', \ 'name': '+ale-lint',
\ 'D': 'ale-detail', \ 'D': 'ale-detail',
\ 'd': 'diagnostics',
\ } \ }
" [c]ode / [c]opy group " [c]ode / [c]opy group
@ -1200,52 +1158,32 @@ endif
" ============================================================================ " ============================================================================
if exists('g:plugs["vim-startify"]') if exists('g:plugs["vim-startify"]')
" Dynamic header: config name, vim version, current dir, git branch, key tips " Simple ASCII header, no icons (KISS)
function! StartifyHeader() abort let g:startify_custom_header = [
let l:ver = 'Vim ' . (v:version / 100) . '.' . printf('%02d', v:version % 100) \ ' VIM - Vi IMproved',
let l:cwd = fnamemodify(getcwd(), ':t') \ ' Type :help if you are in trouble',
let l:git = ''
if executable('git')
let l:branch = system('git -C ' . shellescape(getcwd()) .
\ ' rev-parse --abbrev-ref HEAD 2>/dev/null')
if v:shell_error == 0
let l:git = ' [' . substitute(l:branch, '\n\+$', '', '') . ']'
endif
endif
return [
\ ' chopsticks | ' . l:ver . ' | ' . l:cwd . l:git,
\ ' , = leader | , + pause = key hints | Ctrl-p = files | ,rg = search',
\ '', \ '',
\ ] \ ]
endfunction
let g:startify_custom_header = 'StartifyHeader()'
" Sessions first: restores full project state; dir + recent files below " Sections shown on start screen
let g:startify_lists = [ let g:startify_lists = [
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'dir', 'header': [' Directory: ' . getcwd()] },
\ { 'type': 'files', 'header': [' Recent Files'] }, \ { 'type': 'files', 'header': [' Recent Files'] },
\ { 'type': 'dir', 'header': [' Directory: '. getcwd()] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, \ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ ] \ ]
" Quick-access bookmarks for common config files
let g:startify_bookmarks = [
\ {'v': '~/.vimrc'},
\ {'z': '~/.zshrc'},
\ {'b': '~/.bashrc'},
\ ]
" Session integration " Session integration
let g:startify_session_persistence = 1 " Auto-save session on quit let g:startify_session_persistence = 1 " Auto-save session on quit
let g:startify_session_autoload = 1 " Auto-load Session.vim if present let g:startify_session_autoload = 1 " Auto-load Session.vim if present
let g:startify_change_to_vcs_root = 1 " cd to git root on open let g:startify_change_to_vcs_root = 1 " cd to git root on open
let g:startify_fortune_use_unicode = 0 " ASCII only (KISS) let g:startify_fortune_use_unicode = 0 " No unicode in fortune (KISS)
let g:startify_enable_special = 0 " Hide <empty> / <quit> clutter let g:startify_enable_special = 0 " No <empty> / <quit> entries
" Limit recent files shown " Limit recent files shown
let g:startify_files_number = 10 let g:startify_files_number = 10
" Required for NERDTree compatibility (prevents buftype conflicts) " Don't open NERDTree when startify is active
autocmd User Startified setlocal buftype= autocmd User Startified setlocal buftype=
endif endif

View file

@ -90,22 +90,18 @@ Install language server extensions from inside Vim:
:CocInstall coc-rust-analyzer " Rust :CocInstall coc-rust-analyzer " Rust
:CocInstall coc-json coc-yaml " JSON, YAML :CocInstall coc-json coc-yaml " JSON, YAML
:CocInstall coc-html coc-css " HTML, CSS :CocInstall coc-html coc-css " HTML, CSS
:CocInstall coc-marksman " Markdown
:CocInstall coc-sql " SQL
``` ```
`install.sh` installs all of the above automatically when prompted.
### vim-lsp setup (without Node.js) ### vim-lsp setup (without Node.js)
Install language server binaries for your languages, then run: Install language server binaries for your languages, then run:
```vim ```vim
:LspInstallServer " auto-installs the right server for the current filetype :LspInstallServer " auto-installs servers for the current filetype
``` ```
Supported languages: Python, Go, Rust, TypeScript, JavaScript, Shell, Supported: `pylsp`, `gopls`, `rust-analyzer`, `typescript-language-server`,
HTML, CSS/SCSS, JSON, YAML, Markdown, SQL — via `vim-lsp-settings`. `bash-language-server`, and all others covered by `vim-lsp-settings`.
--- ---
@ -303,7 +299,7 @@ on a basic built-in terminal. In TTY mode:
## Language Support ## Language Support
| Language | Indent | Formatter | Linter | | Language | Indent | Formatter | Linter |
|----------------|--------|------------------|--------------------------| |----------------|--------|---------------|---------------------|
| Python | 4sp | black + isort | flake8, pylint | | Python | 4sp | black + isort | flake8, pylint |
| JavaScript | 2sp | prettier | eslint | | JavaScript | 2sp | prettier | eslint |
| TypeScript | 2sp | prettier | eslint, tsserver | | TypeScript | 2sp | prettier | eslint, tsserver |
@ -311,16 +307,13 @@ on a basic built-in terminal. In TTY mode:
| Rust | 4sp | rustfmt | cargo | | Rust | 4sp | rustfmt | cargo |
| Shell | 2sp | - | shellcheck | | Shell | 2sp | - | shellcheck |
| YAML | 2sp | prettier | yamllint | | YAML | 2sp | prettier | yamllint |
| HTML | 2sp | prettier | - | | HTML/CSS | 2sp | prettier | - |
| CSS / SCSS | 2sp | prettier | stylelint | | Markdown | 2sp | prettier | - |
| Less | 2sp | prettier | - |
| JSON | 2sp | prettier | - | | JSON | 2sp | prettier | - |
| Markdown | 2sp | prettier | markdownlint |
| SQL | 4sp | sqlfmt | sqlfluff |
| Dockerfile | 2sp | - | hadolint | | Dockerfile | 2sp | - | hadolint |
Install linters separately `install.sh` lists the exact commands. Install linters separately (e.g. `pip install black flake8`, `npm i -g prettier`).
ALE runs them asynchronously on save (`ale_fix_on_save = 1` when using CoC). ALE runs them asynchronously and auto-fixes on save.
--- ---

View file

@ -94,8 +94,9 @@ if [ "$HAS_NODE" -eq 1 ]; then
echo echo
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ $REPLY =~ ^[Yy]$ ]]; then
step "Installing CoC language servers" step "Installing CoC language servers"
vim +'CocInstall -sync coc-json coc-tsserver coc-pyright coc-sh coc-html coc-css coc-yaml coc-go coc-rust-analyzer coc-marksman coc-sql' +qall vim +'CocInstall -sync coc-json coc-tsserver coc-pyright coc-sh coc-html coc-css coc-yaml' +qall
ok "CoC language servers installed" ok "CoC language servers installed"
echo " Add more with :CocInstall coc-go coc-rust-analyzer etc."
fi fi
else else
echo " To enable LSP without Node.js:" echo " To enable LSP without Node.js:"
@ -125,15 +126,11 @@ echo " ctags (F8 tag browser)"
echo " Ubuntu: sudo apt install universal-ctags" echo " Ubuntu: sudo apt install universal-ctags"
echo " macOS: brew install universal-ctags" echo " macOS: brew install universal-ctags"
echo "" echo ""
echo " Language linters and formatters:" echo " Language linters:"
echo " Python: pip install black flake8 pylint isort" echo " Python: pip install black flake8 pylint isort"
echo " JS/TS: npm install -g prettier eslint typescript" echo " JS/TS: npm install -g prettier eslint typescript"
echo " Go: go install golang.org/x/tools/gopls@latest" echo " Go: go install golang.org/x/tools/gopls@latest"
echo " Shell: sudo apt install shellcheck # or: brew install shellcheck" echo " Shell: sudo apt install shellcheck"
echo " CSS/SCSS: npm install -g stylelint stylelint-config-standard"
echo " Markdown: npm install -g markdownlint-cli"
echo " SQL: pip install sqlfluff | npm install -g sqlfmt"
echo " Markdown LS: brew install marksman # or: https://github.com/artempyanykh/marksman"
echo "" echo ""
echo "Getting started:" echo "Getting started:"
echo " See QUICKSTART.md for the 5-minute guide" echo " See QUICKSTART.md for the 5-minute guide"