Created
April 29, 2014 13:13
-
-
Save lihb/11399939 to your computer and use it in GitHub Desktop.
my vimrc
This file contains hidden or 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 guioptions=T " 隐藏工具栏 | |
| colorscheme Monokai "配色方案 | |
| "set guifont=Monospace:h12:cGB2312 " 字体 && 字号 | |
| set noerrorbells " 关闭错误提示音 | |
| " | |
| set nobackup " 不要备份文件 | |
| " | |
| set linespace=0 " 字符间插入的像素行数目 | |
| " | |
| set shortmess=atI " 启动的时候不显示那个援助索马里儿童的提示 | |
| " | |
| set novisualbell " 不要闪烁 | |
| " | |
| set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离 | |
| " | |
| set mouse=a | |
| " | |
| set selection=exclusive | |
| " | |
| set selectmode=mouse,key " 在工作区双击鼠标定位) | |
| " | |
| "set cursorline " 突出显示当前行 | |
| " | |
| set nu " 显示行号 | |
| " | |
| set whichwrap+=<,>,h,l " 允许backspace和光标键跨越行边界 | |
| " | |
| " | |
| set noswapfile "不需要交换文件 | |
| "set mapleader | |
| let mapleader = "," | |
| "设置复制到剪切板快捷键 | |
| "鼠标选择可复制多行 | |
| vmap <Leader>y "+y | |
| "复制当前行 | |
| nmap <Leader>yy "+yy | |
| "设置快速编辑_vimrc文件和_vimperatorrc文件快捷键 | |
| map <Leader>evi :e ~/.vimrc<cr> | |
| "map <Leader>evp :e C:/Users/lhb/_vimperatorrc<cr> | |
| " | |
| "修改配置文件后,键入,s和,sp即时生效。 | |
| map <Leader>s :source ~/.vimrc<CR> | |
| " | |
| "map <Leader>` :%s/\(\w\{1,}\)/`\1`/gc<cr> | |
| " | |
| "取消搜索后的高亮显示 | |
| nmap <C-n> :silent noh<cr> | |
| "iab sop System.out.println() | |
| iab psv public static void main(String[] args){} | |
| " 自动切换目录为当前编辑文件所在目录 | |
| au BufRead,BufNewFile,BufEnter * cd %:p:h | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " | |
| "" 文本格式和排版 | |
| " | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " | |
| "set listchars=tab:\|\ , " 使用一高亮竖线代替 | |
| set tabstop=4 " 制表符为4 | |
| set autoindent " 自动对齐(继承前一行的缩进方式) | |
| set smartindent " 智能自动缩进(以c程序的方式) | |
| set softtabstop=4 | |
| "set list "显示tab符号 | |
| set shiftwidth=4 " 换行时行间交错使用4个空格 | |
| set expandtab " 不要用空格代替制表符 | |
| " | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " | |
| "" 状态行(命令行)的显示 | |
| " | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " | |
| set cmdheight=2 " 命令行(在状态行下)的高度,默认为1,这里是2 | |
| set ruler " 右下角显示光标位置的状态行 | |
| set laststatus=2 " 开启状态栏信息 | |
| set wildmenu " 增强模式中的命令行自动完成操作 | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " | |
| " 文件相关 | |
| " | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " | |
| set fenc=utf-8 | |
| set encoding=utf-8 " 设置vim的工作编码为utf-8,如果源文件不是此编码,vim会进行转换后显示 | |
| set fileencoding=utf-8 " 让vim新建文件和保存文件使用utf-8编码 | |
| set fileencodings=utf-8,gbk,cp936,chinese,latin-1 | |
| filetype on " 侦测文件类型 | |
| filetype indent on " 针对不同的文件类型采用不同的缩进格式 | |
| filetype plugin on " 针对不同的文件类型加载对应的插件 | |
| syntax on " 语法高亮 | |
| filetype plugin indent on " 启用自动补全 | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " 查找 | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| set hlsearch " 开启高亮显示结果 | |
| set nowrapscan " 搜索到文件两端时不重新搜索 | |
| set incsearch " 开启实时搜索功能 | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " 实用功能 | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| "---------编译运行java程序 | |
| func! CompileCode() | |
| exec "w" | |
| if &filetype == "java" | |
| exec "!javac -encoding utf-8 %" | |
| endif | |
| endfunc | |
| func! RunCode() | |
| if &filetype == "java" | |
| "exec i"!java -classpath %:h; %:t:r" | |
| exec "!java %<" | |
| endif | |
| endfunc | |
| map <C-m> :call CompileCode()<cr> | |
| map <C-w> :call RunCode()<cr> | |
| "----------运行python程序 | |
| map <C-r> :w<cr>:!python %<cr> | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " 插件 | |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| ""配置Vundle插件管理其他插件 | |
| set nocompatible | |
| filetype off | |
| " | |
| set rtp+=~/.vim/bundle/vundle/ | |
| call vundle#rc() | |
| "" let Vundle manage Vundle | |
| "" required! | |
| Plugin 'gmarik/vundle' | |
| "" My Plugins here: | |
| " | |
| "NERDTree | |
| Plugin 'scrooloose/nerdtree' | |
| " | |
| "------------------------------------------ | |
| "配置Powerline | |
| Plugin 'Lokaltog/vim-powerline' | |
| set t_Co=256 | |
| let g:Powerline_symbols='unicode' | |
| set encoding =utf-8 | |
| let g:Powerline_stl_path_style = 'full' | |
| "------------------------------------------ | |
| "配置Winmanager | |
| " | |
| Plugin 'winmanager' | |
| let g:NERDTree_title='[NERD Tree]' | |
| let g:winManagerWindowLayout='NERDTree' | |
| " | |
| function! NERDTree_Start() | |
| exec 'NERDTree' | |
| endfunction | |
| function! NERDTree_IsValid() | |
| return 1 | |
| endfunction | |
| nmap wm :WMToggle<cr> | |
| " | |
| "------------------------------------------ | |
| "配置ctags | |
| Plugin 'ctags.vim' | |
| "------------------------------------------ | |
| "配置minibufexplorer | |
| Plugin 'fholgado/minibufexpl.vim' | |
| noremap <C-Down> <C-W>j | |
| noremap <C-Up> <C-W>k | |
| noremap <C-Left> <C-W>h | |
| noremap <C-Right> <C-W>l | |
| "------------------------------------------ | |
| "配置mru(最近编辑文件列表) | |
| Plugin 'mru.vim' | |
| let MRU_Max_Entries = 1000 | |
| let MRU_Use_Current_Window = 1 | |
| let MRU_Auto_Close = 0 | |
| "----------------------------------------- | |
| Plugin 'UltiSnips' | |
| let g:UltiSnipsExpandTrigger = '<tab>' | |
| let g:UltiSnipsListTrigger = '<c-tab>' | |
| let g:UltiSnipsJumpForwardwardTrigger='<c-j>' | |
| let g:UltiSnipsJumpBackwardTrigger='<c-k>' | |
| let g:UltiSnipsEditSplit= 'vertical' | |
| "----------------------------------------- | |
| Plugin 'Yggdroot/indentLine' | |
| map <leader>il :IndentLinesToggle<CR> | |
| let g:indentLine_noConcealCursor=1 | |
| let g:indent_clolr_term=0 | |
| let g:indentLine_char = '┊' | |
| "----------------------------------------- | |
| "括号自动补全 | |
| Plugin 'Raimondi/delimitMate' | |
| "----------------------------------------- | |
| Plugin 'tpope/vim-surround' | |
| "----------------------------------------- | |
| Plugin 'majutsushi/tagbar' | |
| nmap tb :TagbarToggle<cr> | |
| let g:tagbar_width = 30 | |
| "----------------------------------------- | |
| "配置markdown | |
| Plugin 'plasticboy/vim-markdown' | |
| let g:vim_markdown_folding_disabled=1 | |
| let g:vim_markdown_initial_foldlevel=1 | |
| let g:vim_markdown_no_default_key_mappings=1 | |
| "autocmd BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} | |
| "----------------------------------------- | |
| filetype plugin indent on " required! | |
| ""------------------------------------------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment