-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
334 lines (294 loc) · 13 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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
let mapleader = "\<Space>"
nnoremap <Leader>w :w<CR>
vmap <Leader>y "+y
vmap <Leader>d "+d
nmap <Leader>p "+p
nmap <Leader>P "+P
vmap <Leader>p "+p
vmap <Leader>P "+P
nmap <Leader><Leader> V
vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)
map <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>
nmap <Leader>f <C-f>
nmap <Leader>b <C-b>
"
" Modeline and Notes {
" vim: set foldmarker={,} foldlevel=0 spell:
"
" This is my personal .vimrc, I don't recommend you copy it, just
" use the " pieces you want(and understand!). When you copy a
" .vimrc in its entirety, weird and unexpected things can happen.
"
" If you find an obvious mistake hit me up at:
" http://robertmelton.com/contact (many forms of communication)
" }
"cabbr <expr> %% expand('%:p:h')
" Basics {
set nocompatible " explicitly get out of vi-compatible mode
set noexrc " don't use local version of .(g)vimrc, .exrc
set background=dark " we plan to use a dark background
set cpoptions=aABceFsmq
" |||||||||
" ||||||||+-- When joining lines, leave the cursor
" ||||||| between joined lines
" |||||||+-- When a new match is created (showmatch)
" |||||| pause for .5
" ||||||+-- Set buffer options when entering the
" ||||| buffer
" |||||+-- :write command updates current file name
" ||||+-- Automatically add <CR> to the last line
" ||| when using :@r
" |||+-- Searching continues at the end of the match
" || at the cursor position
" ||+-- A backslash has no special meaning in mappings
" |+-- :write updates alternative file name
" +-- :read updates alternative file name
syntax on " syntax highlighting on
" }
" General {
filetype plugin indent on " load filetype plugins/indent settings
"set autochdir " always switch to the current file directory
set backspace=indent,eol,start " make backspace a more flexible
set backup " make backup files
set backupdir=~/.vim/backup " where to put backup files
set clipboard+=unnamed " share windows clipboard
set directory=~/.vim/tmp " directory to place swap files in
set fileformats=unix,dos,mac " support all three, in this order
set hidden " you can change buffers without saving
" (XXX: #VIM/tpope warns the line below could break things)
set iskeyword+=_,$,@,%,# " none of these are word dividers
set mouse=a " use mouse everywhere
set noerrorbells " don't make noise
set whichwrap=b,s,h,l,<,>,~,[,] " everything wraps
" | | | | | | | | |
" | | | | | | | | +-- "]" Insert and Replace
" | | | | | | | +-- "[" Insert and Replace
" | | | | | | +-- "~" Normal
" | | | | | +-- <Right> Normal and Visual
" | | | | +-- <Left> Normal and Visual
" | | | +-- "l" Normal and Visual (not recommended)
" | | +-- "h" Normal and Visual (not recommended)
" | +-- <Space> Normal and Visual
" +-- <BS> Normal and Visual
set wildmenu " turn on command line completion wild style
" ignore these list file extensions
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,
\*.jpg,*.gif,*.png
set wildmode=list:longest " turn on wild mode huge list
" }
" Vim UI {
set cursorcolumn " highlight the current column
set cursorline " highlight current line
set incsearch " BUT do highlight as you type you
" search phrase
set laststatus=2 " always show the status line
set lazyredraw " do not redraw while running macros
set linespace=0 " don't insert any extra pixel lines
" betweens rows
set list " we do what to show tabs, to ensure we get them
" out of my files
set listchars=tab:>-,trail:- " show tabs and trailing
set matchtime=5 " how many tenths of a second to blink
" matching brackets for
set nohlsearch " do not highlight searched for phrases
set nostartofline " leave my cursor where it was
set novisualbell " don't blink
set number " turn on line numbers
set numberwidth=5 " We are good up to 99999 lines
set report=0 " tell us when anything is changed via :...
set ruler " Always show current positions along the bottom
set scrolloff=10 " Keep 10 lines (top/bottom) for scope
set shortmess=aOstT " shortens messages to avoid
" 'press a key' prompt
set showcmd " show the command being typed
set showmatch " show matching brackets
set sidescrolloff=10 " Keep 5 lines at the size
set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
" | | | | | | | | | | |
" | | | | | | | | | | + current
" | | | | | | | | | | column
" | | | | | | | | | +-- current line
" | | | | | | | | +-- current % into file
" | | | | | | | +-- current syntax in
" | | | | | | | square brackets
" | | | | | | +-- current fileformat
" | | | | | +-- number of lines
" | | | | +-- preview flag in square brackets
" | | | +-- help flag in square brackets
" | | +-- readonly flag in square brackets
" | +-- rodified flag in square brackets
" +-- full path to file in the buffer
" }
" Text Formatting/Layout {
"set completeopt= " don't use a pop up menu for completions
set expandtab " no real tabs please!
set formatoptions=rq " Automatically insert comment leader on return,
" and let gq format comments
set ignorecase " case insensitive by default
set infercase " case inferred by default
set nowrap " do not wrap line
set shiftround " when at 3 spaces, and I hit > ... go to 4, not 5
set smartcase " if there are caps, go case-sensitive
set shiftwidth=4 " auto-indent amount when using cindent,
" >>, << and stuff like that
set softtabstop=4 " when hitting tab or backspace, how many spaces
" should a tab be (see expandtab)
set tabstop=4
"set tabstop=8 " real tabs should be 8, and they will show with
"" set list on
" }
"" Folding {
"set foldenable " Turn on folding
"set foldmarker={,} " Fold C style code (only use this as default
"" if you use a high foldlevel)
"set foldmethod=marker " Fold on the marker
"set foldlevel=100 " Don't autofold anything (but I can still
"" fold manually)
"set foldopen=block,hor,mark,percent,quickfix,tag " what movements
"" open folds
"function SimpleFoldText() " {
"return getline(v:foldstart).' '
"endfunction " }
"set foldtext=SimpleFoldText() " Custom fold text function
"" (cleaner than default)
"" }
"" Plugin Settings {
"let b:match_ignorecase = 1 " case is stupid
"let perl_extended_vars=1 " highlight advanced perl vars
"" inside strings
"" TagList Settings {
"let Tlist_Auto_Open=0 " let the tag list open automagically
"let Tlist_Compact_Format = 1 " show small menu
"let Tlist_Ctags_Cmd = 'ctags' " location of ctags
"let Tlist_Enable_Fold_Column = 0 " do show folding tree
"let Tlist_Exist_OnlyWindow = 1 " if you are the last, kill
"" yourself
"let Tlist_File_Fold_Auto_Close = 0 " fold closed other trees
"let Tlist_Sort_Type = "name" " order by
"let Tlist_Use_Right_Window = 1 " split to the right side
"" of the screen
"let Tlist_WinWidth = 40 " 40 cols wide, so i can (almost always)
"" read my functions
"" Language Specifics {
"" just functions and classes please
"let tlist_aspjscript_settings = 'asp;f:function;c:class'
"" just functions and subs please
"let tlist_aspvbs_settings = 'asp;f:function;s:sub'
"" don't show variables in freaking php
"let tlist_php_settings = 'php;c:class;d:constant;f:function'
"" just functions and classes please
"let tlist_vb_settings = 'asp;f:function;c:class'
"" }
"" }
"" }
" Mappings {
" ROT13 - fun
map <F12> ggVGg?
" space / shift-space scroll in normal mode
"nnoremap <C-space> <C-f>
"nnoremap <S-space> <C-b>
" Make Arrow Keys Useful Again {
map <down> <ESC>:bn<RETURN>
map <left> <ESC>:NERDTreeToggle<RETURN>
map <right> <ESC>:Tlist<RETURN>
map <up> <ESC>:bp<RETURN>
" }
" }
"" Autocommands {
"" Ruby {
"" ruby standard 2 spaces, always
"au BufRead,BufNewFile *.rb,*.rhtml set shiftwidth=2
"au BufRead,BufNewFile *.rb,*.rhtml set softtabstop=2
"" }
"" Notes {
"" I consider .notes files special, and handle them differently, I
"" should probably put this in another file
"au BufRead,BufNewFile *.notes set foldlevel=2
"au BufRead,BufNewFile *.notes set foldmethod=indent
"au BufRead,BufNewFile *.notes set foldtext=foldtext()
"au BufRead,BufNewFile *.notes set listchars=tab:\ \
"au BufRead,BufNewFile *.notes set noexpandtab
"au BufRead,BufNewFile *.notes set shiftwidth=8
"au BufRead,BufNewFile *.notes set softtabstop=8
"au BufRead,BufNewFile *.notes set tabstop=8
"au BufRead,BufNewFile *.notes set syntax=notes
"au BufRead,BufNewFile *.notes set nocursorcolumn
"au BufRead,BufNewFile *.notes set nocursorline
"au BufRead,BufNewFile *.notes set guifont=Consolas:h12
"au BufRead,BufNewFile *.notes set spell
"" }
"au BufNewFile,BufRead *.ahk setf ahk
"" }
"" GUI Settings {
"if has("gui_running")
"" Basics {
""colorscheme metacosm " my color scheme (only works in GUI)
"colorscheme desert " my color scheme (only works in GUI)
""set columns=210 " perfect size for me
"set columns=200 " perfect size for me
""set guifont=Consolas:h10 " My favorite font
"set guioptions=ce
"" ||
"" |+-- use simple dialogs rather than pop-ups
"" + use GUI tabs, not console style tabs
"set lines=90 " perfect size for me
"set mousehide " hide the mouse cursor when typing
"" }
"" Font Switching Binds {
""map <F8> <ESC>:set guifont=Consolas:h8<CR>
""map <F9> <ESC>:set guifont=Consolas:h10<CR>
""map <F10> <ESC>:set guifont=Consolas:h12<CR>
""map <F11> <ESC>:set guifont=Consolas:h16<CR>
""map <F12> <ESC>:set guifont=Consolas:h20<CR>
"" }
"endif
"" }
map <F2> <ESC>:Ggrep <C-R><C-W><RETURN> :cope<RETURN>
map <F3> <ESC>:cn <RETURN>
map <F4> <ESC>:cp <RETURN>
map <F5> <ESC>:Ggrep <C-R><C-W> %<RETURN> :cope<RETURN>
execute pathogen#infect()
"============CtrlP============
set runtimepath^=~/.vim/bundle/ctrlp.vim
" map fuzzyfinder (CtrlP) plugin
" nmap <silent> <leader>t :CtrlP<cr>
nmap <silent> <leader>r :CtrlPBuffer<cr>
let g:ctrlp_map='<leader>t'
let g:ctrlp_dotfiles=1
let g:ctrlp_working_path_mode = 'ra'
nnoremap <Leader>o :CtrlP<CR>
" CtrlP ignore patterns
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|node_modules$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$'
\ }
" search the nearest ancestor that contains .git, .hg, .svn
let g:ctrlp_working_path_mode = 2
"============CtrlP end============
let g:EasyMotion_do_mapping = 0 " Disable default mappings
" Bi-directional find motion
" Jump to anywhere you want with minimal keystrokes, with just one key binding.
" `s{char}{label}`
nmap s <Plug>(easymotion-s)
" or
" `s{char}{char}{label}`
" Need one more keystroke, but on average, it may be more comfortable.
" nmap s <Plug>(easymotion-s2)
" Turn on case insensitive feature
let g:EasyMotion_smartcase = 1
" JK motions: Line motions
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
" Gif config
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
" These `n` & `N` mappings are options. You do not have to map `n` & `N` to EasyMotion.
" Without these mappings, `n` & `N` works fine. (These mappings just provide
" different highlight method and have some other features )
"map n <Plug>(easymotion-next)
"map N <Plug>(easymotion-prev)
" steal ; in normal mode
nnoremap ; :
set noscrollbind