Back to Spacevim

system API

docs/api/system.md

2.4.01.1 KB
Original Source

Available APIs >> system

<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc -->

Intro

The system provides basic functions for os detection.

Valuables

namevaluesdescription
isWindows0 or 1check if the os is windows
isLinux0 or 1check if the os is linux
isOSX0 or 1check if the os is OSX

Functions

namedescription
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:

vim
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:

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

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