How to reference/source a custom .vimrc file

后端 未结 9 1267
生来不讨喜
生来不讨喜 2020-12-08 04:24

Is there a way to reference (or \"source\") another user\'s .vimrc file?

When I kuu (a variant of su that uses kerberos security tokens) to

9条回答
  •  醉梦人生
    2020-12-08 05:03

    I've only ever attempted this a few times and this seems to work fine for me. Define an alias for vim that is something like the following:

    alias vim="HOME=~yournormaluser vim -c 'let \$HOME = \"$HOME\"'"
    

    What this does is trick vim into using your $HOME/.vim/ environment, yet resets $HOME from within vim so doing things like :e ~/something.txt will still use the admin user's $HOME.

    This has the added advantage that you don't have to change the admin's ~/.vimrc at all.

提交回复
热议问题