Prepend Homebrew prefixes to $PATH in vimrc for Finder/Dock launches#207
Draft
ikuwow wants to merge 1 commit into
Draft
Prepend Homebrew prefixes to $PATH in vimrc for Finder/Dock launches#207ikuwow wants to merge 1 commit into
ikuwow wants to merge 1 commit into
Conversation
When Neovide.app (or any vim launched from Finder/Dock on macOS) starts,
the login shell init files are not sourced and $PATH stays at the bare
/usr/bin:/bin:/usr/sbin:/sbin. brew and the rest of the brew-installed
toolchain are then invisible, executable("brew") returns 0, and the
existing warning fires every launch.
Prepends the well-known brew prefixes (/opt/homebrew/bin for Apple
Silicon, /usr/local/bin for Intel) when present and not already on
$PATH, guarded to macOS only.
Closes #73.
Co-authored-by: Claude Opus 4.6 <[email protected]>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #73.
Why
Neovide launched from Finder/Dock starts via
/usr/bin/login -fpqwhich does not source the login shell init files, so$PATHstays at the bare/usr/bin:/bin:/usr/sbin:/sbin. The vimrc's existingexecutable('brew')check then fails and emits a warning every launch, plus every brew-installed tool referenced later in the rc is silently unavailable.The issue's own suggestion ("vimrcの冒頭でPATHを補完する対策") is the simplest fix and keeps the workaround on the dotfiles side rather than depending on a future upstream Neovide change (neovide/neovide#3243). The existing
config.tomlneovim-binabsolute path fix (#72) is preserved — this PR fixes the PATH inside the running vim.What
Adds a short macOS-only block right after
set nocompatiblethat prepends/opt/homebrew/bin(Apple Silicon) and/usr/local/bin(Intel) to$PATHwhen present and not already on it. Idempotent (the$PATH !~# '\V' . s:brew_pathguard avoids double-prepending when the login shell already set it up).Notes
executable('brew')/g:python3_host_prog/g:copilot_node_commandlogic sees the populated PATH.has('mac') || has('macunix')— Linux launches do not hit this code path.Verification
env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin vim -u xdg-config/vim/vimrc -es '+redir>...' '+echo $PATH' '+qall'prints/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin. Both brew prefixes are prepended, original PATH preserved on the right.:echo $PATHand confirm/opt/homebrew/binis present. (GUI launch only available on the desktop session, deferred.):!brew --prefixreturns/opt/homebrewinstead of "command not found" inside Neovide.$PATHalready contains/opt/homebrew/bin(terminal-launched vim), the!~#guard skips the prepend; confirmed by code reading (the loop only modifies$PATHinside theif isdirectory(...) && $PATH !~# '\V' . s:brew_pathbranch).