-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
285 lines (230 loc) · 6.58 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
let mapleader = "\\"
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
Bundle 'gmarik/vundle'
" Colours
Bundle 'chriskempson/base16-vim'
" File Navigation
Bundle 'scrooloose/nerdtree'
Bundle 'jistr/vim-nerdtree-tabs'
Bundle 'mileszs/ack.vim'
" Syntaxs
Bundle 'stephpy/vim-yaml'
Bundle 'lumiliet/vim-twig'
Bundle 'tobyS/vmustache'
Bundle 'leafgarland/typescript-vim'
Bundle 'ekalinin/dockerfile.vim'
Bundle 'pangloss/vim-javascript'
Bundle 'mxw/vim-jsx'
" PHP Help
Bundle 'arnaud-lb/vim-php-namespace'
Bundle 'tobyS/pdv'
" Helpers
Bundle 'scrooloose/nerdcommenter'
Bundle 'editorconfig/editorconfig-vim'
Bundle 'tpope/vim-surround'
Bundle 'mattn/emmet-vim'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-rhubarb'
Bundle 'tpope/tpope-vim-abolish'
Bundle 'craigemery/vim-autotag'
Bundle 'kristijanhusak/vim-carbon-now-sh'
Bundle 'prakashdanish/vim-githubinator'
" Setup fzf
set rtp+=/usr/local/opt/fzf
set hidden
set history=1000
set wildmenu
set noswapfile
set nobackup
set nowb
set rnu
set relativenumber number
syntax on
filetype plugin indent on
au BufNewFile,BufRead *.tpl setlocal ft=html.twig
au BufNewFile,BufRead *.twig.html setlocal ft=html.twig
"set nohlsearch
set hlsearch
"set incsearch
nmap <silent> <space> :silent :nohlsearch<CR>
"set listchars=tab:>-,trail:·,eol:$
"nmap <silent> <leader>w :set nolist!<CR>
set visualbell
set expandtab " tabs to spaces
set tabstop=4 " 4 spaces to a tab
set shiftwidth=4 " 4 spaces to a tab
set softtabstop=4
set smarttab
set autoindent
set showmatch
set smartindent
set backspace=indent,eol,start
set complete-=i
set smarttab
set nrformats-=octal
set incsearch
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
endif
set ruler
set showcmd
if v:version > 703 || v:version == 703 && has("patch541")
set formatoptions+=j " Delete comment character when joining commented lines
endif
set encoding=utf8
let base16colorspace=256 " Access colors present in 256 colorspace"
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors"
execute "set background=".$BACKGROUND
execute "colorscheme ".$THEME
" color codeschool
" set background=dark
" let g:molokai_original=1
" colorscheme molokai
" colorscheme gotham
if has("gui_running")
let g:NERDTreeHijackNetrw=0
"set transparency=0
" Remove the toolbar and menu bar
set guioptions-=T
set guioptions-=m
" Map command-[ and command-] to indenting or outdenting
" while keeping the original selection in visual mode
vmap <D-]> >gv
vmap <D-[> <gv
nmap <D-]> >>
nmap <D-[> <<
omap <D-]> >>
omap <D-[> <<
imap <D-]> <Esc>>>i
imap <D-[> <Esc><<i
else
" Map command-[ and command-] to indenting or outdenting
" while keeping the original selection in visual mode
vmap <A-]> >gv
vmap <A-[> <gv
nmap <A-]> >>
nmap <A-[> <<
omap <A-]> >>
omap <A-[> <<
imap <A-]> <Esc>>>i
imap <A-[> <Esc><<i
endif
if has('mouse')
set mouse=a
if &term =~ "xterm" || &term =~ "screen"
" as of March 2013, this works:
set ttymouse=xterm2
" previously, I found that ttymouse was getting reset, so had
" to reapply it via an autocmd like this:
autocmd VimEnter,FocusGained,BufEnter * set ttymouse=xterm2
endif
endif
nmap <leader>s :set list!<CR>
inoremap {<cr> {<cr>}<c-o>O
inoremap [<cr> [<cr>]<c-o>O
inoremap (<cr> (<cr>)<c-o>O
imap <F3> <C-R>=strftime("%I:%M:%S")<CR>
" CtrlP Settings
"let g:ctrlp_map = '<leader>t'
set wildignore+=app/cache/*,vendor/*,nbproject/*,*~,node_modules/*
set wildignore+=*/app/cache/*,*/vendor/*,*/nbproject/*,*/node_modules/*
set wildignore+=*sass-cache*
set wildignore+=*DS_Store*
set wildignore+=tmp/**
set wildignore+=log/**
set wildignore+=*.png,*.jpg,*.gif,*.pdf,*.eot,*.ttf,*.woff
set wildignore+=*sess_*
set wildignore+=node_modules/*
" FZF Settings
nnoremap <C-p> :<C-u>FZF<CR>
nnoremap <leader>t :<C-u>FZF<CR>
" NerdTree settings
nmap <silent> <leader>\ :NERDTreeTabsToggle<CR>
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let g:NERDTreeWinSize = 30
let NERDTreeIgnore = ['\.pyc$']
" split navigation
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-h> <C-w>h
nmap <C-l> <C-w>l
function! MarkWindowSwap()
let g:markedWinNum = winnr()
endfunction
function! DoWindowSwap()
"Mark destination
let curNum = winnr()
let curBuf = bufnr( "%" )
exe g:markedWinNum . "wincmd w"
"Switch to source and shuffle dest->source
let markedBuf = bufnr( "%" )
"Hide and open so that we aren't prompted and keep history
exe 'hide buf' curBuf
"Switch to dest and shuffle source->dest
exe curNum . "wincmd w"
"Hide and open so that we aren't prompted and keep history
exe 'hide buf' markedBuf
endfunction
nmap <silent> <leader>mw :call MarkWindowSwap()<CR>
nmap <silent> <leader>pw :call DoWindowSwap()<CR>
" window
nmap <leader>swh :topleft vnew<CR>
nmap <leader>swl :botright vnew<CR>
nmap <leader>swk :topleft new<CR>
nmap <leader>swj :botright new<CR>
" buffer
nmap <leader>sh :leftabove vnew<CR>
nmap <leader>sl :rightbelow vnew<CR>
nmap <leader>sk :leftabove new<CR>
nmap <leader>sj :rightbelow new<CR>
inoremap <Leader>u <C-O>:call PhpInsertUse()<CR>
noremap <Leader>u :call PhpInsertUse()<CR>
let g:easytags_async = 1
let g:pdv_template_dir = $HOME ."/.vim/bundle/pdv/templates_snip"
nnoremap <buffer> <leader>pd :call pdv#DocumentWithSnip()<CR>
" Toggle spell check
nmap <leader>ss :setlocal spell!<CR>
nnoremap <Leader>r :%s/\<<C-r><C-w>\>/
nmap <silent> <leader>cc <Plug>NERDCommenterToggle
set showtabline=2 " always show tabs in gvim, but not vim
" set up tab labels with tab number, buffer name, number of windows
function! GuiTabLabel()
let label = ''
let bufnrlist = tabpagebuflist(v:lnum)
" Add '+' if one of the buffers in the tab page is modified
for bufnr in bufnrlist
if getbufvar(bufnr, "&modified")
let label = '+'
break
endif
endfor
" Append the tab number
let label .= v:lnum.': '
" Append the buffer name
let name = bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
if name == ''
" give a name to no-name documents
if &buftype=='quickfix'
let name = '[Quickfix List]'
else
let name = '[No Name]'
endif
else
" get only the file name
let name = fnamemodify(name,":t")
endif
let label .= name
" Append the number of windows in the tab page
let wincount = tabpagewinnr(v:lnum, '$')
return label . ' [' . wincount . ']'
endfunction
set guitablabel=%{GuiTabLabel()}
" ack.vim configuration
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
let g:move_key_modifier = 'm'