-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
295 lines (224 loc) · 6.46 KB
/
vimrc
File metadata and controls
295 lines (224 loc) · 6.46 KB
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
" .vimrc File
" Maintained by:Dmitry Ogurtsov
" daogurtsov@gmail.com
" daogurtsov.github.com
"
"Forget compatibility with Vi. Who cares.
set nocompatible
"Enable filetypes
filetype on
filetype plugin on
"Pathogen
call pathogen#runtime_append_all_bundles()
filetype indent on
syntax on
"length
set lines=57
"columns
set columns=100
"line numbers
"set numbers
"Write the old file out when switching between files.
set autowrite
"Backspace all line.
set backspace=indent,eol,start
"Default flag for substitution
set gdefault
"Display current cursor position in lower right corner.
set ruler
"Cursor line ruler
set cursorline
"Adding abreviations
"Want a different map leader than \
"set mapleader = ",";
"Ever notice a slight lag after typing the leader key + command? This lowers
"the timeout.
set timeoutlen=700
"Rip out swap file
set noswapfile
"Switch between buffers without saving
set hidden
"Set the color scheme. Change this to your preference.
"Here's 100 to choose from: http://www.vim.org/scripts/script.php?script_id=625
colorscheme wombat256mod
"Color column
set colorcolumn=80
"Set font type and size. Depends on the resolution. Larger screens, prefer h15
set guifont=Courier\ New:h11
"Tab stuff
set tabstop=3
set shiftwidth=3
set softtabstop=3
set expandtab
"Show command in bottom right portion of the screen
set showcmd
"Show lines numbers
set number
"Prefer relative line numbering?
"set relativenumber"
"Indent stuff
set smartindent
set autoindent
"Force encode
set fileencoding=utf-8
set encoding=utf-8
"Always show the status line
set laststatus=2
"Prefer a slightly higher line height
set linespace=3
"Better line wrapping
set wrap
set textwidth=60
set formatoptions=qrn1
"Set incremental searching"
set incsearch
"Highlight searching
set hlsearch
" case insensitive search
set ignorecase
set smartcase
"Hide MacVim toolbar by default
set go-=T
"Hard-wrap paragraphs of text
nnoremap <leader>q gqip
"Enable code folding
set foldenable
"Hide mouse when typing
set mousehide
"Shortcut to fold tags with leader (usually \) + ft
nnoremap <leader>ft Vatzf
" Create dictionary for custom expansions
set dictionary+=C:\Program\ Files\ \(x86\)\Vim\vimfiles\dict.txt
" C-Space seems to work under gVim on both Linux and win32
inoremap <C-Space> <C-n>
"Opens a vertical split and switches over (\v)
nnoremap <leader>v <C-w>v<C-w>l
"Split windows below the current window.
set splitbelow
"Session settings
set sessionoptions=resize,winpos,winsize,buffers,tabpages,folds,curdir,help
"Set up an HTML5 template for all new .html files
"autocmd BufNewFile * silent! 0r $VIMHOME/templates/%:e.tpl
"Load the current buffer in Firefox - win specific.
abbrev ff :!start cmd /k "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" %:p<cr>
"abbrev ff :! open -a firefox.app %:p<cr>
"Map a change directory to the desktop - win specific
nmap ,d :cd c:\Users\daogu_000\Desktop<cr>:e.<cr>
"nmap ,d :cd ~/Desktop<cr>:e.<cr>
"Shortcut for editing vimrc file in a new tab
nmap ,ev :tabedit $MYVIMRC<cr>
"Change zen coding plugin expansion key to shift + e
let g:user_zen_expandabbr_key = '<c-z>'
"Faster shortcut for commenting. Requires T-Comment plugin
map ,c <c-_><c-_>
"Saves time; maps the spacebar to colon
nmap <space> :
"Automatically change current directory to that of the file in the buffer
" autocmd BufEnter * cd %:p:h
"Map code completion to , + tab
imap ,<tab> <C-x><C-o>
" More useful command-line completion
" set wildmenu
"Auto-completion menu
" set wildmode=list:longest
"http://vim.wikia.com/wiki/Make_Vim_completion_popup_menu_work_just_like_in_an_IDE
set completeopt=longest,menuone
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
\ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
"Map escape key to jj -- much faster
imap jj <esc>
"Delete all buffers (via Derek Wyatt)
nmap <silent> ,da :exec "1," . bufnr('$') . "bd"<cr>
"Bubble single lines (kicks butt)
"http://vimcasts.org/episodes/bubbling-text/
nmap <C-Up> ddkP
nmap <C-Down> ddp
"Bubble multiple lines
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
" Source the vimrc file after saving it. This way, you don't have to reload
" Vim to see the changes.
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
"
" easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
"------------------------"
"NERDTREE PLUGIN SETTINGS
"------------------------"
"Shortcut for NERDTreeToggle
nmap ,nt :NERDTreeToggle
"Show hidden files in NerdTree
let NERDTreeShowHidden=1
"autopen NERDTree and focus cursor in new document
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
"Helpeful abbreviations
iab lorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
iab llorem Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
"Spelling corrects. Just for example. Add yours below.
iab teh the
iab Teh The
"Peep open
if has("gui_macvim")
macmenu &File.New\ Tab key=<nop>
map <c-o> <Plug>PeepOpen
end
"Auto php
"au BufRead, BufNewFile *.php setfiletype php
"Line ends charater
" set list
set listchars=eol:¬
"Autocomplete navigation
imap <Tab> <C-n>
imap <S-Tab> <C-p>
"set folding method and marker
set fdm=marker
set foldmarker=[[,]]
"yank full file path to buffer
let @+=expand("%:p")
"easymotion leader remapping
let g:EasyMotion_leader_key = ','
"capitalaize - has confilict with comment
if (&tildeop)
nmap gcw guw~l
nmap gcW guW~l
nmap gciw guiw~l
nmap gciW guiW~l
nmap gcis guis~l
nmap gc$ gu$~l
nmap gcgc guu~l
nmap gcc guu~l
vmap gc gu~l
else
nmap gcw guw~h
nmap gcW guW~h
nmap gciw guiw~h
nmap gciW guiW~h
nmap gcis guis~h
nmap gc$ gu$~h
nmap gcgc guu~h
nmap gcc guu~h
vmap gc gu~h
endif
"copy directly to clipboard
set clipboard=unnamed
"copy directly to clipboard vi-mode
":set go+=a
"jsbeautify
let g:jsbeautify = {"indent_size": 4, "indent_char": "\t"}
"snipMate
"let g:snips_trigger_key='<C-space>'
let g:snipMate = {}
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['js'] = 'javascript.snippets,javascript_jquery'
" Make shift-insert work like in Xterm
map <S-Insert> <MiddleMouse>
map! <S-Insert> <MiddleMouse>