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
Method 2 - as an addition to .vimrc
tried different things
tty does not work, and system("who am i") neither (they come up empty when used from within vim-function), so this way is much longer. Any shortcuts are welcome
"Local .vimrc for the user
" 1. get the user, which used su
" 2. we can load his .vimrc.
" from $HOME (from where we have sudo'ed in)
let b:term = substitute( system ("ps T | grep ' ps T$' | sed -e 's/^ *//' | cut -d ' ' -f 2 "), "\n", "", "" )
let b:user = substitute( system ("who | grep ".b:term." | cut -d ' ' -f 1 "), "\n", "", "" )
let b:file = $HOME."/.vimrc.".b:user
if filereadable(b:file)
execute 'source '.b:file
endif