From 57e5f83dc8859865643dda46b59633bb3d4a6d35 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Mon, 21 Oct 2019 16:26:35 -0700 Subject: [PATCH] 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 --- vim/init.vim | 12 ++++++++++++ vim/rc/init.rc.vim | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/vim/init.vim b/vim/init.vim index ee60f0c..3a63f74 100644 --- a/vim/init.vim +++ b/vim/init.vim @@ -3,6 +3,7 @@ " Note: Skip initialization for vim-tiny or vim-small. if !1 | finish | endif +" Don't use fish as the default shell. This makes things weird if &shell =~# 'fish$' set shell=bash endif @@ -29,10 +30,13 @@ let s:is_sudo = $SUDO_USER !=# '' && $USER !=# $SUDO_USER \ && $HOME !=# expand('~'.$USER) \ && $HOME ==# expand('~'.$SUDO_USER) + +" IsWindows determines if this instances is running on Windows function! IsWindows() return s:is_windows endfunction +" IsMac determines if this instance is running on macOS function! IsMac() return !s:is_windows && !s:is_cygwin \ && (has('mac') || has('macunix') || has('gui_macvim') || @@ -40,12 +44,20 @@ function! IsMac() \ system('uname') =~? '^darwin')) endfunction +" IsGuiApp determines if (n)vim is running in a GUI function! IsGuiApp() return has("gui_running") || exists("neovim_dot_app") \ || has("gui_win32") || has("gui_macvim") \ || has("gui_vimr") || exists('g:gui_oni') 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 if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs diff --git a/vim/rc/init.rc.vim b/vim/rc/init.rc.vim index c16b1d7..f737cbb 100644 --- a/vim/rc/init.rc.vim +++ b/vim/rc/init.rc.vim @@ -17,3 +17,7 @@ endif " TODO: Should this go somewhere else? " Filetype extension 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