Skip to content

Instantly share code, notes, and snippets.

@silenceboychen
Created August 17, 2017 07:30
Show Gist options
  • Save silenceboychen/57c6b00907e5df288efbb5e35c74b0e9 to your computer and use it in GitHub Desktop.
Save silenceboychen/57c6b00907e5df288efbb5e35c74b0e9 to your computer and use it in GitHub Desktop.
vimrc
set nocompatible "关闭 vi 兼容模式
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
"Plugins
"Plugin 'Valloric/YouCompleteMe'
Plugin 'Raimondi/delimitMate'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
" 这个插件可以显示文件的Git增删状态
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'scrooloose/nerdcommenter' " commenter: \cc \cu
Plugin 'pangloss/vim-javascript' " Vastly improved Javascript indentation and syntax support in Vim.
Plugin 'Shougo/neocomplcache.vim' " Ultimate auto-completion system for Vim.
Plugin 'msanders/snipmate.vim' " implements some of TextMate's snippets features in Vim.
call vundle#end() " required
filetype plugin indent on " required
" Ctrl+N 打开/关闭
map <C-n> :NERDTreeToggle<CR>
" 当不带参数打开Vim时自动加载项目树
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" 当所有文件关闭时关闭项目树窗格
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" 不显示这些文件
let NERDTreeIgnore=['\.pyc$', '\~$', 'node_modules'] "ignore files in NERDTree
" 不显示项目树上额外的信息,例如帮助、提示什么的
let NERDTreeMinimalUI=1
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*/node_modules/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = {'dir': '\v[\/]\.(git|hg|svn)$', 'file': '\v\.(exe|so|dll)$'}
" =========================================================
" Configuration: neocomplcache.vim
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
syntax on "自动语法高亮
set number " 显示行号
set cursorline " 突出显示当前行
set ruler " 打开状态栏标尺
set shiftwidth=2 " 设定 << 和 >> 命令移动时的宽度为2
set softtabstop=2 " 使得按退格键时可以一次删掉 2 个空格
set tabstop=2 " 设定 tab 长度为2
set autochdir " 自动切换当前目录为当前文件所在的目录
set ignorecase smartcase " 搜索时忽略大小写,但在有一个或以上大写字母时仍保持对大小写敏感
set nowrapscan " 禁止在搜索到文件两端时重新搜索
set incsearch "输入搜索内容时就显示搜索结果
set hlsearch "搜索时高亮显示被找到的文本
set showmatch " 插入括号时,短暂地跳转到匹配的对应括号
set matchtime=2 " 短暂跳转到匹配括号的时间
set magic " 设置魔术
set hidden " 允许在有未保存的修改时切换缓冲区,此时的修改由 vim 负责保存
set smartindent " 开启新行时使用智能自动缩进
set cmdheight=1 " 设定命令行的行数为 1
set laststatus=2 " 显示状态栏 (默认值为 1, 无法显示状态栏)
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\ " 设置在状态行显示的信息
set mouse=a "启用鼠标选项,a为所有模式启用鼠标
set helplang=cn "设置帮助为中文
set clipboard=unnamed "在Vim中copy的所有内容都会上系统剪切板
set pastetoggle=<F9> "拷贝模式
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment