Wednesday, September 21, 2011

Re: setttings where all users home directories are set to HOME

In reply to ``RE: setttings where all users home directories are set to HOME''
sent 21 September 2011, Wednesday by Lacis, Alf

> let vimrcu = 'c:\mosaic\_vimrc_'.$USERNAME
> if filereadable(vimrcu)
> source c:\mosaic\_vimrc_$USERNAME
> endif
let s:vimrcu='c:\mosaic\_vimrc_'.$USERNAME
if filereadable(s:vimrcu)
execute 'source' fnameescape(s:vimrcu)
endif
On non-POSIX filesystems (NTFS is actually a POSIX one, but Windows rejects
some of its features) you can use
source `=s:vimrcu`
. On POSIX ones it is possible to have newline in a filename and newline here
is treated specially, so you will have to use fnameescape().

Original text:
> > Of ZyX
> > Sent: Wednesday, 21 September 2011 14:11
> > To: vim_use@googlegroups.com
> > Subject: Re: setttings where all users home directories are set to
>
> HOME
>
> > In reply to ``setttings where all users home directories are set to
>
> HOME''
>
> > sent 21 September 2011, Wednesday by Lacis, Alf
>
> > You can try to use `$USER' in this case (assuming you are on *nix):
> from
>
> > normal vimrc do
> >
> > source ~/.$USER-vimrc
> >
> > and put user-specific settings into `$HOME/.$USER-vimrc' file. You
>
> can, of
>
> > course, create an alias: `alias vim="vim -u ~/.$USER-vimrc"'.
>
> Here's what I added. It needed to be a bit smarter than just a
> 'source', because not every user will have a _vimrc_XXXX file. Also,
> what is annoying, is that the same string cannot be shared between
> 'let', 'filereadable()' and 'source' - crazy! filereadable() expects a
> variable and objects to a string, and let and source have incompatible
> formats!
>
> let vimrcu = 'c:\mosaic\_vimrc_'.$USERNAME
> if filereadable(vimrcu)
> source c:\mosaic\_vimrc_$USERNAME
> endif
>
>
>
> Think green - keep it on the screen.
>
> This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be copied,
> disclosed to, retained or used by, any other party. If you are not an
> intended recipient then please promptly delete this e-mail and any
> attachment and all copies and inform the sender. Thank you.

No comments: