1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 22:20:06 +08:00
SpaceVim/docs/api/system.md
2021-08-14 09:30:57 +08:00

1.2 KiB

title description
system API system API provides some basic functions and values for current os.

Available APIs >> system

Intro

The system provides basic functions for os detection.

Valuables

name values description
isWindows 0 or 1 check if the os is windows
isLinux 0 or 1 check if the os is linux
isOSX 0 or 1 check if the os is OSX

Functions

name description
fileformat() return the icon of current file format
isDarwin() return 0 or 1, check if the os is Darwin

Usage

This api can be used in both vim script and lua script.

vim script:

let s:system = SpaceVim#api#import('system')

" check the if current os is Windows.
if s:system.isWindows
    echom "OS is Windows"
endif

lua script:

local sys = require('spacevim.api').import('system')

if sys.isWindows == 1 then
    print('this is windows os!')
end