1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Update system check method

This commit is contained in:
jdhao 2019-12-09 23:21:28 +08:00
parent 0e89d956fd
commit 62d8266f07
3 changed files with 22 additions and 18 deletions

View File

@ -50,6 +50,10 @@
"}
"{ Main configurations
let g:is_win = has('win32') || has('win64')
let g:is_linux = has('unix') && !has('macunix')
let g:is_mac = has('macunix')
" If you are using Neovim on Linux system and want to set it up system wide
" for users, set g:nvim_system_wide to 1. If you only want to use it for
" personal need, set this variable to 0.
@ -57,7 +61,7 @@ let g:nvim_system_wide=0
" Do not set this varialbe if the system is not *nix
if g:nvim_system_wide
if !has('unix')
if !g:is_linux
let g:nvim_system_wide = 0
endif
endif

View File

@ -76,7 +76,7 @@ Plug 'osyo-manga/vim-anzu'
Plug 'haya14busa/vim-asterisk'
" File search, tag search and more
if has('win32')
if g:is_win
Plug 'Yggdroot/LeaderF'
else
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
@ -117,7 +117,7 @@ Plug 'itchyny/vim-highlighturl'
" For Windows and Mac, we can open an URL in the browser. For Linux, it may
" not be possible since we maybe in a server which disables GUI.
if has('win32') || has('macunix')
if g:is_win || g:is_mac
" open URL in browser
Plug 'tyru/open-browser.vim'
endif
@ -163,7 +163,7 @@ Plug 'mbbill/undotree'
" Plug 'simnalamburt/vim-mundo'
" Manage your yank history
if has('win32') || has('macunix')
if g:is_win || g:is_mac
Plug 'svermeulen/vim-yoink'
endif
@ -183,7 +183,7 @@ Plug 'tpope/vim-repeat'
" Plug 'junegunn/vim-peekaboo'
" IME toggle for Mac
if has('macunix')
if g:is_mac
Plug 'rlue/vim-barbaric'
endif
"}}
@ -236,7 +236,7 @@ Plug 'godlygeek/tabular', {'on': 'Tabularize'}
Plug 'elzr/vim-json', { 'for': ['json', 'markdown'] }
" Markdown previewing (only for Mac and Windows)
if has('win32') || has('macunix')
if g:is_win || g:is_mac
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug'] }
endif
"}}
@ -255,7 +255,7 @@ Plug 'michaeljsmith/vim-indent-object'
"{{ LaTeX editting and previewing plugin
" Only use these plugin on Windows and Mac and when LaTeX is installed
if ( has('macunix') || has('win32') ) && executable('latex')
if ( g:is_win || g:is_mac ) && executable('latex')
" vimtex use autoload feature of Vim, so it is not necessary to use `for`
" keyword of vim-plug to try to lazy-load it,
" see http://tinyurl.com/y3ymc4qd
@ -269,7 +269,7 @@ endif
"{{ Tmux related plugins
" Since tmux is only available on Linux and Mac, we only enable these plugins
" for Linux and Mac
if has('unix') && executable('tmux')
if (g:is_linux || g:is_mac) && executable('tmux')
" Let vim detect tmux focus event correctly, see
" http://tinyurl.com/y4xd2w3r and http://tinyurl.com/y4878wwm
Plug 'tmux-plugins/vim-tmux-focus-events'
@ -461,7 +461,7 @@ nnoremap <silent> <leader>f :Leaderf file --popup<CR>
"{{ URL related
""""""""""""""""""""""""""""open-browser.vim settings"""""""""""""""""""
if has('win32') || has('macunix')
if g:is_win || g:is_mac
" Disable netrw's gx mapping.
let g:netrw_nogx = 1
@ -505,7 +505,7 @@ let NERDTreeMinimalUI=0
nnoremap <silent> <Space>t :TagbarToggle<CR>
" Add support for markdown files in tagbar.
if has('win32')
if g:is_win
let g:md_ctags_bin=fnamemodify(g:nvim_config_root."\\tools\\markdown2ctags.exe", ":p")
else
let g:md_ctags_bin=fnamemodify(g:nvim_config_root."/tools/markdown2ctags.py", ":p")
@ -548,7 +548,7 @@ let g:auto_save_events = ['InsertLeave', 'TextChanged']
let g:auto_save_silent = 0
""""""""""""""""""""""""""""vim-yoink settings"""""""""""""""""""""""""
if has('win32') || has('macunix')
if g:is_win || g:is_mac
" ctrl-n and ctrl-p will not work if you add the TextChanged event to
" vim-auto-save events
" nmap <c-n> <plug>(YoinkPostPasteSwapBack)
@ -649,7 +649,7 @@ let g:vim_markdown_toc_autofit = 1
"""""""""""""""""""""""""markdown-preview settings"""""""""""""""""""
" Only setting this for suitable platforms
if has('win32') || has('macunix')
if g:is_win || g:is_mac
" Do not close the preview tab when switching to other buffers
let g:mkdp_auto_close = 0
@ -668,7 +668,7 @@ nmap @@ <Plug>ReturnFromFootnote
"{{ LaTeX editting
""""""""""""""""""""""""""""vimtex settings"""""""""""""""""""""""""""""
if ( has('macunix') || has('win32')) && executable('latex')
if ( g:is_win || g:is_mac ) && executable('latex')
" Set up LaTeX flavor
let g:tex_flavor = 'latex'
@ -694,14 +694,14 @@ if ( has('macunix') || has('win32')) && executable('latex')
\}
" Viewer settings for different platforms
if has('win32')
if g:is_win
let g:vimtex_view_general_viewer = 'SumatraPDF'
let g:vimtex_view_general_options_latexmk = '-reuse-instance'
let g:vimtex_view_general_options
\ = '-reuse-instance -forward-search @tex @line @pdf'
endif
if has('macunix')
if g:is_mac
" let g:vimtex_view_method = "skim"
let g:vimtex_view_general_viewer
\ = '/Applications/Skim.app/Contents/SharedSupport/displayline'

View File

@ -6,9 +6,9 @@ let g:loaded_python_provider=0
" Path to Python 3 interpreter (must be an absolute path), make startup
" faster. See https://neovim.io/doc/user/provider.html.
if executable('python')
if has('win32')
if g:is_win
let g:python3_host_prog=substitute(exepath('python'), '.exe$', '', 'g')
elseif has('unix')
elseif g:is_linux || g:is_mac
let g:python3_host_prog=exepath('python')
endif
else
@ -39,4 +39,4 @@ let g:loaded_tarPlugin = 1
let g:loaded_matchit = 1
let g:loaded_matchparen = 1
"}}
"}}
"}