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 | set nocompatible " be iMproved
filetype plugin indent on " required!
set rtp+=~/vimfiles/bundle/vundle/
call vundle#rc()
let g:vundle_default_git_proto = 'git'
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
" original repos on github
Bundle 'bling/vim-airline'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'vim-scripts/Vimtodo'
Bundle 'molokai'
Bundle 'oblitum/rainbow'
Bundle 'vimwiki/vimwiki'
Bundle 'chriskempson/vim-tomorrow-theme'
Bundle 'sk1418/last256'
Bundle 'kshenoy/vim-signature'
Bundle 'rking/ag.vim'
Bundle 'xolox/vim-misc'
Bundle 'w0ng/vim-hybrid'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-commentary'
Bundle 'tmhedberg/matchit'
" map copy/paste
map <Leader>p "+p
map <Leader>y "+y
set clipboard=unnamed
cnoremap <c-v> <c-r>+
" search
set hlsearch
set incsearch
set number
set ignorecase
vmap // y/\V<C-R>"<CR>
set scrolloff=5
" Navigate 4x faster when holding down Ctrl
nmap <c-j> 4j
nmap <c-k> 4k
nmap <c-h> 4h
nmap <c-l> 4l
imap <TAB> <C-N>
" ctags
"nnoremap <C-S-]> :ts<CR>
" Jump to matching pairs easily, with Tab
"nnoremap <Tab> %
"vnoremap <Tab> %
" remap :
nnoremap ; :
" set spelling
"setlocal spell spelllang=en_us
nmap <silent> <leader>s :set spell!<CR>
map <silent> <leader>S z=
set sps=best,10
" set the locaiton for swp files
set directory=e:\personal
set backupdir=e:\personal
" flashes matching brackets or parentheses
set showmatch
" Fix for legacy vi inconsistency
map Y y$
syntax on
"colorscheme Tomorrow
colorscheme hybrid
if &diff
colorscheme hybrid
set lines=999 columns=999
unmap <c-j>
unmap <c-k>
nmap <c-j> ]c
nmap <c-k> [c
endif
" terminal color
if &term =~ "xterm"
"256 color --
let &t_Co=256
" restore screen after quitting
set t_ti=ESC7ESC[rESC[?47h t_te=ESC[?47lESC8
if has("terminfo")
let &t_Sf="\ESC[3%p1%dm"
let &t_Sb="\ESC[4%p1%dm"
else
let &t_Sf="\ESC[3%dm"
let &t_Sb="\ESC[4%dm"sjl/gundo.vim
endif
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Display extra whitespace
set list listchars=tab:»·,trail:·
set autoindent
set smartindent
set smarttab
set shiftwidth=2
set softtabstop=2
set tabstop=2
set expandtab
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
" set the language
set langmenu=none
" set visual bell -- i hate that damned beeping
set vb
" set history length
set history=700
" disable the menu
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
" show the current line
set cul
" set the font
set guifont=Consolas:h11
" show the filename in the bottom of the window
set modeline
set ls=2
" rainbow conf
au FileType c,r,xdm,m4,cpp,objc,objcpp call rainbow#load()
" search for tags in the current directory then one up until the tags are
" found
set tags=tags;/
" Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" window navigation
nmap <silent> <A-k> :wincmd k<CR>
nmap <silent> <A-j> :wincmd j<CR>
nmap <silent> <A-h> :wincmd h<CR>
nmap <silent> <A-l> :wincmd l<CR>
" resize windows
nmap <silent> <S-k> :resize +5<CR>
nmap <silent> <S-j> :resize -5<CR>
nmap <silent> <S-h> :vertical resize +5<CR>
nmap <silent> <S-l> :vertical resize -5<CR>
" show the column
nnoremap <silent> <Leader>c :silent set colorcolumn=100<CR>:set colorcolumn?<CR>
nnoremap <silent> <Leader>C :silent set colorcolumn=<CR>:set colorcolumn?<CR>
" allow backspacing over everything in insert-mode
set backspace=indent,eol,start
" Remap VIM 0 to first non-blank character
map 0 ^
au BufNewFile,BufRead *.xdm set filetype=xml
au BufNewFile,BufRead *.xdm.m4 setlocal filetype=xml
au BufNewFile,BufRead *.c.m4 set filetype=c
" Ag
let g:agprg="ag -i -p path.agignore --search-binary"
let g:aghighlight=1
let g:agformat="%f:%l:%m"
nnoremap <F3> :cnext<CR>
nnoremap <F2> :cprevious<CR>
nnoremap <Leader>e :Ag! <C-R>=GetRootPath()<CR><C-Left><Left>
nnoremap <Leader>r :Ag! <C-R><C-W> <C-R>=GetRootPath()<CR><CR>
nnoremap <Leader>E :AgFile! <C-R>=GetRootPath()<CR><C-Left><Left>
nnoremap <Leader>d :call DiffTilComit()<CR>
function! GetRootPath()
let path_2 = expand("%:p:h")
" deleted
return path_1
endfunction
function! DiffTilComit()
let path_1 = expand("%:t")
let path_2 = expand("%:p:h").'\.svn\text-base\'.path_1.'.svn-base'
let path_3 = expand("%:p:h").'\'.path_1
exe 'tabnew '.path_3
exe 'vert diffsplit '.path_2
endfunction
" toggle between number and relativenumber
function! ToggleNumber()
if(&relativenumber == 1)
set norelativenumber
set number
else
set relativenumber
endif
endfunc
nnoremap <F10> :call ToggleNumber()<cr>
" strips trailing whitespace at the end of files. this
" is called on buffer write in the autogroup above.
function! StripTrailingWhitespaces()
" save last search & cursor position
let _s=@/
let l = line(".")
let c = col(".")
%s/\s\+$//e
let @/=_s
call cursor(l, c)
endfunction
nnoremap <Leader>st :call StripTrailingWhitespaces()<cr>
" autoreload $MYVIMRC
augroup reload_vimrc " {
autocmd!
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup END " }
nnoremap b] :bnext<CR>
nnoremap b[ :bprevious<CR>
nnoremap <Leader><Leader>n :silent !"C:\Program Files (x86)\Notepad++\notepad++.exe" %:p<CR><CR>
set autoread
augroup project
autocmd!
autocmd BufRead,BufNewFile *.h,*.c,*.m4 set filetype=c.doxygen
augroup END
let &path.="C:\Projects\trunk,"
vmap v <Plug>(expand_region_expand)
vmap <C-v> <Plug>(expand_region_shrink)
"I search things usual way using /something
"I hit cs, replace first match, and hit <Esc>
"I hit n.n.n.n.n. reviewing and replacing all matches
vnoremap <silent> s //e<C-r>=&selection=='exclusive'?'+1':''<CR><CR>
\:<C-u>call histdel('search',-1)<Bar>let @/=histget('search',-1)<CR>gv
omap s :normal vs<CR>
" set the curent directory
set autochdir
" Return to last edit position (You want this!) [N]
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
au FileType qf call AdjustWindowHeight(3, 15)
function! AdjustWindowHeight(minheight, maxheight)
let l = 1
let n_lines = 0
let w_width = winwidth(0)
while l <= line('$')
" number to float for division
let l_len = strlen(getline(l)) + 0.0
let line_width = l_len/w_width
let n_lines += float2nr(ceil(line_width))
let l += 1
endw
exe max([min([n_lines, a:maxheight]), a:minheight]) . "wincmd _"
endfunction
" sync scroll
nnoremap <Leader>sw :set scb!<CR>
"fullscreen
function! ToggleFullScreen()
if has('win32')
:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)
endif
endfunction
" for quickfix set nowrap
au FileType qf set nowrap
" ignore .svn in newtr
let g:netrw_list_hide= '.*\.svn$'
|
x