add os detect function

This commit is contained in:
Nachuan Tang
2023-02-15 23:59:16 -05:00
parent a9efbe46f6
commit dd7c1d8903
4 changed files with 23 additions and 4 deletions
+10
View File
@@ -6,6 +6,8 @@
" dotfile location
let g:mydotfiles_directory = expand('~/.dotfiles/')
let after_directory = g:mydotfiles_directory . 'config/vi-plugs/coc-theme/after/'
" detect vim type(vim or nvim)
if has('nvim')
let g:vim_type = 'nvim'
let g:vim_version = matchstr(execute('version'), 'NVIM v\zs[^\n]*')
@@ -13,6 +15,14 @@
let g:vim_type = 'vim'
let g:vim_version = matchstr(execute('version'), 'Vi IMproved \zs[^\n]*')
endif
" detect operating system (Windows/Linux/Darwin)
if has("win64") || has("win32") || has("win16")
let g:os = "Windows"
else
let g:os = substitute(system('uname'), '\n', '', '')
endif
let g:vim_version = str2float(g:vim_version)
let g:dotfile_path = '~/.dotfiles/'