-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
274 lines (223 loc) · 7.11 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
" easy toggle to allow nastly mouse based copy
nnoremap <F11> :GitGutterDisable<CR>:set norelativenumber!<CR>
" disable highlighted last search
nnoremap <F3> :set hlsearch!<CR>
" no need for shift
nnoremap ; :
" more colors
set t_Co=256
call plug#begin('~/.vim/plugged')
" vertical indent line
"Plug 'Yggdroot/indentLine'
" color nested [({
Plug 'luochen1990/rainbow'
" syntax based closing statements
Plug 'tpope/vim-endwise'
" syntax based closing statements
Plug 'rstacruz/vim-closer'
" git
Plug 'airblade/vim-gitgutter'
" filebrowser
Plug 'tpope/vim-vinegar'
" q to exit
autocmd FileType netrw nnoremap q :bd<CR>
" all insert mode completions with tab
Plug 'ervandew/supertab'
" syntax highlighting
Plug 'scrooloose/syntastic'
" text alignment
Plug 'godlygeek/tabular'
"
Plug 'tomtom/tlib_vim'
" common snippets for multiple languages
" Plug 'SirVer/ultisnips'
" Plug 'honza/vim-snippets'
" share the registers of any and/or all vim instances
"Plug 'ardagnir/united-front'
" file find and more
Plug 'Shougo/unite.vim'
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
nnoremap <Leader>f :Unite -start-insert file_rec/async<CR>
nnoremap <Leader>g :Unite grep:.<CR>
" apt-get install silversearcher-ag
if executable('ag')
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts = '--nogroup --nocolor --column --hidden'
let g:unite_source_grep_recursive_opt = ''
endif
" nice statusbar
Plug 'bling/vim-airline'
" easy comment out. e.g. gcap
Plug 'tpope/vim-commentary'
" quicker motion
"Plug 'easymotion/vim-easymotion'
" make vim tags easier
"Plug 'xolox/vim-misc'
"Plug 'xolox/vim-easytags'
" lots of git commands
Plug 'tpope/vim-fugitive'
" ii is indentation text object
Plug 'michaeljsmith/vim-indent-object'
" everything puppet
" Plug 'rodjek/vim-puppet', { 'for': 'pp' }
" change surroundings with s object
Plug 'tpope/vim-surround'
" line object
Plug 'kana/vim-textobj-line'
Plug 'kana/vim-textobj-user'
" completation based on history
" Plug 'Valloric/YouCompleteMe', { 'do': './install.py', 'on': [] }
" augroup load_us_ycm
" autocmd!
" autocmd InsertEnter * call plug#load('YouCompleteMe')
" \| call youcompleteme#Enable() | autocmd! load_us_ycm
" augroup END
" be smart about pasting into vim
Plug 'ConradIrwin/vim-bracketed-paste'
" integration with tmux
Plug 'christoomey/vim-tmux-navigator'
Plug 'benmills/vimux'
map <Leader>r :VimuxPromptCommand<CR>
map <Leader>a :VimuxRunLastCommand<CR>
let VimuxUseNearest = 0
call plug#end()
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" fix common typos
:command WQ wq
:command Wq wq
:command W w
:command Q q
syntax on
set autoindent
" let g:indentLine_noConcealCursor="" " concealing quotes is bad
set backspace=indent,eol,start " Set for maximum backspace smartness"
set cmdheight=1 " Less Hit Return messages
set cursorline
set display+=uhex " Show unprintables as <xx>
set encoding=utf-8
set expandtab
set fileencodings=utf-8
set fileencodings=utf-8,ucs-bom,cp1251
set fileencoding=utf-8
set fileformats=unix,dos,mac
set fileformat=unix
set hlsearch
set ignorecase
set incsearch
set laststatus=2 " Always show status bar
set linespace=1 " add some line space for easy reading
set nocompatible
set noshowmode
set relativenumber
set pastetoggle=<F10>
set scrolloff=3 " don't scroll any closer to top/bottom
set secure
set shiftwidth=2
set shortmess=aoOtT " Abbreviate the status messages
set showcmd " Show command I'm typing
set showmatch " show matching ({[
set sidescrolloff=5 " don't scroll any closer to left/right
set smartcase
set smartindent
set smarttab
set softtabstop=2
set tabstop=2
set timeoutlen=500
set wildchar=<TAB> " Character to start command line completion
set wildmenu " Enhanced command line completion mode
set wildmode=longest:full,full
set undofile
set undodir=~/.vim/undo
" let g:syntastic_check_on_open=1
" let g:syntastic_enable_signs=1
" let g:delimitMate_expand_cr = 2
" let g:delimitMate_expand_space = 1
" let g:delimitMate_expand_inside_quotes = 1
" let g:delimitMate_balance_matchpairs = 1
" let g:delimitMate_jump_expansion = 1
let g:rainbow_active = 1
" let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
let g:ycm_complete_in_comments = 1 " Completion in comments
let g:ycm_complete_in_strings = 1 " Completion in string
let g:airline_powerline_fonts = 0
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#eclim#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#branch#empty_message = 'no scm'
let g:airline#extensions#syntastic#enabled = 1
let g:airline#extensions#tagbar#flags = 'f'
let g:airline#extensions#virtualenv#enabled = 1
let g:airline#extensions#hunks#enabled = 1
let g:airline#extensions#hunks#hunk_symbols = ['+', '~', '-']
let g:airline#extensions#ctrlp#color_template = 'normal'
let g:airline#extensions#ctrlp#show_adjacent_modes = 1
" let g:UltiSnipsExpandTrigger ="<c-tab>"
" let g:UltiSnipsJumpForwardTrigger = "<tab>"
" let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
" Enable tabbing through list of results
" function! g:UltiSnips_Complete()
" call UltiSnips#ExpandSnippet()
" if g:ulti_expand_res == 0
" if pumvisible()
" return "\<C-n>"
" else
" call UltiSnips#JumpForwards()
" if g:ulti_jump_forwards_res == 0
" return "\<TAB>"
" endif
" endif
" endif
" return ""
" endfunction
" au InsertEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
" Expand snippet or return
" let g:ulti_expand_res = 0
" function! Ulti_ExpandOrEnter()
" call UltiSnips#ExpandSnippet()
" if g:ulti_expand_res
" return ''
" else
" return "\<return>"
" endfunction
" Set <space> as primary trigger
" inoremap <return> <C-R>=Ulti_ExpandOrEnter()<CR>
" Show any trailing whitespace
set list
set listchars=tab:>-,trail:-
" file is large from 5mb
let g:LargeFile = 1024 * 1024 * 5
augroup LargeFile
autocmd BufReadPre * let f=getfsize(expand("<afile>")) | if f > g:LargeFile || f == -2 | call LargeFile() | endif
augroup END
function LargeFile()
" no syntax highlighting etc
set eventignore+=FileType
" save memory when other file is viewed
setlocal bufhidden=unload
" is read-only (write with :w new_filename)
setlocal buftype=nowrite
" no undo possible
setlocal undolevels=-1
" display message
autocmd VimEnter * echo "The file is larger than " . (g:LargeFile / 1024 / 1024) . " MB, so some options are changed (see .vimrc for details)."
endfunction
" somehow filetype = conf for pp files. fixing
augroup filetypedetect
au BufNewFile,BufRead *.pp setl ft=puppet
augroup END
" puppet-lint.rc isnt respected by syntastic
let g:syntastic_puppet_puppetlint_args="no-80chars-check"
" switch buffers with F5
:nnoremap <Leader>b :buffers<CR>:buffer<Space>
augroup highlight_follows_focus
autocmd!
autocmd WinEnter * set cursorline
autocmd WinLeave * set nocursorline
augroup END
augroup highligh_follows_vim
autocmd!
autocmd FocusGained * set cursorline
autocmd FocusLost * set nocursorline
augroup END