Last active
December 29, 2015 05:59
-
-
Save chml/7625862 to your computer and use it in GitHub Desktop.
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 | |
syntax enable | |
syntax on | |
set background=dark | |
"set background=light | |
colo solarized | |
set noerrorbells | |
set visualbell | |
" 编码 | |
set encoding=utf-8 | |
set termencoding=utf-8 | |
set fileencoding=utf-8 | |
set fileencodings=utf-8,ucs-bom,gb18030,chinese,gbk,gb2312,cp936 | |
if has("win32") " windows下各种乱码 | |
source $VIMRUNTIME/delmenu.vim " 菜单乱码 | |
source $VIMRUNTIME/menu.vim | |
language messages zh_CN.utf-8 " 提示乱码 | |
endif | |
set number | |
set helplang=cn | |
set nobackup | |
set nowrap | |
set incsearch | |
set hlsearch | |
set cursorline | |
set backspace=indent,eol,start whichwrap+=<,>,[,] " 允许退格键的使用 | |
"if has("gui_macvim") | |
" 字体设置 | |
set guifont=Source_Code_Pro:h16 | |
" Mac下输入法与Vim冲突 (需先把输入法切换改成Ctrl+space) | |
set noimd | |
set ims=1 | |
"endif | |
" GUI settings | |
winpos 100 100 | |
set lines=40 columns=110 | |
set guioptions-=T | |
set guioptions-=m | |
set guioptions-=L | |
set statusline=[%F]%y%r%m%*%=[Line:%l,\ Column:%c][%p%%] | |
set laststatus=1 | |
let filetype_m='objc' " 让 .m 文件为objc文件 | |
" indent settings | |
if has("autocmd") | |
filetype plugin indent on " 根据文件进行缩进 | |
augroup vimrcEX | |
au! | |
autocmd FileType text setlocal textwidth=78 | |
autocmd BufReadPost * | |
\ if line("'\"") > 1 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
augroup END | |
else | |
set autoindent | |
endif | |
set cinoptions=g0 | |
" tab settings | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
"========================================================================== | |
" 键盘映射 | |
"========================================================================== | |
" 窗口切换 | |
nnoremap <c-h> <c-w>h | |
nnoremap <c-l> <c-w>l | |
nnoremap <c-j> <c-w>j | |
nnoremap <c-k> <c-w>k | |
" 插入模式下光标移动 | |
inoremap <c-b> <left> | |
inoremap <c-f> <right> | |
inoremap <c-n> <down> | |
inoremap <c-p> <up> | |
inoremap <c-e> <Esc>A | |
inoremap <c-a> <Esc>I | |
inoremap <c-k> <Esc>lDa | |
" 补全 | |
inoremap { {}<Esc>i<Return><Esc>O | |
"========================================================================== | |
" 插件设置 | |
"========================================================================== | |
" Vundle | |
" Brief help | |
" :BundleList - list configured bundles | |
" :BundleInstell(!) - install(update) bundles | |
" :BundleSearch(!) foo - search(or refresh cache first) for foo | |
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles | |
set nocompatible " be iMproved | |
filetype off " required | |
set rtp+=~/.vim/bundle/vundle | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
Bundle 'scrooloose/nerdtree' | |
Bundle 'Valloric/YouCompleteMe' | |
Bundle 'toyamarinyon/vim-swift' | |
Bundle 'pangloss/vim-javascript' | |
Bundle 'kien/ctrlp.vim' | |
Bundle 'marijnh/tern_for_vim' | |
filetype plugin indent on | |
" YCM | |
let g:ycm_global_ycm_extra_conf='~/.ycm_extra_conf.py' | |
nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR> | |
" NERDTree | |
nnoremap <c-t> :NERDTreeToggle<CR> | |
" vim-javascript | |
set regexpengine=1 | |
" CtrlP | |
let g:ctrlp_map='<c-p>' | |
let g:ctrlp_cmd='CtrlP' | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\v[\/]\.(git|hg|svn)$', | |
\ 'file': '\v\.(exe|so|dll)$', | |
\ 'link': 'some_bad_symbolic_links', | |
\ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment