forked from wsdjeg/SpaceVim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem.lua
More file actions
94 lines (83 loc) · 1.74 KB
/
system.lua
File metadata and controls
94 lines (83 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
local has = nil
local fn = nil
local vim_options = nil
if vim.o ~= nil then
vim_options = vim.o
else
vim_options = require('spacevim').vim_options
end
if vim.api == nil then
has = require('spacevim').has
else
if vim.fn ~= nil then
has = vim.fn.has
else
has = require('spacevim').has
end
end
if vim.fn == nil then
fn = require('spacevim').fn
else
fn = vim.fn
end
local M = {}
if has('win16') ==1 or has('win32') == 1 or has('win64') == 1 then
M.isWindows = 1
else
M.isWindows = 0
end
if has('unix') == 1 and has('macunix') == 0 and has('win32unix') == 0 then
M.isLinux = 1
else
M.isLinux = 0
end
M.isOSX = has('macunix')
function M.name()
if M.isLinux == 1 then
return 'linux'
elseif M.isWindows == 1 then
if has('win32unix') == 1 then
return 'cygwin'
else
return 'windows'
end
else
return 'mac'
end
end
local is_darwin = nil
function M.isDarwin()
if is_darwin ~= nil then
return is_darwin
end
if has('macunix') == 1 then
is_darwin = 1
return is_darwin
end
if has('unix') ~= 1 then
is_darwin = 0
return is_darwin
end
if fn.system('uname -s') == "Darwin\n" then
is_darwin = 1
else
is_darwin = 0
end
return is_darwin
end
function M.fileformat()
local fileformat = ''
if vim_options.fileformat == 'dos' then
fileformat = ''
elseif vim_options.fileformat == 'unix' then
if M.isDarwin() == 1 then
fileformat = ''
else
fileformat = ''
end
elseif vim_options.fileformat == 'mac' then
fileformat = ''
end
return fileformat
end
return M