I am using vim in a terminal on my mac.

I understand that the command:

echo has('mac')

should return 1 (it does on macvim), because it's running on a mac. But it returns 0. Can anyone tell me why this is, and if there's a more reliable way of detecting if vim is running on osx?

EDIT: :echo has('macunix') also returns 0

EDIT2: :echo has('osx') also returns 0

  • try has('macunix') May 27 '19 at 11:18
  • @ChristianBrabandt I meant to add that, thanks for the reminder
    – Joe
    May 27 '19 at 11:29
  • echo has('osx') ? May 27 '19 at 12:08
  • 2
    See the second answer, by romainl, here: Detect OS in Vimscript. You need to use uname.
    – Rich
    May 27 '19 at 18:53

Browse other questions tagged or ask your own question.