I use my .vimrc file on my laptop (OS X) and several servers (Solaris and Linux), and could hypothetically someday use it in a Windows window. I know how to detect unix in general and windows, but how to detect OS X? (And in this regard, is there a way to distinguish between Linux and Solaris, etc. And is there a list of all the lines that may matter? My Google-fu didnโt display anything.)
For example, I would use something like this:
if has("mac") " open a file in TextMate from vi: " nmap mate :w<CR>:!mate %<CR> elseif has("unix") " do stuff under linux and " elseif has("win32") " do stuff under windows " endif
But it is clear that "mac" is not the correct line, and none of the others that I have tried.
UPDATE: The answer below ("macunix") looks pretty clear, as if it should work, but for some reason it is not. (Perhaps Apple did not compile vim correctly to answer this? It seems unlikely.)
In any case, I think I need to focus on the question: does anyone have a solution that will achieve the same goals? (That is, it successfully detects that the .vimrc file is used in Mac OS X.)
vim macos
iconoclast May 15 '10 at 11:24 a.m. 2010-05-15 23:24
source share