Hello Nam,

On Sun 13/08/2017 18:09, Nam Nguyen wrote:
If you are trying to avoid that message:
/home/just22/.exrc: not sourced: not owned by you

It could be that you are in that in your home directory and vi is trying
to read the local .exrc script on startup.

In vi(1):
exrc, ex [off]
Read the startup files in the local directory.

To turn off this feature, put "set noexrc" into your ~/.exrc


I was discussing this point privately with Martijn (in CC) and I ended up with exactly this conclusion.

I'm trying to sort out a bit the things and summarize what happens, in the hope one of the developers has the chance to have a look:

- enable the exrc option ("set exrc") in ${HOME}/.exrc
- from $HOME run: "doas vi <someFiles>"
- the message "/home/just22/.exrc: not sourced: not owned by you" appears; - despite the error message, the setting in $HOME/.exrc are present in the vi's window, so it seems that it is sourced two times: in one case all goes well, in the other there is a permission problem.

Something weird is happening, but I really don't know where...

The key is to understand what configuration files vi looks for when
starting up. This is mentioned toward the bottom of vi(1). It seems like
the precedence goes (from least to most): /etc/vi.exrc, ~/.exrc,
./.exrc.

(For clarity, I am not including ~/.nexrc and ./.nexrc.)

I used to have "set exrc" and would get the behavior you are describing,
specifically while in my home directory. Disabling that feature with
"set noexrc" removes ./.exrc from what vi scans for at startup.

This is the setup I currently have. I have /etc/vi.exrc as a system-wide
default vi configuration.

In $HOME/.exrc I have general vi macros, and in $HOME/.nexrc I have
programming language specific macros.

Normally, what I will do is update ~/.exrc if I want to add some new
features, and copy that to /etc/vi.exrc to have it available
system-wide.

Another observation I made was that because doas' default behavior is to
reset the environment except for HOME, among others, executing `doas vi`
gives me access to macros defined in both ~/.exrc ~/.nexrc even though I
am root. If I change to root with `su` and then open `vi`, I only get
access to /etc/vi.exrc and lose access to macros defined in ~/.nexrc.

I have been annoyed by this problem, too, because I had to keep pressing
enter to clear that error message, instead of the file instantaneously
opening. I could not be bothered to investigate further until you had
mentioned it.


--
Alessandro DE LAURENZIS
[mailto:[email protected]]
LinkedIn: http://it.linkedin.com/in/delaurenzis

Reply via email to