Skip to content

Instantly share code, notes, and snippets.

@louis-she
Created June 25, 2016 10:17
Show Gist options
  • Save louis-she/b58aacda84507f3ff9a750cb58ba445a to your computer and use it in GitHub Desktop.
Save louis-she/b58aacda84507f3ff9a750cb58ba445a to your computer and use it in GitHub Desktop.
" if not quite sure any of these options does, just take
" a look at http://vimdoc.sourceforge.net/htmldoc/usr_05.html
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" base options
set nocompatible " work in an imporvement way
" for vundle
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Bundle 'mattn/webapi-vim'
Bundle 'mattn/gist-vim'
Plugin 'kchmck/vim-coffee-script'
Plugin 'grep.vim'
Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim'
call vundle#end()
filetype plugin indent on
set backspace=indent,eol,start " 退格键在输入模式中起作用
set autoindent " 自动缩进
set history=50 " 保存50个历史命令
set ruler " 显示光标位置在右下角
set showcmd " 在右下角显示输入的不完整的命令
set incsearch " 搜索时候立即高亮,不用按回车
set shiftwidth=2 " 使 > 缩进时的宽度为4
set tabstop=2 " tab宽度
set softtabstop=2 " tab宽度
set expandtab " 用空格替代tab
set viminfo='1000,f1,<500 " viminfo的配置
filetype plugin indent on " indent depends on the file type
syntax on " syntax on
set hlsearch " 高亮搜索的文字
autocmd FileType python setlocal textwidth=78 " python宽度设置为78
" for javascript file type
autocmd FileType javascript set shiftwidth=2
" key mapping and micro
autocmd FileType python,sh map \c ^i#<Esc> " quickly comment a line as #
autocmd FileType php,cc,cpp map \c ^i//<Esc> " quickly comment a line as //
" set tags
set tags+=./tags,./../tags,./../../tags,./../../../tags
set tags+=/etc/systags
autocmd BufWritePost,FileWritePost *.less :silent !lessc <afile> <afile>:r.css
" funny maps
nnoremap "" viw<esc>a"<esc>hbi"<esc>lel
nnoremap '' viw<esc>a'<esc>hbi'<esc>lel
autocmd FileType javascript :iabbrev <buffer> iff if ()<left>
:let Grep_Skip_Files = '*.bak *~ tag'
" -------- syntastic configure ---------
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" ------ ctrlp-vim-red configure -------
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/log/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment