-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc-james
54 lines (47 loc) · 1.58 KB
/
vimrc-james
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
set nocompatible
set noshowmode
set tabstop=2
set whichwrap+=<,>,[,]
set backspace=indent,eol,start
set viminfo+=n~/.cache/viminfo
set t_Co=256
syntax on
set cursorline
cmap w!! w !sudo tee > /dev/null %
cmap Wq wq
" Install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | :execute 'source ' . expand('<sfile>:p')
endif
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'vimpostor/vim-lumen'
Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline'
Plug 'sonph/onehalf', {'rtp': 'vim'}
Plug 'scrooloose/syntastic'
Plug 'ctrlpvim/ctrlp.vim'
call plug#end()
" Switching OS dark mode changes the colorscheme and airline_theme
au User LumenLight colorscheme onehalflight
au User LumenLight let g:airline_theme='onehalflight'
au User LumenDark colorscheme onehalfdark
au User LumenDark let g:airline_theme='onehalfdark'
" Airline needs to refresh when its theme is changed.
" However, simply calling AirlineRefresh on LumenLight/LumenDark fails, saying AirlineRefresh isn't defined
" Avoid those errors during initial startup, but allow changing between dark mode and light mode to still cause an AirlineRefresh
func! TryAirlineRefresh()
try
silent! AirlineRefresh
endtry
endfunc
au User LumenLight :call TryAirlineRefresh()
au User LumenDark :call TryAirlineRefresh()
" Use true colors
if exists('+termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif