Update init to be more useful

Add more comments to better understand what's going on as well as
add some more variables to better determine which plugins to enable
This commit is contained in:
ViViDboarder 2019-10-21 16:26:35 -07:00
parent e08135fe1f
commit 57e5f83dc8
2 changed files with 16 additions and 0 deletions

View File

@ -3,6 +3,7 @@
" Note: Skip initialization for vim-tiny or vim-small. " Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif if !1 | finish | endif
" Don't use fish as the default shell. This makes things weird
if &shell =~# 'fish$' if &shell =~# 'fish$'
set shell=bash set shell=bash
endif endif
@ -29,10 +30,13 @@ let s:is_sudo = $SUDO_USER !=# '' && $USER !=# $SUDO_USER
\ && $HOME !=# expand('~'.$USER) \ && $HOME !=# expand('~'.$USER)
\ && $HOME ==# expand('~'.$SUDO_USER) \ && $HOME ==# expand('~'.$SUDO_USER)
" IsWindows determines if this instances is running on Windows
function! IsWindows() function! IsWindows()
return s:is_windows return s:is_windows
endfunction endfunction
" IsMac determines if this instance is running on macOS
function! IsMac() function! IsMac()
return !s:is_windows && !s:is_cygwin return !s:is_windows && !s:is_cygwin
\ && (has('mac') || has('macunix') || has('gui_macvim') || \ && (has('mac') || has('macunix') || has('gui_macvim') ||
@ -40,12 +44,20 @@ function! IsMac()
\ system('uname') =~? '^darwin')) \ system('uname') =~? '^darwin'))
endfunction endfunction
" IsGuiApp determines if (n)vim is running in a GUI
function! IsGuiApp() function! IsGuiApp()
return has("gui_running") || exists("neovim_dot_app") return has("gui_running") || exists("neovim_dot_app")
\ || has("gui_win32") || has("gui_macvim") \ || has("gui_win32") || has("gui_macvim")
\ || has("gui_vimr") || exists('g:gui_oni') \ || has("gui_vimr") || exists('g:gui_oni')
endfunction endfunction
" Some GUI applications provide built in support for certain features
let g:gui = {}
let g:gui.has_buffer_features = exists('g:gui_oni')
let g:gui.has_autocomplete_features = exists('g:gui_oni')
let g:gui.has_linter_features = exists('g:gui_oni')
let g:gui.has_ctags_features = exists('g:gui_oni')
" Auto install vim-plug " Auto install vim-plug
if empty(glob('~/.vim/autoload/plug.vim')) if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs

View File

@ -17,3 +17,7 @@ endif
" TODO: Should this go somewhere else? " TODO: Should this go somewhere else?
" Filetype extension " Filetype extension
au BufRead,BufNewFile *.md set syntax=markdown au BufRead,BufNewFile *.md set syntax=markdown
" Default to running vim like it's an IDE. To disable on a more restricted
" machine, override this to 0 using an init.local.rc.vim
let g:vim_as_an_ide = 1