Gentoo packages can build different optional features depending on the active USE flags, so the wrong scope can either leave a needed feature out or force unrelated packages to rebuild. A package-specific entry keeps the change tied to one package before Portage calculates the merge plan.
Portage combines USE values from several layers. The current shell environment has the highest precedence, package-specific entries under /etc/portage/package.use override system defaults, /etc/portage/make.conf supplies user-wide defaults, and the selected profile supplies the baseline flags.
Use /etc/portage/package.use when one package needs a feature such as ruby support in app-editors/vim. Use /etc/portage/make.conf only when the same flag should become a default for many packages, and preview the merge plan before rebuilding because a changed flag can add dependencies or require package rebuilds.
Related: How to edit Gentoo make.conf
Related: How to install a package on Gentoo with emerge
Related: How to update a Gentoo world set
$ emerge --pretend --verbose app-editors/vim [ebuild R ] app-editors/vim-9.1.1652-r2 USE="acl cscope gpm -ruby terminal vim-pager -perl" ##### snipped #####
The USE list shows enabled flags without a prefix and disabled flags with a leading -. Check the exact flags shown on your system before adding them to /etc/portage/package.use.
$ sudo install -d /etc/portage/package.use
$ sudoedit /etc/portage/package.use/vim
The filename is for organization. Portage reads the entries inside /etc/portage/package.use and does not require the file to match the package name.
app-editors/vim ruby
Prefix a flag with - to disable it for that package, such as app-editors/vim -ruby. Use one package atom per line with space-delimited flags.
$ cat /etc/portage/package.use/vim app-editors/vim ruby
$ emerge --pretend --verbose app-editors/vim [ebuild R ] app-editors/vim-9.1.1652-r2 USE="acl cscope gpm ruby terminal vim-pager -perl" ##### snipped #####
If emerge proposes unrelated changes, review the selected flag and dependencies before accepting the rebuild.
$ sudo emerge --ask --changed-use --oneshot app-editors/vim
–changed-use includes installed packages whose USE flags changed. –oneshot avoids adding a package to the world set when the rebuild is only needed to apply the flag change.
$ cat /var/db/pkg/app-editors/vim-*/USE acl cscope gpm ruby terminal vim-pager
The /var/db/pkg record reflects the USE state saved when the package was merged. Re-run the emerge –pretend –verbose check if you also need to confirm that a disabled flag still appears with a leading - in the current build plan.