forked from demonlife/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.luin
executable file
·312 lines (263 loc) · 8.43 KB
/
vimrc.luin
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
" General {{{
set nocompatible " Disable vi compatibility
set hidden " Open a new file using :e,
" without being forced to write or undo your changes first
set encoding=utf-8
set history=256 " Number of things to remember in history
set timeoutlen=250 " Time to wait after ESC (default causes an annoying delay)
set clipboard=unnamed " Yanks go on clipboard instead
if $TMUX == ''
set clipboard+=unnamed
endif
set t_Co=256
set lazyredraw " Don't redraw while executing macros (good performance config)
" Match & search
set hlsearch " Highlight search
set ignorecase " Do case in sensitive matching with
set smartcase " be sensitive when there's a capital letter
set incsearch " Do incremental searching
" Backup & undo
set nowritebackup
set nobackup
set directory=/tmp// " prepend(^=) $HOME/.tmp/ to default path; use full path as backup filename(//)
set undofile
set undodir=~/.vim/undo
autocmd! bufwritepost .vimrc source %
" }}}
" Vundle {{{
filetype off
filetype plugin indent off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Lokaltog/vim-easymotion'
let g:EasyMotion_leader_key = 'f'
Bundle 'bling/vim-airline'
let g:airline_left_sep = ''
let g:airline_right_sep = ''
Bundle 'scrooloose/nerdtree'
Bundle 'jistr/vim-nerdtree-tabs'
map <S-m> <plug>NERDTreeTabsToggle<CR>
Bundle 'altercation/vim-colors-solarized'
Bundle 'Shougo/neocomplete.vim'
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#dictionary#dictionaries = {
\ 'default' : '',
\ 'vimshell' : $HOME.'/.vimshell_hist',
\ 'scheme' : $HOME.'/.gosh_completions'
\ }
if !exists('g:neocomplete#keyword_patterns')
let g:neocomplete#keyword_patterns = {}
endif
let g:neocomplete#keyword_patterns['default'] = '\h\w*'
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" <C-h>, <BS>: close popup and delete backword char.
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
" Enable omni completion.
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
autocmd FileType make setlocal noexpandtab
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
Bundle 'Shougo/neosnippet.vim'
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"
if has('conceal')
set conceallevel=2 concealcursor=i
endif
Bundle 'groenewege/vim-less'
Bundle 'scrooloose/syntastic'
let g:syntastic_check_on_open=1
let g:syntastic_phpcs_conf = "--tab-width=4 --standard=CodeIgniter"
Bundle 'tpope/vim-markdown'
Bundle 'vim-scripts/bufexplorer.zip'
noremap <silent> <CR> :BufExplorer<CR>
Bundle 'digitaltoad/vim-jade'
Bundle 'mileszs/ack.vim'
Bundle 'vim-scripts/nerdtree-ack'
" ISSUE: https://github.com/joedicastro/dotfiles/issues/12
" Bundle 'terryma/vim-multiple-cursors'
Bundle 'joedicastro/vim-multiple-cursors'
Bundle 'Raimondi/delimitMate'
" Dash
Bundle 'rizzatti/funcoo.vim'
Bundle 'rizzatti/dash.vim'
:nmap <silent> Q <Plug>DashSearch
Bundle "pangloss/vim-javascript"
Bundle "tpope/vim-commentary"
nmap <BS> gcc
vmap <BS> gc
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
Bundle 'terryma/vim-expand-region'
map <Space> <Plug>(expand_region_expand)
map - <Plug>(expand_region_shrink)
noremap + =
Bundle 'thiderman/nginx-vim-syntax'
Bundle 'mattn/emmet-vim'
Bundle 'jnwhiteh/vim-golang'
Bundle 'gkz/vim-ls'
set runtimepath+=$GOROOT/misc/vim
Bundle 'mustache/vim-mode'
Bundle 'kchmck/vim-coffee-script'
autocmd FileType litcoffee runtime ftplugin/coffee.vim
Bundle 'mintplant/vim-literate-coffeescript'
Bundle 'kien/ctrlp.vim'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
Bundle 'tpope/vim-fugitive'
Bundle 'junegunn/goyo.vim'
" }}}
" Formatting {{{
set fo-=o " Do not insert the current comment leader after hitting 'o' or 'O' in Normal mode.
set fo-=r " Do not automatically insert a comment leader after an enter
set fo-=t " Do not auto-wrap text using textwidth (does not apply to comments)
set nowrap
set textwidth=0 " Don't wrap lines by default
set wildmode=longest,list " At command line, complete longest common string, then list alternatives.
set backspace=indent,eol,start
set tabstop=2 " Set the default tabstop
set softtabstop=2
set shiftwidth=2 " Set the default shift width for indents
set smarttab " Smarter tab levels
set expandtab
" indent setting
set si
set formatoptions+=mM
set smartindent
set cindent
set cinoptions=:s,ps,ts,cs
set cinwords=if,else,while,do,for,switch,case
syntax on
set synmaxcol=248
set ttyfast " u got a fast terminal
set ttyscroll=3
set lazyredraw " to avoid scrolling problems
set foldmethod=indent
set foldlevel=2
set foldlevelstart=20 " All folds open when opening a file
filetype plugin indent on " Automatically detect file types
" }}}
" Visual {{{
set ruler " Show the cursor position all the time
set showcmd " Display incomplete commands
set cursorcolumn " Highlight the current column
set cursorline " Highlight the current line
" Have a different background in GUI and terminal modes.
if has('gui_running')
set background=light
else
set background=light
endif
:silent! colorscheme solarized
" Highlight trailing whitespace
:highlight TrailWhitespace ctermbg=red guibg=red
:match TrailWhitespace /\s\+$\| \+\ze\t/
set nowrap
set whichwrap=b,s,<,>,[,],h,l
" list setting
set list
set listchars=tab:▸-,trail:⋅,extends:❯,precedes:❮
" relative number
set relativenumber
" make relative number set for all buffer
au BufReadPost * set relativenumber
" }}}
" Key mappings {{{
noremap H ^
noremap L $
nnoremap ; :
nnoremap : ;
:ca w; w
" emacs style key binding for insert mode
inoremap <C-a> <Home>
inoremap <C-e> <End>
inoremap <C-b> <C-o>b
inoremap <C-w> <C-o>w
inoremap <C-u> <Esc><Right>c0
xnoremap p pgvy
noremap vp viwpgvy
noremap vy yiw
nnoremap K "_d
" nnoremap ~ /=expand("<cword>")
nnoremap ~ ma*
" use left & right key to switch between buffers
noremap <silent> <Left> :bp<CR>
noremap <silent> <Right> :bn<CR>
" map up & down to gk & gj for convenient in wrap model
noremap <Up> gk
noremap <Down> gj
" write with sudo
cmap w!! w !sudo tee %
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" reselect visual block after indent/outdent
vnoremap , <gv
vnoremap . >gv
" make Y behave like other capitals
noremap Y y$
" Quickly insert parenthesis/brackets/etc.
" inoremap (( <Esc>I(<Esc>A)<Esc>I
"" map ctrl + s to save file. need add 'stty -ixon' in the .bashrc or .zshrc
"" if you use vim in the terminal.
" inoremap <C-s> <Esc>:w<CR>a
" nnoremap <C-s> :w<CR>
nnoremap <Tab> %
nnoremap \ :!open <C-R>%<CR><CR>
nnoremap U <C-r>
" Window Navigation
noremap <C-J> <C-W>j
noremap <C-k> <C-W>k
noremap <C-h> <C-W>h
noremap <C-l> <C-W>l
noremap <C-W>l <C-l>
" }}}
" Omnifunc {{{
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
" }}}
" MacVim {{{
if has("gui_running")
set go=aAce " remove toolbar
"set transparency=30
set guifont=Monaco:h13
set showtabline=2
set columns=140
set lines=40
noremap <D-M-Left> :tabprevious<cr>
noremap <D-M-Right> :tabnext<cr>
map <D-1> 1gt
map <D-2> 2gt
map <D-3> 3gt
map <D-4> 4gt
map <D-5> 5gt
map <D-6> 6gt
map <D-7> 7gt
map <D-8> 8gt
map <D-9> 9gt
map <D-0> :tablast<CR>
endif
" }}}
autocmd BufReadPre * if getfsize(expand("%")) > 10000000 | syntax off | endif