-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathvimrc
252 lines (229 loc) · 7.16 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
" vim:foldmethod=marker
syntax enable
filetype indent plugin on
set ofu=syntaxcomplete#Complete
set backspace=indent,eol,start
set nocompatible " sets all config to default ones whether is vi or vim
""" Vundle Stuff: """
" Vundle setup {{{
set rtp+=~/.vim/vundle/
call vundle#rc()
" }}}
" Bundle installed by Vundle {{{
Bundle "gmarik/vundle"
Bundle "charleschen/Pychimp-vim"
Bundle "chmllr/vim-colorscheme-elrodeo"
" Bundle "git://git.wincent.com/command-t.git"
Bundle "tpope/vim-fugitive"
Bundle "vim-airline/vim-airline"
Bundle "vim-airline/vim-airline-themes"
" Bundle "mileszs/ack.vim"
" Bundle "duganchen/vim-soy"
Bundle "sjl/clam.vim"
Bundle "kien/tabman.vim"
Bundle "scrooloose/nerdtree"
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/vim-snippets"
Bundle "charleschen/vim-snipmate"
Bundle "tpope/vim-surround"
" Bundle "mattn/emmet-vim"
" Bundle "orestis/pysmell"
Bundle "techlivezheng/vim-plugin-minibufexpl"
Bundle "AndrewRadev/switch.vim"
Bundle "zeekay/python.vim"
Bundle "nvie/vim-flake8"
Bundle "majutsushi/tagbar"
Bundle "maxbrunsfeld/vim-yankstack"
Bundle "Valloric/YouCompleteMe"
Bundle "vim-scripts/rdark"
Bundle "mhinz/vim-signify"
Bundle "lepture/vim-jinja"
" Bundle "jelera/vim-javascript-syntax"
Bundle "pangloss/vim-javascript"
Bundle "kshenoy/vim-origami"
Bundle "Yggdroot/indentLine"
Bundle "szw/vim-ctrlspace"
Bundle "tpope/vim-vinegar"
Bundle "othree/javascript-libraries-syntax.vim"
Bundle "marijnh/tern_for_vim"
Bundle "xolox/vim-misc"
Bundle "xolox/vim-notes"
Bundle "Shutnik/jshint2.vim"
" Bundle "q335r49/microviche"
Bundle "chase/vim-ansible-yaml"
Bundle "hynek/vim-python-pep8-indent"
Bundle "ctrlpvim/ctrlp.vim"
" Bundle "w0rp/ale"
Bundle "dracula/vim"
Bundle "vim-multiple-cursors"
Bundle "modille/groovy.vim"
" Bundle "vim-scripts/groovyindent-unix"
Bundle "elzr/vim-json"
" }}}
" Key Mappings: {{{
let mapleader = ","
let g:mapleader = ","
" Quickly access and refresh vim config:
nmap <silent> <leader>ev :e $MYVIMRC<cr>
nmap <silent> <leader>sv :so $MYVIMRC<cr>
" Smart way to move btw. windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" }}}
" Indentation/wrap customization {{{
set ai " sets autoindent on
set si " sets smartindent on
set expandtab
set smarttab
set tabstop=4 shiftwidth=4
set wrap " wraps lines longer than the window
set backspace=eol,start,indent
set whichwrap+=<,>,h,l " allow specified keys to move the cursor move to the next line
set lbr
" }}}
" Vim user interface {{{
set t_Co=256
set number " turns on line numbers
set colorcolumn=100
set laststatus=2 " always shows status line for the last window
set gfn=Menlo:h13
set shell=/bin/bash
set history=700
set wildmenu " invokes tab completion for command-line
set showmatch " jump to matching bracket
set mat=2 " sets the match time for brackets
set scrolloff=7
set cmdheight=2 " set command line height
set hid " hides buffers when abandoned
set nolazyredraw
set encoding=utf8 " sets encoding of vim
set splitbelow splitright " splits new verticle split to the right and new horizontal to the bottom
try
lang en_US " tries to set language
catch
endtry
" }}}
" Search Configuration {{{
set ignorecase " case is ignored when searching lower case
set smartcase " uses case to search when there is something upper case
set hlsearch
set incsearch " high search term as you type
set magic " characters are taken literally (ex: . matches any character, not \.)
" }}}
" Vim file system configuration {{{
set ffs=unix,dos,mac
set nowb
set noswapfile
set tw=500 " max with of text that is being inserted
set autoread " auto reread file openned in vim that is modified outside of vim
try
set undodir=~/.vim/undodir
set undofile
catch
endtry
" }}}
""" Language Related Stuff: """
" Groovy Section {{{
au BufNewFile,BufRead *.groovy setf groovy
au BufNewFile,BufRead Jenkinsfile.*,Jenkinsfile setf groovy
" }}}
" Dockerfile Section {{{
au BufNewFile,BufRead Dockerfile.* set ft=dockerfile
" }}}
" json Section {{{
au FileType json setlocal sw=2 sts=2 et
let g:vim_json_syntax_conceal = 0
" autocmd Filetype json let g:indentLine_setConceal = 0
" }}}
" Soy Section {{{
au BufRead,BufNewFile *.soy set filetype=soy
au FileType soy setlocal sw=2 sts=2 et
" }}}
" YAML Section {{{
au FileType yaml setlocal sw=2 sts=2 et
" }}}
" CSS Section {{{
au BufNewFile,BufRead *.css set ft=css
au FileType css setlocal sw=2 sts=2 et
" }}}
" LESS Section {{{
au BufNewFile,BufRead *.less set ft=less
au FileType less setlocal sw=2 sts=2 et
" }}}
" SCSS Section {{{
au BufNewFile,BufRead *.scss set ft=scss
au FileType scss setlocal sw=2 sts=2 et
" }}}
" HTML Section {{{
au FileType html setlocal sw=2 sts=2 et
au FileType htmldjango setlocal sw=2 sts=2 et
" }}}
" CPP Section {{{
au FileType cpp setlocal sw=2 sts=2 et
" }}}
" Jinja Section {{{
au BufNewFile,BufRead *.jinja set ft=jinja
au BufNewFile,BufRead *.j2 set ft=jinja
au FileType jinja setlocal sw=2 sts=2 et
" }}}
" Ruby Section {{{
au BufNewFile,BufRead Vagrantfile set ft=ruby
" }}}
" Python Section {{{
let python_highlight_all = 1
au FileType python syn keyword pythonDecorator True None False self
au BufNewFile,BufRead wscript set ft=python
au FileType python map <buffer> <leader>1 /class
au FileType python map <buffer> <leader>2 /def
au FileType python map <buffer> <leader>C ?class
au FileType python map <buffer> <leader>D ?def
" Run current program
au FileType python map <f9> :w<CR>:!python %<CR>
" Python Mode Stuff
let g:pymode_lint_ignore = ""
" }}}
" JavaScript section {{{
au FileType javascript setlocal sw=2 sts=2 et
" au FileType javascript call JavaScriptFold()
au FileType javascript setl fen
au FileType javascript setl nocindent
au FileType javascript imap <c-t> AJS.log();<esc>hi
au FileType javascript imap <c-a> alert();<esc>hi
au FileType javascript inoremap <buffer> $f //--- PH ----------------------------------------------<esc>FP2xi
" function! JavaScriptFold()
" setl foldmethod=syntax
" setl foldlevelstart=1
" syn region foldBraces start=/{/ end=/}/ transparent fold keepend extend
" function! FoldText()
" return substitute(getline(v:foldstart), '{.*', '{...}', '')
" endfunction
" setl foldtext=FoldText()
" endfunction
" }}}
" Protobuf section {{{
au FileType proto setlocal sw=2 sts=2 et
" }}}
""" Cool Configurations/shortcuts: """
" Deleting Trailing White Spaces {{{
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite {*.py,*.json,*.js,*.html,*.jinja} :call DeleteTrailingWS()
" }}}
" paste {{{
function! HasPaste()
if &paste
return 'PASTE MODE'
else
return ''
endif
endfunction
" }}}
""" Loading seperate vim configs: {{{
exe "source" "~/.vim/vimrc.$USER"
" }}}