-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
219 lines (167 loc) · 6.77 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
"------------------------------------------------------------------[Vundle]----
source ~/.vim/bundles.vim
"------------------------------------------------------------------[General]----
set secure "locks down the exrc setting
set exrc "enable cwd .vimrc files
set nocompatible
set encoding=utf8
"set clipboard+=unnamed
set nowrap
set nofoldenable
set backspace=indent,eol,start
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
set autoindent
"set cinoptions=(s,m1,)200,j1,J1
"Use visual bell, but an empty string for it - display nothing
set vb
set t_vb=""
set backup "make a backup before deleting a file
set swapfile
set backupdir=/tmp
set directory=/tmp "keep swap files out of cwd
set lazyredraw "don't redraw while executing things
set complete=.,w,k,b,u,t,i
set completeopt=menu "show popup for completions
let mapleader=","
"-------------------------------------------------------------------[Layout]----
set nonumber "turn off line numbering
set laststatus=2 "always show a status line on the last window
"set ruler
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
set listchars=tab:▶━,trail:⌴,extends:▶,precedes:◀
set splitbelow
set splitright
"set list
"set pumheight=5
colorscheme molokai
syntax on
silent! set colorcolumn=80 "highlight 80th column
function! SyntaxItem()
return synIDattr(synID(line("."),col("."),1),"name")
endfunction
"set statusline+=%{SyntaxItem()}
"--------------------------------------------------------------[Plugins]----
nmap <leader>b :TagbarToggle<CR>
let g:tagbar_ctags_bin='/usr/local/bin/ctags'
nmap <leader>nt :NERDTreeToggle<CR>
let g:syntastic_javascript_checker="jshint"
silent! sign define SyntasticError text=!>
silent! sign define SyntasticWarning text=W>
" vim-javascript
let g:html_indent_inctags="html,body,head,tbody"
let g:html_indent_script1="inc"
let g:html_indent_style1="inc"
let g:javascript_conceal=0
" airline
let g:airline_theme='powerlineish'
"let g:airline_powerline_fonts=0
let g:airline#extensions#branch#displayed_head_limit=10
let g:airline#extensions#hunks#enabled=0
let g:airline#extensions#whitespace#enabled=1
let g:airline#extensions#whitespace#show_message=0
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" unicode symbols
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.whitespace = 'Ξ'
" unite
call unite#filters#matcher_default#use(['matcher_fuzzy'])
nnoremap <leader>f :<C-u>Unite -start-insert file_rec/async<CR>
autocmd FileType unite call s:unite_settings()
function! s:unite_settings()
imap <buffer> <C-j> <Plug>(unite_select_next_line)
imap <buffer> <C-j> <Plug>(unite_select_previous_line)
endfunction
" YCM
"let g:ycm_filetype_blacklist={'unite': 1}
"---------------------------------------------------------------[Search]----
set hlsearch "highlight previous search matches
set incsearch "highlight search matches while typing
set smartcase "case sensitive search when uppercase present
set ignorecase "case insensitive search by default
"-----------------------------------------------------------[Navigation]----
set mouse=a "enable mouse for all modes
set hidden "allow unwritten buffers to be hidden
set scrolloff=5
set scrolljump=5
set sidescrolloff=10
set sidescroll=1
set wildmenu
set showmatch "highlight matching bracket when inserting a new one
set matchtime=2 "how long to show matching bracket in .1s
" easier window navigation
nnoremap <silent> <Tab> :wincmd w<CR>
nnoremap <silent> <S-Tab> :wincmd W<CR>
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
"screenwise character movement
map j gj
map k gk
map H ^
map L $
map gf :e <cfile><CR>
nnoremap <leader>/ :nohls<CR>
"---------------------------------------------------------------[Keymap]----
set keymap=jocafa
"------------------------------------------------------------[Utilities]----
func! FinishHeader(chr)
execute "normal! A "
execute "normal! " . (80 - col("$")) . "A" . a:chr
endfunc
nnoremap <leader>- :call FinishHeader("-")<CR>
nnoremap <leader>= :call FinishHeader("=")<CR>
function! <SID>StripTrailingWhitespace()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
"---------------------------------------------------------------------------
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%[File Types]%%%%
"---------------------------------------------------------------------------
"-----------------------------------------------------------------[HTML]----
"autocmd BufNewFile,BufRead *.htm,*.html set filetype=html.css.javascript
"-----------------------------------------------------------[JavaScript]----
"autocmd FileType javascript set nocindent
autocmd FileType javascript set tabstop=2 softtabstop=2 shiftwidth=2 expandtab
"------------------------------------------------------------------[CSS]----
autocmd BufNewFile,BufRead *.css,*.less set filetype=css
"----------------------------------------------------------------[C/C++]----
autocmd BufNewFile,BufRead *.ino set filetype=cpp
autocmd FileType cpp set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab
"-----------------------------------------------------------------[GLSL]----
autocmd BufNewFile,BufRead *.glsl,*.vert,*.frag set filetype=glsl
"-----------------------------------------------------------------[HAML]----
autocmd BufNewFile,BufRead *.haml set filetype=haml
autocmd FileType haml set makeprg=haml\ %:p\ %:p:s?haml?html?
"-----------------------------------------------------------------[HTTP]----
autocmd BufNewFile,BufRead *.http set filetype=http
autocmd FileType http set ff=dos
"------------------------------------------------------------------[KML]----
autocmd BufNewFile,BufRead *.kml set filetype=xml
"-----------------------------------------------------------------[Ruby]----
"make -> ruby -c
autocmd BufNewFile,BufRead *.rb,*.rbw,*.gem,*.gemspec,[rR]akefile,Guardfile,*.rake,*.thor set filetype=ruby
"---------------------------------------------------------------[Python]----
autocmd FileType python let python_highlight_space_errors=1
autocmd FileType python let python_highlight_all=1
autocmd FileType python set omnifunc=pythoncomplete#Complete
"-------------------------------------------------------------[Markdown]----
autocmd BufNewFile,BufRead *.md,*.mkd,*.markdown set filetype=markdown
autocmd FileType markdown set wrap linebreak spell
"---------------------------------------------------------[ Processing ]----
"autocmd BufNewFile,BufRead *.pde set filetype=java
"-----------------------------------------------------------[ Protobuf ]----
autocmd BufNewFile,BufRead *.proto set filetype=proto
"-------------------------------------------------------------[ SQLite ]----
autocmd BufNewFile,BufRead *.sqlite set filetype=sql