Last active
December 11, 2015 04:28
-
-
Save southp/4545016 to your computer and use it in GitHub Desktop.
My noob vimrc.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'L9' | |
Bundle 'FuzzyFinder' | |
Bundle 'bufexplorer.zip' | |
Bundle 'majutsushi/tagbar' | |
set nobackup | |
set ruler | |
set showcmd | |
set backspace=indent,eol,start | |
set shiftwidth=4 | |
set tabstop=4 | |
set expandtab | |
set nu | |
set fileencodings=ucs-bom,utf-8,taiwan,prc | |
set encoding=utf-8 | |
set showmatch | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
set autoindent | |
hi Pmenu ctermbg=darkblue | |
hi Search cterm=NONE ctermfg=grey ctermbg=blue | |
filetype plugin indent on | |
syntax enable | |
let c_no_curly_error = 1 | |
set path+=~/zillians/platform/projects/**,/usr/local/include | |
set tags=~/zillians/platform/projects/tags | |
cs add ~/zillians/platform/projects/cscope.out | |
"""""""""""""""""" Key mappings | |
map <F2> :TagbarToggle<CR> | |
map <F3> :FufTag<CR> | |
map <C-f> :FufFile ./**/<CR> | |
map <C-q> :q<CR> | |
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR> | |
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR> | |
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> | |
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR> | |
noremap <C-Up> :call <SID>CppSwitch()<CR> | |
nnoremap k gk | |
nnoremap j gj | |
nnoremap <C-Left> :tabprevious<CR> | |
nnoremap <C-Right> :tabnext<CR> | |
nnoremap <C-Down> :Grep <C-R>=expand("<cword>")<CR> ./**/*. | |
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR> | |
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . tabpagenr()<CR> | |
"""""""""""""" For OSX compatible | |
map <F4> :call <SID>CppSwitch()<CR> | |
noremap <C-s> :call <SID>CppSwitch()<CR> | |
nnoremap <C-j> :tabprevious<CR> | |
nnoremap <C-k> :tabnext<CR> | |
nnoremap <C-l> :Grep <C-R>=expand("<cword>")<CR> ./**/*. | |
"""""""""""""""""" Custom commands | |
command! -nargs=+ -complete=file Grep noautocmd vimgrep <args> | e | |
"""""""""""""""""" Custom functions | |
function! s:CppSwitch() | |
python << EOF | |
import vim | |
import re | |
def find_switch(): | |
slash = vim.current.buffer.name.rfind('/') | |
dot = vim.current.buffer.name.rfind('.') | |
subn = vim.current.buffer.name[dot+1:] | |
fn = vim.current.buffer.name[slash+1:dot] | |
path = vim.current.buffer.name[:slash+1] | |
if slash == -1 or dot == -1: | |
print "Cannot find slash or dot in path" | |
else: | |
if subn == "h" or subn == "hpp": | |
target = fn + ".cpp" | |
elif subn == "cpp" or subn == "c" or subn == "cxx": | |
target = fn + ".h" | |
else: | |
print "Sorry. I only care about .h or .cpp" | |
return | |
print "Finding: " + target | |
for b in vim.buffers: | |
if b.name and re.search(target,b.name): | |
vim.command("b " + str(b.number)) | |
return | |
vim.command('find ./**/' + target) | |
find_switch() | |
EOF | |
endfunction | |
" Enable syntax highlighting for LLVM files. To use, copy | |
" utils/vim/llvm.vim to ~/.vim/syntax . | |
augroup filetype | |
au! BufRead,BufNewFile *.ll set filetype=llvm | |
augroup END | |
" Enable syntax highlighting for tablegen files. To use, copy | |
" utils/vim/tablegen.vim to ~/.vim/syntax . | |
augroup filetype | |
au! BufRead,BufNewFile *.td set filetype=tablegen | |
augroup END | |
augroup filetype | |
au! BufRead,BufNewFile *.t set filetype=javascript | |
augroup END |
modify search highlight color and background color of popup menus to ease my eyes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change minibufexplorer to bufexplorer.zip since minibuf messed up with my CTRL+6 buffer switch.