Unable to load local root .vimrc when opening files from nested project subdirectories via 'exrc',
which limits having project specific settings.
The current exrc feature only searches for a local configuration file in the immediate current working directory (pwd). If a user opens a file nested deep inside a project's subdirectories (e.g., project/src/components/file.v), a local .vimrc located at the project root (project/.vimrc) is entirely missed.
With modern project structures, users often launch Vim or open files from subdirectories, rendering exrc ineffective without external plugins or complex autocommands.
Introduce a built-in mechanism or a new option (for example, set exrcupward or modifying exrc behavior) that allows Vim to search recursively upwards for a local configuration file until it hits the root directory or the user's home directory.
Currently, users have to write custom Vimscript in their global ~/.vimrc to mimic this behavior:
function! LoadLocalVimrc() let l:local_vimrc = findfile('.vimrc', expand('%:p:h') . ';') if !empty(l:local_vimrc) && fnamemodify(l:local_vimrc, ':p') != expand('~/.vimrc') execute 'source ' . fnameescape(l:local_vimrc) endif endfunction autocmd BufNewFile,BufRead * call LoadLocalVimrc()
Having this natively optimized in C or as a core option like set exrc=upward would immensely benefit anyone working in multi-layered language projects (like Verilog, C++, or Web development).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()