forked from justone/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
161 lines (135 loc) · 4.4 KB
/
.vimrc
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
if has('nvim')
let vimplugdir='~/.config/nvim/plugged'
let vimautoloaddir='~/.config/nvim/autoload'
" TODO: pip3 install neovim
else
let vimplugdir='~/.vim/plugged'
let vimautoloaddir='~/.vim/autoload'
endif
if empty(glob(vimautoloaddir . '/plug.vim'))
" TODO: else?
if executable('curl')
execute 'silent !curl -fLo ' . vimautoloaddir . '/plug.vim --create-dirs ' .
\ 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endif
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin(vimplugdir)
" Neovim is sensible by default
if !has('nvim')
Plug 'tpope/vim-sensible'
endif
Plug 'junegunn/vim-plug'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'morhetz/gruvbox'
Plug 'junegunn/rainbow_parentheses.vim'
Plug 'neomake/neomake'
Plug 'scrooloose/nerdTree'
Plug 'tomtom/tcomment_vim'
Plug 'tpope/vim-surround'
Plug 'Yggdroot/indentLine'
" Automatic generation of CTags
Plug 'vim-scripts/vim-misc' | Plug 'xolox/vim-easytags'
" Automatic update of CTags
Plug 'craigemery/vim-autotag'
" Nice browser for CTags
Plug 'majutsushi/tagbar'
" Highlight trailing whitespace
Plug 'ntpeters/vim-better-whitespace'
" And gitgutter
Plug 'airblade/vim-gitgutter'
" Auto-close scopes
Plug 'Raimondi/delimitMate'
" python support
Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }
" EditorConfig
Plug 'editorconfig/editorconfig-vim'
Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'ervandew/supertab'
Plug 'deoplete-plugins/deoplete-jedi'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
" Initialize plugin system
call plug#end()
set hidden
let g:airline_theme='base16_gruvbox_dark_hard'
" set indentation to be 4 and use spaces
set tabstop =4
set softtabstop =4
set shiftwidth =4
set expandtab
" close quickfix window on close
augroup my_neomake_qf
autocmd!
autocmd QuitPre * if &filetype !=# 'qf' | lclose | endif
augroup END
function! MyOnBattery()
if has('macunix')
return match(system('pmset -g batt'), "Now drawing from 'Battery Power'") != -1
elseif has('unix')
return readfile('/sys/class/power_supply/AC/online') == ['0']
endif
return 0
endfunction
" Full config: when writing or reading a buffer, and on changes in insert and
" normal mode (after 1s; no delay when writing).
if has('nvim')
if MyOnBattery()
call neomake#configure#automake('w')
else
call neomake#configure#automake('nrwi', 500)
endif
endif
let g:deoplete#enable_at_startup = 1
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
let g:UltiSnipsExpandTrigger="<C-j>"
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
let g:SuperTabDefaultCompletionType = "<C-n>"
nmap <C-n> :NERDTreeToggle<CR>
nmap <C-b> :TagbarToggle<CR>
set tags=./tags,.vimtags,~/.vim/tags;
set conceallevel=1
colorscheme gruvbox
let use_truecolor=0
if exists('$TMUX')
let s:tmux_version = split(split(system('tmux -V'))[-1], '\.')
let s:tmux_version_major = s:tmux_version[0]
let s:tmux_version_minor = s:tmux_version[1]
if ((s:tmux_version_major >= 2) && (s:tmux_version_minor >= 2))
let use_truecolor=1
else
let use_truecolor=0
endif
endif
if use_truecolor
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
" omnifuncs
augroup omnifuncs
autocmd!
" autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
" autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
" autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
" autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
augroup end