vim-settings/vim/init.vim

72 lines
2.1 KiB
VimL
Raw Normal View History

2015-03-26 10:09:26 -07:00
" A lot of inspiration from Shougo
2012-07-02 13:25:36 -04:00
2015-03-26 10:09:26 -07:00
" Note: Skip initialization for vim-tiny or vim-small.
if !1 | finish | endif
2012-07-02 13:25:36 -04:00
" Don't use fish as the default shell. This makes things weird
if &shell =~# 'fish$'
2021-04-30 11:25:35 -07:00
set shell=bash
endif
" Don't use sh if we have bash
if &shell =~# '/sh$' || &shell =~# '^sh$' && executable('bash')
2021-04-30 11:25:35 -07:00
set shell=bash
endif
2015-03-26 17:54:29 -07:00
function! s:smart_source_rc(name)
call s:source_rc(a:name . '.rc.vim')
call s:source_rc(a:name . '.local.rc.vim')
2015-03-26 10:09:26 -07:00
endfunction
2015-03-26 17:54:29 -07:00
function! s:source_rc(path)
2015-03-26 10:11:36 -07:00
let l:f_path = fnameescape(expand('~/.vim/rc/' . a:path))
2015-03-26 10:09:26 -07:00
if filereadable(l:f_path)
execute 'source' . l:f_path
endif
endfunction
let s:is_windows = has('win16') || has('win32') || has('win64')
let s:is_cygwin = has('win32unix')
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
2015-03-26 10:09:26 -07:00
function! IsWindows()
return s:is_windows
endfunction
" IsMac determines if this instance is running on macOS
2015-03-26 10:09:26 -07:00
function! IsMac()
return !s:is_windows && !s:is_cygwin
\ && (has('mac') || has('macunix') || has('gui_macvim') ||
\ (!executable('xdg-open') &&
\ system('uname') =~? '^darwin'))
endfunction
" IsGuiApp determines if (n)vim is running in a GUI
2017-11-01 14:27:30 -07:00
function! IsGuiApp()
2019-10-24 13:58:45 -07:00
return has('gui_running') || exists('neovim_dot_app')
\ || has('gui_win32') || has('gui_macvim')
\ || has('gui_vimr') || exists('g:gui_oni')
2017-11-01 14:27:30 -07:00
endfunction
2024-07-19 15:05:09 -07:00
" Auto install vim-blink
let data_dir = expand('~/.vim')
if empty(glob(data_dir . '/autoload/blink.vim'))
call mkdir(expand(data_dir.'/autoload'),'p')
silent execute '!curl -fLo ' . data_dir . '/autoload/blink.vim --create-dirs https://raw.githubusercontent.com/IamTheFij/vim-blink/cmd-array/blink.vim'
augroup blinkinstall
autocmd VimEnter * BlinkUpdate
2019-10-24 13:58:45 -07:00
augroup end
2014-11-04 10:18:22 -08:00
endif
2024-07-19 15:05:09 -07:00
call blink#init()
2017-11-08 13:55:13 -08:00
call s:smart_source_rc('init')
2019-10-21 10:49:27 -07:00
call s:smart_source_rc('input')
2015-03-26 10:09:26 -07:00
call plug#begin()
2015-03-26 17:54:29 -07:00
call s:smart_source_rc('plugins')
2015-03-26 10:09:26 -07:00
call plug#end()
2015-03-26 17:54:29 -07:00
call s:smart_source_rc('ui')