add os detect function
This commit is contained in:
@@ -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/'
|
||||
|
||||
|
||||
+6
-3
@@ -312,7 +312,7 @@ endfunction
|
||||
endfunction
|
||||
call airline#parts#define_function('bufnum', 'BufferNumber')
|
||||
|
||||
let g:airline_extensions = ['bufferline', 'filetype']
|
||||
let g:airline_extensions = ['bufferline']
|
||||
let g:airline_section_x = airline#section#create(['bufnum'])
|
||||
let g:airline_section_y = ''
|
||||
let g:airline_section_z = airline#section#create(['filetype'])
|
||||
@@ -355,7 +355,11 @@ endfunction
|
||||
|
||||
" - Preview window on the right with 50% width
|
||||
" - CTRL-/ will toggle preview window.
|
||||
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
|
||||
if g:os == 'Windows'
|
||||
let g:fzf_preview_window = []
|
||||
else
|
||||
let g:fzf_preview_window = ['right:50%', 'ctrl-/']
|
||||
end
|
||||
|
||||
|
||||
" check if ripgrep is installed
|
||||
@@ -373,7 +377,6 @@ endfunction
|
||||
if HasPlug("coc.nvim") && executable('node')
|
||||
" add desired extensions to the following global variable
|
||||
" coc-clangd: c/c++, may need to install clangd seperatly
|
||||
let g:coc_global_extensions = ['coc-pyright', 'coc-rls', 'coc-clangd', 'coc-tsserver', 'coc-html', 'coc-cmake', 'coc-json', 'coc-sh', 'coc-java']
|
||||
|
||||
if filereadable(g:mydotfiles_directory . "/coc-nvim-config.vim")
|
||||
exec "source " . g:mydotfiles_directory . "/coc-nvim-config.vim"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
|
||||
" let g:coc_global_extensions = ['coc-pyright', 'coc-rls', 'coc-clangd', 'coc-tsserver', 'coc-html', 'coc-cmake', 'coc-json', 'coc-sh', 'coc-java']
|
||||
let g:coc_global_extensions = ['coc-pyright', 'coc-tsserver']
|
||||
|
||||
g:coc_data_home = g:vim_dir . '/coc'
|
||||
g:coc_config_home = g:vim_dir . '/coc'
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
if has('nvim')
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ def exist(app):
|
||||
|
||||
def program_must_exist(app):
|
||||
if not exist(app):
|
||||
fatal_error(app, "must be installed to continue")
|
||||
fatal_error("must be installed to continue")
|
||||
|
||||
def fatal_error(msg):
|
||||
print('Error:', msg)
|
||||
|
||||
Reference in New Issue
Block a user