On Sat, Nov 21, 2009 at 01:15:30PM -0600, Mark Manning wrote:
> I was wondering if there is a list anywhere on all of the $<VARIABLES> 
> which VIM has.

":help $<Tab>" shows the following: $HOME, $VIM, $VIMRUNTIME, $MYVIMRC,
$MYGVIMRC.

> For instance, if you do a help on $VIM (i.e.: :h $VIM) 
> you get information on the $VIM variable.  But if you do the same for 
> $OS you get an error.
> 
> However, if you do
> 
>     :echo $OS

That's because there's something in your environment that set $OS.  Vim
doesn't do that.  Aside from the above mentioned $-variables, all others are
environment variables.

> PS: I know someone's going to say "Why do you need to do this?"  
> Example:  How to get the current date/time.

Use the strftime() function that Vim provides.  :help strftime()

> Mac and Linux do it one 
> way, Windows does it another.  If you want to write a function that acts 
> according to a given OS - you need to know the OS.

Use has() to check for items from feature-list.  E.g., has('win32') will
return 1 if you're using a Vim built for 32-bit versions of Windows.
has('mac') will return 1 if you're running the mac version of Vim.

See ":help has()" and ":help feature-list".

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui