" 关闭与vi的兼容模式 set nocompatible " 不生成~开头的备份文件 set nobackup " 不生成交换文件 set noswapfile " 历史记录数 什么? set history=1024 " 自动切换当前目录 set autochdir " 去掉 utf-8 BOM set nobomb " Vim 的默认寄存器和系统剪贴板共享 set clipboard+=unnamed " 设置 alt 键不映射到菜单栏 set winaltkeys=no
编码
1 2 3 4 5 6 7 8
" vim可识别的编码方式 set fileencodings=utf-8,gbk2312,gbk,gb18030,cp936 " 文件默认编码方式 set encoding=utf-8 " vim菜单栏语言 set langmenu=zh_CN " vim默认语言 let $LANG = 'en_US.UTF-8'
source $VIMRUNTIME/delmenu.vim source $VIMRUNTIME/menu.vim " 高亮光标所在行 set cursorline set hlsearch " 显示行号 set number " 窗口大小 set lines=35 columns=140 " 分割出来的窗口位于当前窗口下边/右边 set splitbelow set splitright "不显示工具/菜单栏 set guioptions-=T set guioptions-=m set guioptions-=L set guioptions-=r set guioptions-=b " 使用内置 tab 样式而不是 gui set guioptions-=e set nolist " 指定字体 以及字体 大小 set guifont=Inconsolata:h14:cANSI
格式设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14
" 自动缩进 set autoindent " 新行使用只能缩进 set smartindent " 设定tab长度为4 set tabstop=4 " 空格代替缩进制表符 set expandtab " set softtabstop=4 " set foldmethod=indent " 语法高亮 syntax on
filetype off set rtp+=$VIM/vinfiles/bundle/Vundle.vim/ call vundle#begin('$VIM/vimfiles/bundle/')
" 插件内容 Plugin 'VundleVim/Vundle.vim'
filetype on call vundle#end()
然后在vim命令行模式安装 :PluginInstall
常用插件 NerdTree 文件目录结构树
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Plugin 'scrooloose/nerdtree' let NERDTreeIgnore=['.idea','.vscode','node_modules'] let NERDTreeBookmarksFile=$VIM . '/NerdTreeBookmarks' let NERDTreeMinimalUI=1 let NERDTreeBookmarksSort=1 let NERDTreeShowLineNumbers=0 let NERDTreeShowBookmarks=1 let g:NERDTreeWinPos = 'right' let g:NERDTreeDirArrowExpandable='→' let g:NERDTreeDirArrowCollapsible='↓' " 快捷键 nmap <leader>n :NERDTreeToggle<cr>
if exists('g:NERDTreeWinPos') autocmd vimenter * NERDTree D:\www endif
Ctrlp 粘贴板共享
1 2 3
Plugin 'kien/ctrlp.vim' let g:ctrlp_match_window='bottom,order,:btt,min:1,max:10,results:10' set wildignore+=*\\.git\\*,*\\tmp\\*,*.swp,*.zip,*.exe
Plugin 'Shougo/neocomplete.vim' let g:acp_enableAtStartup=0 " Use neocomplete let g:neocomplete#enable_at_startup=1 " Use smartcase let g:neocomplete#enable_smart_case=1 let g:neocomplete#enable_auto_select=1 " Enable snipMate compatibility feature let g:neosnippet#enable_snipmate_compatibility=1 " Tell Neosnippet about the other snippets let g:neosnippet#snippets_directory=$VIM . '/vimfiles/bundle/vim-snippets/snippets'
" Enable omni completion. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS " php代码提示 autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP autocmd Filetype xml setlocal omnifunc=xmlcomplete#CompleteTags if !exists('g:neocomplete#sources#omni#input_patterns') let g:neocomplete#sources#omni#input_patterns = {} endif