View Issue Details

IDProjectCategoryView StatusLast Update
00019571003.1(2024)/Issue8Shell and Utilitiespublic2025-12-11 16:21
ReporterLove4Boobies Assigned To 
PrioritynormalSeverityEditorialTypeEnhancement Request
Status ResolvedResolutionAccepted As Marked 
NameBogdan Barbu
Organization
User Reference
Sectionex, vi
Page NumberN/A
Line NumberN/A
Interp Status---
Final Accepted Text0001957:0007334
Summary0001957: Standardize the -u option for ex/vi
DescriptionAccording to the current standard, the ex utility (and vi, implicitly) looks for .exrc in the home directory. It would be desirable to allow for other locations in order to allow users to have different initialization files for different tasks.
Desired ActionI propose that the -u option be standardized. This already exists in implementations like Vim and Neovim and does not seem to be used for anything else in other implementations that I've checked. It should specify a file to be used instead of the default .exrc file; if multiple -u options are specified then only the last one should apply. This is consistent with the mentioned implementations and is also very useful. For example, consider a user who wishes to keep their configuration files in accordance to the XDG basedir specification, which many programs today follow. They might do the following:

alias vi='vi -u "${XDG_CONFIG_HOME:-$HOME/.config}/exrc"'

If only the last -u option is used, they have the ability to override the alias.
Tagsissue9

Activities

geoffclare

2025-12-11 16:19

manager   bugnote:0007334

On page 2838 line 94174 section ex (SYNOPSIS), change:
    
[-t tagstring] [-w size]

to:
    
[-t tagstring] [-u rcfile] [-w size]


On page 2839 line 94218 section ex (OPTIONS), after:
Suppress the use of the EXINIT environment variable and the reading of any .exrc file; see the EXTENDED DESCRIPTION section.

add a sentence:
If the -u rcfile option is also specified, the use of the specified rcfile shall not be suppressed.


After page 2839 line 94224 section ex (OPTIONS), add:
-u rcfile
Use the commands in the file specified by the pathname rcfile for initializations; suppress the use of the EXINIT environment variable and the reading of any .exrc file (see the EXTENDED DESCRIPTION section). If rcfile has the value NONE or the value NORC, no initialization commands shall be executed.

If the -u rcfile option is specified multiple times, only the last one specified shall take effect.


On page 2839 line 94242 section ex (INPUT FILES), change:
The .exrc files and source files shall be text files consisting of ex commands; see ...

to:
The .exrc files, a file specified with the -u rcfile option, and files specified with a :source command shall be text files consisting of ex commands; see ...


On page 2843 line 94409 section ex (EXTENDED DESCRIPTION), change:
If the environment variable EXINIT is set, the editor shall execute ...

to:
If the environment variable EXINIT is set and the -u rcfile option is not specified, the editor shall execute ...


On page 2843 line 94411 section ex (EXTENDED DESCRIPTION), change:
If the EXINIT variable is not set, and all of the following are true

to:
If the EXINIT variable is not set, the -u rcfile option is not specified, and all of the following are true


On page 2843 line 94419 section ex (EXTENDED DESCRIPTION), change:
If and only if all of the following are true

to:
If and only if the -u rcfile option is not specified and all of the following are true


After page 2844 line 94429 section ex (EXTENDED DESCRIPTION), add:
4.
If the -u rcfile option is specified and rcfile has neither the value NONE nor the value NORC, the editor shall attempt to execute the ex commands contained in the file specified by the pathname rcfile.


On page 2844 line 94430 section ex (EXTENDED DESCRIPTION), change:
Lines in any .exrc file that are blank lines shall be ignored.

to:
Lines in any .exrc file, or a file specified using -u rcfile, that are blank lines shall be ignored.


On page 2844 line 94432 section ex (EXTENDED DESCRIPTION), change:
After the EXINIT variable and any .exrc files are processed ...

to:
After the EXINIT variable and any .exrc files or a file specified using -u rcfile are processed ...


On page 2849 line 94684 section ex (EXTENDED DESCRIPTION), change:
Otherwise, if the ex command resulted from the processing of an EXINIT environment variable, a .exrc file, a :source command, ...

to:
Otherwise, if the ex command resulted from the processing of an EXINIT environment variable, a .exrc file, a -u rcfile option, a :source command, ...

    
On page 3526 line 120384 section vi (SYNOPSIS), change:
    
[-t tagstring] [-w size]

to:
    
[-t tagstring] [-u rcfile] [-w size]


After page 3526 line 120411 section vi (OPTIONS), add:
-u rcfile
See the ex command description of the -u option.

Issue History

Date Modified Username Field Change
2025-11-12 05:03 Love4Boobies New Issue
2025-12-11 16:19 geoffclare Note Added: 0007334
2025-12-11 16:21 geoffclare Status New => Resolved
2025-12-11 16:21 geoffclare Resolution Open => Accepted As Marked
2025-12-11 16:21 geoffclare Interp Status => ---
2025-12-11 16:21 geoffclare Final Accepted Text => 0001957:0007334
2025-12-11 16:21 geoffclare Tag Attached: issue9