syntax on
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set smartindent
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,[,],<,>,~
nnoremap ,u :e ++enc=utf8<CR>
nnoremap ,j :e ++enc=cp932<CR>
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 <F2> :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 <leader>1 :colder<CR>
nmap <leader>2 :cnewer<CR>
nmap ,l :ls<CR>
nmap ,m :bp<CR>
nmap ,, :bn<CR>
nmap <C-o> :args
nmap <C-s> :w<CR>
imap <C-s> <esc> :w<CR>
nmap ,e :e .<CR>
nmap <F7> :cp<CR>
nmap <F8> :cn<CR>
nmap ,d :bd<CR>
nmap ,n :set number!<CR>
nmap ,h :nohl<CR>
"[a-z]y / "
nmap ,f :reg<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 <leader>f <PageDown>
nnoremap <leader>d <PageUp>
nnoremap <leader><RIGHT> :wincmd l<CR>
nnoremap <leader><LEFT> :wincmd h<CR>
nnoremap <leader><UP> :wincmd k<CR>
nnoremap <leader><DOWN> :wincmd j<CR>
nnoremap ,<RIGHT> :wincmd l<CR>
nnoremap ,<LEFT> :wincmd h<CR>
nnoremap ,<UP> :wincmd k<CR>
nnoremap ,<DOWN> :wincmd j<CR>
colorscheme koehler
hi Comment term=standout ctermfg=2 gui=bold guifg=Green
hi Constant term=standout ctermfg=2 gui=bold guifg=DarkRed
hi Search term=standout cterm=none ctermfg=0 ctermbg=7 guifg=Blue guibg=Yellow
hi Special term=reverse ctermfg=6 ctermbg=0 guifg=Red guibg=Black
hi Type term=reverse ctermfg=6 ctermbg=0 guifg=Red guibg=Black
hi PreProc term=reverse ctermfg=6 ctermbg=0 guifg=Red guibg=Black
hi LineNr ctermfg=grey ctermbg=4
hi MatchParen term=standout ctermbg=LightGrey ctermfg=Black guibg=LightGrey guifg=Black
hi PmenuSel ctermfg=grey ctermbg=4
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>
nmap <F4> :!gtags -v<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>
set undodir=~/.vim_undo
set undofile
nnoremap [Mark] <Nop>
nmap m [Mark]
if !exists('g:markrement_char')
let g:markrement_char = [
\ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
\ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
\ ]
endif
nnoremap <silent>[Mark]m :<C-u>call <SID>AutoMarkrement()<CR>
function! s:AutoMarkrement()
if !exists('b:markrement_pos')
let b:markrement_pos = 0
else
let b:markrement_pos = (b:markrement_pos + 1) % len(g:markrement_char)
endif
execute 'mark' g:markrement_char[b:markrement_pos]
echo 'marked' g:markrement_char[b:markrement_pos]
endfunction
nnoremap [Mark]n ]`
nnoremap [Mark]p [`
nnoremap [Mark]l :<C-u>marks<CR>
inoremap <expr><CR> <SID>ExCr()
function! s:ExCr()
if col('.') != col('$')
return "\<CR>"
endif
let l = getline('.')
if l =~ '{$'
return "\<CR>}\<Up>\<End>\<CR>"
elseif l =~ '($'
return "\<CR>)\<Up>\<End>\<CR>"
elseif l =~ '[$'
return "\<CR>]\<Up>\<End>\<CR>"
elseif l =~ '*$'
return "\<CR>*//\<Up>\<End>\<CR>\ "
else
return "\<CR>"
endif
endfunction
let s:switch_smartinput = "yes"
function! b:switchSmartInput()
if "yes" ==? s:switch_smartinput
let s:switch_smartinput="no"
call smartinput#clear_rules()
else
let s:switch_smartinput="yes"
call smartinput#define_default_rules()
endif
endfunction
nmap <leader>s :call b:switchSmartInput()<CR>
nnoremap ,. :<C-u>setlocal relativenumber!<CR>