Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4ccfb12
vim(refactor[keymappings]): Fix <Leader>p conflict and deduplicate ma…
tony Mar 14, 2026
d0cfb4f
vim(refactor[config]): Remove dead code and orphaned configuration
tony Mar 14, 2026
ec78fa8
vim(fix[vimrc]): Remove autochdir to avoid conflict with vim-rooter
tony Mar 14, 2026
ce8db7d
vim(fix[lib]): Check colorscheme existence without applying it
tony Mar 14, 2026
d4d5054
vim(refactor[plugins]): Remove unused plugins sonokai, ag.vim, nvim-yarp
tony Mar 14, 2026
e639978
vim(refactor[plugins]): Drop typescript-vim in favor of yats.vim
tony Mar 14, 2026
2c0fefc
vim(refactor[formatting]): Consolidate formatting to ALE + CoC
tony Mar 14, 2026
7dcd986
vim(feat[statusline]): Add lightline.vim with git and diagnostics
tony Mar 14, 2026
aa0f9cd
vim(refactor[sensible]): Remove obsolete version guards for Vim 9.1+
tony Mar 14, 2026
071fbc7
vim(feat[plugins]): Lazy-load NERDTree on first command invocation
tony Mar 14, 2026
c68cb26
vim(feat[plugins]): Defer copilot.vim loading to first BufReadPost
tony Mar 14, 2026
30a2cd3
vim(feat[plugins]): Add filetype-based lazy loading for language plugins
tony Mar 14, 2026
2ae012f
tests(feat[rooter]): Add parametrized rooter/autochdir edge case tests
tony Mar 14, 2026
e220edf
vim(feat[rooter]): Enable automatic project root detection
tony Mar 14, 2026
1050f11
tests(refactor[rooter]): Update integration test for auto-rooter
tony Mar 14, 2026
eacc89a
docs(feat[config]): Add format-on-save reference to README
tony Apr 4, 2026
89db890
docs(refactor[agents]): Cross-reference format-on-save from AGENTS.md
tony Apr 4, 2026
7f4bb6a
coc-settings.json: Remove formatOnSave from json and toml
tony Apr 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ When `g:vim_test_mode` is set (by the test harness wrapper), the configuration u
This allows tests to run in a clean temporary `$HOME` without affecting the user's real configuration.

