-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
218 lines (184 loc) · 4.7 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
let g:pathogen_disabled = ['lusty', 'csapprox']
call pathogen#infect()
call pathogen#helptags()
set mouse=a
syntax enable
set nobackup
set noswapfile
set pastetoggle=<F3>
set t_Co=256
set number
set nofoldenable
set laststatus=2
set autoread
set scrolloff=3
set cul
set wildmenu
set wildmode=list:longest
" System default for mappings is now the "," character
let mapleader = ","
" search
set ignorecase
set smartcase
set hlsearch
set tags=tags;/
" indenting
set smartindent
set tabstop=4
set shiftwidth=4
filetype plugin indent on
" buffers
set autowrite
set hidden
" Wipe out all buffers
nmap <silent> <Leader>wa :1,9000bwipeout<cr>
nmap <Leader>da ggdG
map <C-j> :bprev<CR>
map <C-k> :bnext<CR>
" bindings
nnoremap ; :
vnoremap ; :
map <Leader>' :b#<CR>
map <C-C> "+y
map <C-A> <ESC>ggVG
nmap <silent> ,/ :set hlsearch!<CR>
map <Leader>M :%s/<C-V><C-M>//g<CR>
map <Leader>ff :let @+=expand('%:t')<CR>:echo expand('%:t')<CR>
map <Leader>fr :let @+=expand('%')<CR>:echo expand('%')<CR>
map <Leader>fp :let @+=expand('%:p')<CR>:echo expand('%:p')<CR>
map <Leader>sc <ESC>:Scratch<CR>
" Edit common files
nmap <silent> <Leader>ev :e $MYVIMRC<CR>
nmap <silent> <Leader>sv :so $MYVIMRC<CR>
nmap <silent> <Leader>ssh :e ~/.ssh/config<CR>
nmap <silent> <Leader>bash :e ~/.bash_profile<CR>
" toggle between number and relative number on ,l
nnoremap <Leader>l :call ToggleRelativeAbsoluteNumber()<CR>
function! ToggleRelativeAbsoluteNumber()
if &number
set relativenumber
else
set number
endif
endfunction
" Try jj for esc
imap jj <esc>
" comments
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" quickfix
map <Leader>qq <ESC>:cw<CR>
map <Leader>qc <ESC>:ccl<CR>
map <Leader>q] <ESC>:cn<CR>
map <Leader>q[ <ESC>:cp<CR>
" move lines
nmap <C-Up> ddkP
nmap <C-Down> ddp
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
" wrap
map <Leader>wr <ESC>:set wrap!<CR>
" list whitespace
map <Leader>ww :set list!<CR>
set listchars=tab:▸\ ,eol:¬
" make up/down go to next row in editor instead of next line
nnoremap j gj
nnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
" sudo write this
cmap W! w !sudo tee % >/dev/null
"Markdown to HTML
nmap <Leader>md :%!/usr/local/bin/Markdown.pl --html4tags <CR>
" Nerd Tree
map <F2> :NERDTreeToggle<CR>
let g:NERDTreeWinSize = 25
" Nerd Commenter
let NERDCreateDefaultMappings = 0
nmap <Leader>c <Plug>NERDCommenterToggle
vmap <Leader>c <Plug>NERDCommenterToggle
" Tabs
map <Leader>wt <C-W>T
map <Leader>tc :tabc<CR>
map <Leader>te :tabe
map <Leader>to :tabo<CR>
map <M-]> gt
map <M-[> gT
map <M-1> 1gt
map <M-2> 2gt
map <M-3> 3gt
map <M-4> 4gt
map <M-5> 5gt
map <M-0> :tablast<CR>
" php folding with PHPDoc support
let g:DisableAutoPHPFolding = 1
map <F6> <Esc>:EnableFastPHPFolds<CR>
" taglist
map <F8> :TagbarToggle<CR>
let g:tagbar_autofocus = 1
" pdv - PHPDocumenter
imap <Leader>d <ESC>:call PhpDocSingle()<CR>i
nmap <Leader>d :call PhpDocSingle()<CR>
vmap <Leader>d :call PhpDocRange()<CR>
" CtrlP
let g:ctrlp_root_markers = ['.root-dir']
let g:ctrlp_working_path_mode = 2
map <C-B> :CtrlPBuffer<CR>
" Syntastic
let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes' : ['php'] }
let g:syntastic_auto_jump = 1
let g:syntastic_auto_loc_list = 1
let s:php_executable = 'php'
" Easy Motion
hi link EasyMotionTarget ErrorMsg
hi link EasyMotionShade Comment
" SuperTab
let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabClosePreviewOnPopupClose = 1
" Color Scheme
set background=dark
let g:solarized_termtrans=1
let g:solarized_termcolors=256
let g:solarized_contrast="high"
let g:solarized_visibility="high"
colorscheme solarized
function HtmlEscape()
silent s/&/\&/eg
silent s/</\</eg
silent s/>/\>/eg
silent s/“/\“/eg
silent s/”/\”/eg
silent s/™/\™/eg
silent s/®/\®/eg
silent s/©/\©/eg
silent s/‘/\‘/eg
silent s/’/\’/eg
silent s/–/\–/eg
silent s/—/\—/eg
endfunction
function HtmlUnEscape()
silent s/&/\&/eg
silent s/</</eg
silent s/>/>/eg
silent s/“/“/eg
silent s/”/”/eg
silent s/™/™/eg
silent s/®/®/eg
silent s/©/©/eg
silent s/‘/‘/eg
silent s/’/’/eg
silent s/–/–/eg
silent s/—/—/eg
endfunction
nnoremap <silent> <Leader>h :call HtmlEscape()<CR>
nnoremap <silent> <Leader>H :call HtmlUnEscape()<CR>
vnoremap <silent> <Leader>h :call HtmlEscape()<CR>
vnoremap <silent> <Leader>H :call HtmlUnEscape()<CR>
" Start NERDTree on launch and focus file
"autocmd VimEnter * NERDTree
"autocmd BufEnter * NERDTreeMirror
"autocmd VimEnter * wincmd w
" Examples
" language specific setting
" autocmd filetype python set expandtab
" PHP
"autocmd FileType php setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4