On 08/04/10 09:46, ron wrote:
Hi all.
I'm trying to add a 'language' menu to my vim setup so my users can
select a UI language. The scripts work great on Linux, and I finally
managed to get them working properly (mostly) on Windows XP. However,
Windows 7 is puzzling me.
I can get the menus to appear, but the messages never appear in the
correct language. Again, this works fine for me on Linux and XP.
The relevant scripts are here: http://ronware.org/lang.zip
Is there any way vimscript can distinguish windows versions?
Any help appreciated...
In brad terms, yes; but not necessarily with the precision you want.
has('win16') is nonzero (TRUE) in w3, w3.1, w3.11, with or without w32s;
all obsolete by now
has('dos16') and has('dos32') are TRUE in versions of Vim compiled to
run with 16- or 32-bit code, respectively, on DOS systems (with DJGPP
for 32 bit); some such versions may still be running on Windows.
has('win32') is TRUE in any 32-Vim for Windows; of these, versions for
w95/w98/wME also have has('win95') TRUE. This item also applies to
32-bit Vim running on 64-bit Windows IIUC.
has('win64') is TRUE in Vim versions compiled for 64-bit Windows (such
an executable will of course not be able to run unless it has both a
64-bit processor and a 64-bit OS). This was added by patch 7.2.328 which
is relatively recent; before that, there was no way for a script to know
that you had a 64-bit version of Vim.
has('gui_win32') is TRUE in gvim for w32 (and presumably for w64) but
not in console versions. On Windows, unlike on Unix, a single executable
can be either a GUI or a console application but not both.
see
:help has()
:help feature-list
To test if you have patch 7.2.328 compiled-in (cf. :help has-patch):
if (version > 702) || (version == 702 && has('patch328'))
echo "7.2.328 or better"
if has('win64')
echo "64-bit Vim"
elseif has('win32')
echo "32-bit, NOT 64-bit Vim"
else
echo "Neither Win32 nor Win64: Cygwin? Unix? Dos?"
endif
else
echo "not yet 7.2.328"
if has('win32')
echo "Windows Vim, don't know if 64-bit"
else
echo "Neither Win32 nor Win64: Cygwin? Unix? Dos?"
endif
endif
I'm intentionally testing |version| rather than |v:version| (q.v.) so
that even very old Vim versions will still react correctly (by returning
a version value much lower than 702).
Best regards,
Tony.
--
After an instrument has been assembled, extra components will be found
on the bench.
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
To unsubscribe, reply using "remove me" as the subject.