### LSP Configuration
Language servers are configured in `coc-settings.json` with format-on-save enabled for multiple languages. The configuration includes extensive setups for Python, TypeScript, Rust, and other languages.
Language servers are configured in `coc-settings.json` with extensive setups for Python, TypeScript, Rust, and other languages. Format-on-save behavior is documented in [`README.md`](README.md#format-on-save).

### FZF Integration
Custom FZF commands are defined in `autoload/settings.vim` with AG (silver searcher) integration for fast project-wide searching.
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ Please check out:
- <https://www.reddit.com/r/vim/wiki/norc>
- <https://www.vi-improved.org/recommendations/>

## Config

### Format on save

Two systems handle format-on-save, scoped by filetype:

| System | Filetypes | Config file |
|--------|-----------|-------------|
| [CoC](https://github.com/neoclide/coc.nvim) `formatOnSave` | typescript, typescriptreact, javascript, markdown, python, json, toml | [`coc-settings.json`](coc-settings.json) (line 2-4) |
| [ALE](https://github.com/dense-analysis/ale) `fix_on_save` | Buffers with configured fixers (e.g. biome for ts/tsx) | [`plugins.vim`](plugins.vim) (`g:ale_fix_on_save`) |

- CoC delegates to the language server or formatter extension registered for the filetype
- ALE runs `b:ale_fixers` / `g:ale_fixers` — currently empty for js/ts globally, but [`settings/autocmd.vim`](settings/autocmd.vim) dynamically enables biome when `biome.json` is found in the project
- When biome is active, CoC formatOnSave is disabled for that buffer to avoid double-formatting (see `s:MaybeEnableBiome()` in `settings/autocmd.vim`)
- To disable for a single buffer: `:let b:coc_disable_autoformat = 1`

## License

MIT
Expand Down
9 changes: 2 additions & 7 deletions autoload/lib.vim
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ endfunction
" }


function! lib#ColorSchemeExists(colorscheme)
try
exe 'colorscheme' a:colorscheme
return 1
catch /^Vim\%((\a\+)\)\=:E185/
return 0
endtry
function! lib#ColorSchemeExists(colorscheme) abort
return !empty(globpath(&rtp, 'colors/' . a:colorscheme . '.vim'))
endfunction
3 changes: 2 additions & 1 deletion autoload/settings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ function! settings#LoadSettings() abort

" This is checked for before initialization.
" https://github.com/airblade/vim-rooter/blob/3509dfb/plugin/rooter.vim#L173
let g:rooter_manual_only = 1
let g:rooter_manual_only = 0
let g:rooter_change_directory_for_non_project_files = 'current'

" vim-rooter patterns
let g:rooter_patterns = [
Expand Down
88 changes: 63 additions & 25 deletions plugins.vim
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,49 @@ Plug 'chaoren/vim-wordmotion'
" Colorschemes
Plug 'rainux/vim-desert-warm-256'
Plug 'morhetz/gruvbox'
" Plug 'gruvbox-material/vim', {'as': 'gruvbox-material'}
Plug 'sainnhe/sonokai'
Plug 'sainnhe/everforest'
Plug 'catppuccin/vim', { 'as': 'catppuccin' }

" NERDTree
Plug 'preservim/nerdtree'
Plug 'preservim/nerdtree', { 'on': ['NERDTreeFocus', 'NERDTreeToggle', 'NERDTree'] }
let NERDTreeShowHidden=1

" Statusline
Plug 'itchyny/lightline.vim'

function! LightlineGitStatus() abort
return get(g:, 'coc_git_status', '') . get(b:, 'coc_git_status', '')
endfunction

function! LightlineALE() abort
if !exists('*ale#statusline#Count')
return ''
endif
let l:counts = ale#statusline#Count(bufnr(''))
let l:errors = l:counts.error + l:counts.style_error
let l:warnings = l:counts.warning + l:counts.style_warning
if l:errors == 0 && l:warnings == 0
return ''
endif
return printf('E:%d W:%d', l:errors, l:warnings)
endfunction

let g:lightline = {
\ 'active': {
\ 'left': [['mode', 'paste'],
\ ['gitstatus', 'readonly', 'filename', 'modified']],
\ 'right': [['lineinfo'], ['percent'],
\ ['ale', 'filetype']],
\ },
\ 'component_function': {
\ 'gitstatus': 'LightlineGitStatus',
\ 'ale': 'LightlineALE',
\ },
\ }

autocmd User CocGitStatusChange call lightline#update()
autocmd User ALELintPost,ALEFixPost call lightline#update()

" GraphQL
Plug 'jparise/vim-graphql'

Expand All @@ -106,14 +140,8 @@ Plug 'cakebaker/scss-syntax.vim'
" JSON for GitHub Actions
Plug 'yasuhiroki/github-actions-yaml.vim'

" Autoformat
Plug 'vim-autoformat/vim-autoformat'
let g:formatdef_dprint = '"dprint stdin-fmt --file-name ".@%'
let g:formatters_json = ['dprint']
let g:formatters_toml = ['dprint']

" Copilot
Plug 'github/copilot.vim'
" Copilot (deferred to first file open)
Plug 'github/copilot.vim', { 'on': [] }
let g:copilot_filetypes = {
\ 'markdown': v:false,
\ 'rst': v:false,
Expand All @@ -123,6 +151,11 @@ let g:copilot_filetypes = {
\ 'json': v:false,
\ }

augroup CopilotDeferredLoad
autocmd!
autocmd BufReadPost * ++once call plug#load('copilot.vim')
augroup END

" Python syntax improvements
Plug 'vim-python/python-syntax'

Expand Down Expand Up @@ -151,32 +184,37 @@ if has('nvim')
endfunction
else
Plug 'gelguy/wilder.nvim'
" For Python remote features in Vim 8:
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif

" Conditional Plugins Based on Executables
" Format: 'command': ['plugin1', 'plugin2', ...]
" Each entry is either a string (load immediately) or a list
" [spec, {plug-options}] (with vim-plug lazy-load options)
let s:conditional_plugins = {
\ 'ag': ['rking/ag.vim'],
\ 'pipenv': ['cespare/vim-toml'],
\ 'docker': ['ekalinin/Dockerfile.vim'],
\ 'docker': [['ekalinin/Dockerfile.vim', {'for': ['dockerfile']}]],
\ 'git': ['tpope/vim-fugitive', 'iberianpig/tig-explorer.vim'],
\ 'psql': ['lifepillar/pgsql.vim'],
\ 'node': ['leafgarland/typescript-vim', 'HerringtonDarkholme/yats.vim',
\ 'posva/vim-vue', 'jxnblk/vim-mdx-js',
\ 'neoclide/vim-jsx-improve', 'jonsmithers/vim-html-template-literals'],
\ 'node': [
\ ['HerringtonDarkholme/yats.vim', {'for': ['typescript', 'typescriptreact']}],
\ ['posva/vim-vue', {'for': ['vue']}],
\ ['jxnblk/vim-mdx-js', {'for': ['mdx']}],
\ ['neoclide/vim-jsx-improve', {'for': ['javascript', 'javascriptreact']}],
\ ['jonsmithers/vim-html-template-literals', {'for': ['html', 'javascript', 'typescript']}],
\ ],
\ 'tmux': ['wellle/tmux-complete.vim'],
\ 'cargo': ['rust-lang/rust.vim'],
\ 'terraform': ['hashivim/vim-terraform'],
\ 'mix': ['elixir-editors/vim-elixir'],
\ 'cargo': [['rust-lang/rust.vim', {'for': ['rust']}]],
\ 'terraform': [['hashivim/vim-terraform', {'for': ['terraform']}]],
\ 'mix': [['elixir-editors/vim-elixir', {'for': ['elixir', 'eelixir']}]],
\ }

" Load conditional plugins
for [cmd, plugins] in items(s:conditional_plugins)
for plugin in plugins
call PlugIfCommand(cmd, plugin)
for entry in plugins
if type(entry) == v:t_list
call PlugIfCommand(cmd, entry[0], entry[1])
else
call PlugIfCommand(cmd, entry)
endif
endfor
endfor

Expand Down
16 changes: 9 additions & 7 deletions settings/autocmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ au FocusGained * redraw! " redraw screen on focus
" Automatically open quickfix window after grep
autocmd QuickFixCmdPost *grep* cwindow

" Format entire file with <leader>f (preserves cursor position)
autocmd FileType * noremap <silent><leader>f mzgg=G`z
" Format entire file via LSP (falls back to Vim indent for non-LSP)
autocmd FileType * nnoremap <silent><buffer> <leader>f :call CocActionAsync('format')<CR>

" Toggle Biome per buffer based on project config
function! s:MaybeEnableBiome() abort
if get(b:, 'biome_checked', 0)
return
endif
let b:biome_checked = 1

if !exists('*ale#path#FindNearestFile')
return
endif
Expand All @@ -32,6 +37,8 @@ function! s:MaybeEnableBiome() abort
if !empty(l:config)
let b:ale_linters = ['biome']
let b:ale_fixers = ['biome']
" Disable CoC formatOnSave to prevent double-formatting
let b:coc_preferences_formatOnSave = v:false
else
if exists('b:ale_linters')
unlet b:ale_linters
Expand Down Expand Up @@ -103,8 +110,3 @@ if !lib#IsTestMode() && executable('xrdb')
autocmd BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1
endif

" map :BufClose to :bq and configure it to open a file browser on close
let g:BufClose_AltBuffer = '.'
cnoreabbr <expr> bq 'BufClose'

let javascript_enable_domhtmlcss=1
25 changes: 5 additions & 20 deletions settings/keymappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
let mapleader = ","
let maplocalleader = ","

" Format / indentation - use marks to preserve position
nnoremap <silent><leader>3 mzgg=G`z
" Format / indentation moved to <leader>f in autocmd.vim

" <Leader>4: Toggle between paste mode
nnoremap <silent> <leader>4 :set paste!<cr>
Expand Down Expand Up @@ -34,11 +33,6 @@ nnoremap Q :q<cr>
" Clear search highlight and close CoC popup if visible
nnoremap <silent> <c-c> :nohlsearch<CR>:silent! call coc#pum#visible() ? coc#pum#_close() : ""<CR>

" Up Down Left Right resize splits
" nnoremap <up> <c-w>+
" nnoremap <down> <c-w>-
" nnoremap <left> <c-w><
" nnoremap <right> <c-w>>

"===============================================================================
" Visual Mode Ctrl Key Mappings
Expand Down Expand Up @@ -72,10 +66,7 @@ xnoremap p "_dP
" use 'x' instead
xnoremap d "_d

" \: Toggle comment
" nerdcommenter:
" xmap \ <Leader>c<space>
" tcomment:
" \: Toggle comment (tcomment)
xmap \ gc<space>

" Enter: Highlight visual selections
Expand Down Expand Up @@ -105,13 +96,7 @@ noremap <leader>x :Ex<CR>
" Buffer Traversal {{{
nnoremap <silent> <Leader>d :BD<cr>

" Buffer navigation - Leader p/n for previous/next
nnoremap <silent> <Leader>p :bprevious<CR>
nnoremap <silent> <Leader>n :bnext<CR>

nnoremap <silent> <Leader>c :BB<CR>
nnoremap <silent> <Leader><BS> :BB<CR>
nnoremap <silent> <Leader><Del> :BB<CR>

" Traversal
nnoremap <C-h> <C-w>h
Expand All @@ -132,9 +117,9 @@ endfunction

nnoremap <C-=> <C-w>=

" Buffer navigation - using Leader key for consistency
map <Leader>] :bnext<CR>
map <Leader>[ :bprev<CR>
" Buffer navigation
nnoremap <silent> <Leader>] :bnext<CR>
nnoremap <silent> <Leader>[ :bprevious<CR>

nnoremap <leader>e :NERDTreeFocus<CR>

Expand Down
14 changes: 3 additions & 11 deletions settings/sensible.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ else
let g:loaded_sensible = 'yes'
endif

if has('autocmd')
filetype plugin indent on
endif
if has('syntax') && !exists('g:syntax_on')
filetype plugin indent on
if !exists('g:syntax_on')
syntax enable
endif

Expand Down Expand Up @@ -55,18 +53,12 @@ if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif

if v:version > 703 || v:version == 703 && has("patch541")
set formatoptions+=j " Delete comment character when joining commented lines
endif
set formatoptions+=j " Delete comment character when joining commented lines

if has('path_extra')
setglobal tags-=./tags tags-=./tags; tags^=./tags;
endif

if &shell =~# 'fish$' && (v:version < 704 || v:version == 704 && !has('patch276'))
set shell=/bin/bash
endif

set autoread

if &history < 1000
Expand Down
4 changes: 0 additions & 4 deletions settings/settings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ set ignorecase " Case insensitive search
set smartcase " Case sensitive when uc present

if has('cmdline_info')
" ruler is set in sensible.vim
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%) " A ruler on steroids
set showcmd " Show partial commands in status line and
" Selected characters/lines in visual mode
endif

" Statusline configuration removed - use default or plugin statuslines

" noswapfile is already set in vimrc
" vim-rooter handles directory changes, so we don't need autocmd BufEnter

Expand Down
Loading
Loading