syntax on
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set backspace=indent,eol,start
set ignorecase
set smartcase
set magic
set wrapscan
set hlsearch
set smartcase
set nowrap
set nolinebreak
set textwidth=0
set formatoptions=q
set ambiwidth=double
set nonu
set title
set showmatch
set matchtime=2
set incsearch
set wildmenu wildmode=list:full
set laststatus=2
set statusline=%<%f\ %m%r%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l/%L,%v
set whichwrap=b,s,[,],<,>,~
let html_use_css=1
let html_use_encoding="utf-8"
let s:quickfixwindow = "close"
function! b:openCloseQuickfix()
if "open" ==? s:quickfixwindow
let s:quickfixwindow = "close"
cclose
else
let s:quickfixwindow = "open"
copen
endif
endfunction
nmap ,j :call b:openCloseQuickfix()
nmap <F9> [c<CR>
nmap <F10> ]c<CR>
nmap <F11> :diffget<CR>
nmap <F12> :diffput<CR>
au BufEnter * execute ":lcd " . expand("%:p:h")
augroup Binary
au!
au BufReadPre *.bin let &bin=1
au BufReadPost *.bin if &bin | %!xxd
au BufReadPost *.bin set ft=xxd | endif
au BufWritePre *.bin if &bin | %!xxd -r
au BufWritePre *.bin endif
au BufWritePost *.bin if &bin | %!xxd
au BufWritePost *.bin set nomod | endif
augroup END
vnoremap < <gv
vnoremap > >gv
nmap ,3 :colder<CR>
nmap ,4 :cnewer<CR>
nmap ,l :ls<CR>
nmap ,, :bp<CR>
nmap ,. :bn<CR>
nmap <C-o> :args<CR>
nmap <C-s> :wa<CR>
imap <C-s> <esc> :wa<CR>
nmap ,e :e .<CR>
nmap <F7> :e .<CR>
nmap ,d :bd<CR>
nmap ,n :set number!<CR>
nmap ,h :nohl<CR>
"[a-z]y / "
nmap ,f :reg<CR>
nmap ,m :marks<CR>
nnoremap ,s :wincmd s<CR>
nnoremap ,v :wincmd v<CR>
nnoremap ,w :wincmd w<CR>
nnoremap ,o :wincmd o<CR>
nnoremap ,q :q<CR>
nnoremap ,p :pwd<CR>
nnoremap ,f <PageDown>
nnoremap ,b <PageUp>
colorscheme koehler
highlight Comment term=standout ctermfg=2 gui=bold guifg=Green
highlight Constant term=standout ctermfg=2 gui=bold guifg=DarkRed
highlight Search term=standout cterm=none ctermfg=0 ctermbg=7 guifg=Blue guibg=Yellow
highlight Special term=reverse ctermfg=6 ctermbg=0 guifg=Red guibg=Black
highlight Type term=reverse ctermfg=6 ctermbg=0 guifg=Red guibg=Black
highlight PreProc term=reverse ctermfg=6 ctermbg=0 guifg=Red guibg=Black
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
nmap ,k :set list!<CR>
set listchars=tab:>\ ,trail:^,eol:$
set noswapfile
set nobackup
set formatoptions-=ro
augroup vimrc_group_formatoptions
autocmd!
autocmd FileType * setlocal formatoptions-=ro
augroup END
nnoremap j gj
nnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
nnoremap j jzz
nnoremap k kzz
nmap n nzz
nmap N Nzz
imap <c-k> <esc>
nmap <c-z> <c-a>
nmap ,@ :w !sudo tee % > /dev/null<CR>
vnoremap <C-C> "+y
set clipboard+=unnamed
nnoremap <leader>e <C-w><C-v><C-l>:e ~/_vimrc<CR>
nnoremap <leader>r :source ~/_vimrc<CR>
noremap <C-Tab> <C-W>w
inoremap <C-Tab> <C-O><C-W>w
cnoremap <C-Tab> <C-C><C-W>w
onoremap <C-Tab> <C-C><C-W>w
function! b:CdCurrentPath()
execute ":cd %:h"
endfunction
nmap ,9 :call b:CdCurrentPath()<CR>
function! b:CdBufferPath(arg)
execute ":cd #".a:arg.":p:h"
endfunction
nmap ,8 :ls<CR>:call b:CdBufferPath("")<LEFT><LEFT>
nmap <F5> :set errorformat=%f:%l:%m<CR>:cf %<CR>:cope<CR>
nmap <F6> :set errorformat=%.%#\ %l\ %H%f\ %#%m<CR>:cf %<CR>:cope<CR>
nmap <F1> :Gtags -g <C-R><C-W><CR>
nmap <F2> <C-W>v:GtagsCursor<CR>
nmap <F3> :Gtags -r <C-R><C-W><CR>
"s/\s*\([0-9]*\)\t\(.*\)/[\1] \2/"
"s/\s*\([0-9]*\)\t\(.*\)/[\1] \2/"
augroup BUFWRITE_POSTDELETE
au!
autocmd BufWritePost * call BufWritePostDelete()
augroup END
function! BufWritePostDelete()
let crlen = 0
if &binary == 0
let crlen = &ff == 'dos' ? 2 : 1
endif
if getfsize(expand('%:p')) <= crlen
call delete(expand('%:p'))
endif
endfunction
nnoremap <silent> * yiw:<C-u>call MySetSearch('""yiw', 'word')<CR>:let &hlsearch=&hlsearch<CR>
vnoremap <silent> * yiw:<C-u>call MySetSearch('""vgvy')<CR>:let &hlsearch=&hlsearch<CR>
function! MySetSearch(cmd, ...)
let saved_reg = @"
if a:cmd != ''
silent exec 'normal! '.a:cmd
endif
let pattern = escape(@", '\\/.*$^~[]')
let pattern = substitute(pattern, '\n$', '','')
if a:0 > 0
let pattern = '\<'.pattern.'\>'
endif
let @/ = pattern
let @" = saved_reg
endfunction
nnoremap go :<C-u>call append('.', '')<CR>
nnoremap gO :normal! O<ESC>j
nmap <C-d> :q<CR>
"Test$"
":silent !/usr/bin/g++ -c "
":silent !/usr/bin/g++ "
":!/opt/local/bin/clear; ./a.out"
":silent !/usr/bin/g++ -c "
":silent !/usr/bin/g++ "
":!/opt/local/bin/clear; ./a.out"
nnoremap <leader>^ <C-W>w
nnoremap <leader>- `.
nnoremap ,c :<C-u>setlocal cursorline!<CR>
set nocursorline
let s:switchvirtualedit = "none"
function! b:switchVirtualEdit()
if "all" ==? s:switchvirtualedit
let s:switchvirtualedit="none"
set virtualedit=""
else
let s:switchvirtualedit="all"
set virtualedit=all
endif
endfunction
nmap ,z :call b:switchVirtualEdit() <CR>
function! b:ShowLine()
echo expand("%").":".line('.')
endfunction
nmap ,2 :call b:ShowLine()<CR>
function! b:FileLineJump(f)
let s:s = split(a:f,":")
let s:fname = s:s[0:0]
let s:line = s:s[1:1]
execute ":e +".s:line[0]." ".s:fname[0]
endfunction
nmap ,1 :call b:FileLineJump("")<LEFT><LEFT>
function! s:SID_PREFIX()
return matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSID_PREFIX$')
endfunction
function! s:my_tabline()
let s = ''
for i in range(1, tabpagenr('$'))
let bufnrs = tabpagebuflist(i)
let bufnr = bufnrs[tabpagewinnr(i) - 1]
let no = i
let mod = getbufvar(bufnr, '&modified') ? '!' : ' '
let title = fnamemodify(bufname(bufnr), ':t')
let title = '[' . title . ']'
let s .= '%'.i.'T'
let s .= '%#' . (i == tabpagenr() ? 'TabLineSel' : 'TabLine') . '#'
let s .= no . ':' . title
let s .= mod
let s .= '%#TabLineFill# '
endfor
let s .= '%#TabLineFill#%T%=%#TabLine#'
return s
endfunction
let &tabline = '%!'. s:SID_PREFIX() . 'my_tabline()'
set showtabline=2
nnoremap [Tag] <Nop>
nmap t [Tag]
for n in range(1, 9)
execute 'nnoremap <silent> [Tag]'.n ':<C-u>tabnext'.n.'<CR>'
endfor
map <silent> [Tag]c :tablast <bar> tabnew<CR>
map <silent> [Tag]x :tabclose<CR>
map <silent> [Tag]n :tabnext<CR>
map <silent> [Tag]p :tabprevious<CR>