Skip to content

Instantly share code, notes, and snippets.

@liudangyi
Last active March 5, 2017 19:51
Show Gist options
  • Save liudangyi/3511717fb58430705401 to your computer and use it in GitHub Desktop.
Save liudangyi/3511717fb58430705401 to your computer and use it in GitHub Desktop.
My vimrc file
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'flazz/vim-colorschemes'
" Plugin 'jiangmiao/auto-pairs'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tacahiroy/ctrlp-funky'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'vim-scripts/restore_view.vim'
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tomtom/tcomment_vim'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
" Plugin 'majutsushi/tagbar'
" Plugin 'brookhong/cscope.vim'
" Plugin 'tpope/vim-sleuth'
" Plugin 'luochen1990/indent-detector.vim'
call vundle#end() " required
" filetype plugin indent on " required
syntax enable on
set shell=/bin/bash
set mouse=a
set cursorline " Highlight current line
set laststatus=2
set virtualedit=onemore " Allow for cursor beyond last character
set history=1000 " Store a ton of history (default is 20)
set undofile " So is persistent undo ...
set undolevels=1000 " Maximum number of changes that can be undone
set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
set undodir=~/.vim/undo
set backspace=indent,eol,start " Backspace for dummies
set linespace=0 " No extra spaces between rows
set number " Line numbers on
set showmatch " Show matching brackets/parenthesis
set incsearch " Find as you type search
set hlsearch " Highlight search terms
set winminheight=0 " Windows can be 0 line high
set ignorecase " Case insensitive search
set smartcase " Case sensitive when uc present
set wildmenu " Show list instead of just completing
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
set whichwrap=b,s,h,l,<,>,[,] " Backspace and cursor keys wrap too
set scrolljump=5 " Lines to scroll when cursor leaves screen
set scrolloff=3 " Minimum lines to keep above and below cursor
set foldenable " Auto fold code
set list
set listchars=tab:›\ ,trail:•,extends:#,nbsp:. " Highlight problematic whitespace
set autoread
set hidden " Allow buffer switching without saving
set cscopetag " Use cscope tag
set background=dark
let g:solarized_termcolors=256
let g:solarized_termtrans=1
let g:solarized_contrast="high"
let g:solarized_visibility="low"
colo solarized
hi clear SignColumn
hi clear LineNr
hi CursorLine ctermbg=234
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled = 1
nnoremap <leader>fa :call CscopeFindInteractive(expand('<cword>'))<CR>
nnoremap <leader>fl :call ToggleLocationList()<CR>
" s: Find this C symbol
nnoremap fs :call CscopeFind('s', expand('<cword>'))<CR>
" g: Find this definition
nnoremap fg :call CscopeFind('g', expand('<cword>'))<CR>
" d: Find functions called by this function
nnoremap <leader>fd :call CscopeFind('d', expand('<cword>'))<CR>
" c: Find functions calling this function
nnoremap <leader>fc :call CscopeFind('c', expand('<cword>'))<CR>
" t: Find this text string
nnoremap <leader>ft :call CscopeFind('t', expand('<cword>'))<CR>
" e: Find this egrep pattern
nnoremap <leader>fe :call CscopeFind('e', expand('<cword>'))<CR>
" f: Find this file
nnoremap <leader>ff :call CscopeFind('f', expand('<cword>'))<CR>
" i: Find files #including this file
nnoremap <leader>fi :call CscopeFind('i', expand('<cword>'))<CR>"
" Open goto symbol on all buffers
nmap <C-R> :CtrlPBufTagAll<cr>
imap <C-R> <esc>:CtrlPBufTagAll<cr>
nmap U :redo<cr>
" Comment lines with cmd+c
nmap <C-c> gcc
vmap <C-c> gc
" Swich between buffers
nmap <C-h> :bprev!<cr>
imap <C-h> <esc>:bprev!<cr>
nmap <C-l> :bnext!<cr>
imap <C-l> <esc>:bnext!<cr>
nmap <C-w> :bd<cr>
imap <C-w> <esc>:bd<cr>
nmap <C-s> :w<cr>
imap <C-s> <esc>:w<cr>
nmap <C-j> :wincmd w<cr>
imap <C-j> <esc>:wincmd w<cr>
nmap <C-k> :wincmd W<cr>
imap <C-k> <esc>:wincmd W<cr>
nmap <Space> :
" nmap <F8> :TagbarToggle<CR>
" Instead of reverting the cursor to the last position in the buffer, we
" set it to the first line when editing a git commit message
au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0])
" GUI
set guifont=Monaco\ for\ Powerline:h12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment