-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
243 lines (185 loc) · 6.28 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
set nocompatible "allows for backwards imcompatible changes to be in effect
set backspace=indent,eol,start
" Better modes. Remeber where we are
set viminfo=!,'1000,f1,<1000,h,n~/.viminfo
" Pathogen
call pathogen#infect()
set history=1000 "remember last 1000 commands
" Enable filetype plugin
filetype on
filetype plugin on
filetype plugin indent on
" Auto-read file if externally modified
set autoread
set wildmenu
set wildmode=list:longest,full "better tab completion
set ruler "Always show current position
set cursorline
set bs=2 "Normal backspace
set ignorecase "these next 2 make /-style and *-style searches case insensitive,
set smartcase "and case-sensitive, respectively
set hlsearch " highlights searched terms
set incsearch " searches as you type in terms
set magic " Pattern matching with special chars
set showmatch
" Disable sounds
set noerrorbells
set novisualbell
set t_vb=
syntax on " Syntax highlighting
" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Don’t create backups when editing files in certain directories
set backupskip=/tmp/*,/private/tmp/*
" Tab Settings
set smarttab
set tabstop=4
set lbr " Wrap lines at words
set ai " Auto-indent
set si " Smart-indent
set wrap " Wrap lines
set hidden "Allows multiple buffers to be managed
set showmode " Show current mode (Insert,Replace,Visual,etc)
set showcmd
set laststatus=2 " Always show status line
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors
set encoding=utf-8 nobomb " Necessary to show unicode glyphs
colorscheme myterm " Feel free to change this
" Show “invisible” characters
set lcs=tab:▸\ ,trail:·,nbsp:_
set list
set ttyfast " Help with slow scrolling
" keep some more lines for scope
set scrolloff=5
" enable automatic title setting for terminals
set title
set t_ts=]2;
set t_fs=\\
set titleold=
set titlestring=%t
" F2 to toggle paste-mode
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
" F3 to toggle line numbers
nnoremap <F3> :set invnu nu?<CR>
" F4 to toggle relative line numebrs
nnoremap <F4> :set invrnu rnu?<CR>
" airline settings
let g:airline#extensions#whitespace#mixed_indent_algo = 2
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:rbpt_max = 15
" vim-go settings
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
" Default to 1 tab
autocmd FileType go setlocal shiftwidth=4
" Always enable rainbow parens
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
let g:is_bash = 1
" vim-terraform settings
let g:terraform_align=1
let g:terraform_fmt_on_save=1
" better whitespace settings
autocmd BufWritePre * StripWhitespace
"
" Unmap > mapping for puppet
" --------------------------
autocmd FileType puppet iunmap <buffer> <silent> >
autocmd FileType puppet setlocal shiftwidth=4 tabstop=4 softtabstop=4
" python support
" --------------
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8
\ formatoptions+=croq softtabstop=4 smartindent
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
let g:flake8_show_in_file = 1
autocmd BufWritePost *.py call Flake8()
" YAML support
" ------------
autocmd FileType yaml setlocal expandtab shiftwidth=2 tabstop=8 softtabstop=2
autocmd BufNewFile,BufRead *.sls setlocal ft=yaml
" Lua support
" -----------
autocmd FileType lua setlocal shiftwidth=2 tabstop=2 softtabstop=2
" vim
" ---
autocmd FileType vim setlocal expandtab shiftwidth=2 tabstop=8 softtabstop=2
" Javascript
" ----------
autocmd FileType javascript setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd BufNewFile,BufRead *.json setlocal ft=javascript
autocmd FileType javascript setlocal commentstring=//\ %s
" Dot support
" -----------
autocmd FileType dot setlocal shiftwidth=2 tabstop=2 softtabstop=2
" Shell support
" -------------
autocmd FileType sh setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab
" php support
" -----------
autocmd FileType php setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab
" protobuf support
" ----------------
autocmd FileType proto setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab
autocmd BufNewFile,BufRead *.proto setlocal ft=proto
" supervsior support
" ----------------
autocmd FileType supervisor setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab
autocmd BufNewFile,BufRead *.supervisor setlocal ft=supervisor
" bazel support
" ----------------
autocmd BufNewFile,BufRead *.bzl setlocal ft=python sw=2 ts=2 sts=2
autocmd BufNewFile,BufRead BUILD* setlocal ft=python sw=2 ts=2 sts=2
" Pystachio support
" ----------------
autocmd BufNewFile,BufRead *.pyst setlocal ft=python
" Dbxinit config support
" ----------------------
autocmd BufNewFile,BufRead *.dbxtr setlocal ft=python
" ruby support
" ------------
autocmd FileType ruby setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" scala support
" -------------
autocmd FileType scala setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd BufNewFile,BufRead *.scala setlocal ft=scala
" terraform support
" -----------------
autocmd FileType terraform setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd BufNewFile,BufRead *.hcl setlocal ft=terraform
augroup vim.terraform.fmt
autocmd BufWritePre *.hcl call terraform#fmt()
augroup END
" jsonnet support
" -----------------
autocmd FileType jsonnet setlocal expandtab shiftwidth=2 tabstop=2 softtabstop=2
" Dockerfile support
" -----------------
autocmd FileType dockerfile setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
autocmd BufNewFile,BufRead Dockerfile* setlocal ft=dockerfile