Skip to content

Instantly share code, notes, and snippets.

@grasses
Last active May 14, 2017 13:54
Show Gist options
  • Save grasses/81556b386ad85b3bb0bb4bae9d15638b to your computer and use it in GitHub Desktop.
Save grasses/81556b386ad85b3bb0bb4bae9d15638b to your computer and use it in GitHub Desktop.
My vim configure
"关闭vim一致性原则
set nocompatible
"设置在编辑过程中右下角显示光标的行列信息
set ruler
"在状态栏显示正在输入的命令
set showcmd
"设置匹配模式
set showmatch
"设置C/C++方式自动对齐
set autoindent
set cindent
"开启语法高亮功能
syntax enable
syntax on
"设置搜索时忽略大小写
set ignorecase
"配置backspace的工作方式
set backspace=indent,eol,start
"设置自动对齐空格数
set shiftwidth=4
"设置退格键时可以删除4个空格
set smarttab
set softtabstop=4
"设置编码方式
set encoding=utf-8
"检测文件类型
filetype on
"允许插件
filetype plugin on
"启动智能补全
filetype plugin indent on
"光标下划线
set cursorline
"行序号
set number
"指定配色方案为256色
set t_Co=256
"总是显示状态行
set cmdheight=1
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\%{strftime(\"%d/%m/%y\ -\ %H:%M\")}
"启动显示状态行(1),总是显示状态行(2)
set laststatus=2
"允许折叠
set foldenable
"设置在vim中可以使用鼠标
set mouse=a
"简化+寄存器操作
set clipboard=unnamedplus
"设置字体
"set guifont=Courier_New:h10:cANSI
"粘贴快捷键
map <C-c> :set paste<CR>
map <C-v> :set nopaste<CR>
set ts=4
set showmatch
set smartindent
"*********************************************************
"" vundle 配置 *
"*********************************************************
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
Bundle 'The-NERD-tree'
Bundle 'Syntastic'
Bundle 'L9'
Bundle 'FuzzyFinder'
Bundle 'Lokaltog/vim-powerline'
Bundle 'Valloric/YouCompleteMe'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'git://git.wincent.com/command-t.git'
"Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
"Plugin 'elixir-lang/vim-elixir'
"Plugin 'wting/rust.vim'
Bundle 'gmarik/vundle'
call vundle#end()
"********************************************************
" NERD_Tree Git 配置 *
"********************************************************
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
"*****************************************************
"" FuzzyFinder配置 *
"*****************************************************
map <leader>F :FufFile<CR>
map <leader>f :FufTaggedFile<CR>
map <leader>g :FufTag<CR>
map <leader>b :FufBuffer<CR>
"********************************************************
" NERD_Tree 配置 *
"********************************************************
"显示增强
let NERDChristmasTree=1
"自动调整焦点
let NERDTreeAutoCenter=1
"鼠标模式:目录单击,文件双击
let NERDTreeMouseMode=2
"打开文件后自动关闭
let NERDTreeQuitOnOpen=0
"显示文件
let NERDTreeShowFiles=1
"显示隐藏文件
let NERDTreeShowHidden=0
"高亮显示当前文件或目录
let NERDTreeHightCursorline=1
"显示行号
let NERDTreeShowLineNumbers=1
"窗口位置
let NERDTreeWinPos='left'
"窗口宽度
let NERDTreeWinSize=32
"不显示'Bookmarks' label 'Press ? for help'
let NERDTreeMinimalUI=1
"刷新目录栏
fun! ToggleRefresh()
:NERDTreeToggle
if(exists("b:NERDTreeType") == 1)
call feedkeys("R")
endif
endf
map <C-x> :call ToggleRefresh()<CR>
map <C-l> :NERDTreeToggle<CR>
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
"*********************************************************
" Valloric/YouCompleteMe *
"*********************************************************
let g:ycm_key_list_select_completion = ['<Down>']
let g:ycm_key_list_previous_completion = ['<Up>']
let g:ycm_complete_in_comments = 1 "在注释输入中也能补全
let g:ycm_complete_in_strings = 1 "在字符串输入中也能补全
let g:ycm_use_ultisnips_completer = 1 "提示UltiSnips
let g:ycm_collect_identifiers_from_comments_and_strings = 1 "注释和字符串中的文字也会被收入补全
let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_seed_identifiers_with_syntax=1 "语言关键字补全, 不过python关键字都很短,所以,需要的自己打开
"let g:formatdef_harttle = '"astyle --style=attach --pad-oper"'
"let g:formatters_cpp = ['harttle']
"let g:formatters_java = ['harttle']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment