vim插件的安装

来源:互联网 发布:苹果 windows 截屏 编辑:程序博客网 时间:2024/06/02 12:43
为了使用pathogen插件,我把.vim文件夹和.vimrc添加的配置删除,重新整理了下!1、pathogen 插件管理https://github.com/tpope/vim-pathogen运行如下命令mkdir -p ~/.vim/autoload ~/.vim/bundlecurl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim在.vimrc中添加" pathogen execute pathogen#infect()2、nerdtree 文件浏览器https://github.com/scrooloose/nerdtree运行如下命令cd ~/.vim/bundlegit clone https://github.com/scrooloose/nerdtree.git在.vimrc中添加" NERDTreemap <silent> <F3> :NERDTreeToggle<CR>" 映射F3打开关闭NERDTree3、xptemplate 代码片段自动补全https://github.com/drmingdrmer/xptemplate运行如下命令cd ~/.vim/bundlegit clone https://github.com/drmingdrmer/xptemplate.git在.vimrc中添加" xptemplatelet g:xptemplate_vars = "SParg=&BRfun= &BRloop= "" 代码紧贴括号,函数名单行,花括号不对齐let php_noShortTags = 1" 禁用php短标记" let g:xptemplate_brace_complete = "([{\""" 括号引号自动补全,部分代码缩进有问题4、emmet-vim 快速编写html和css代码 https://github.com/mattn/emmet-vim/运行如下命令cd ~/.vim/bundlegit clone https://github.com/mattn/emmet-vim.git5、nerdcommenter 为代码段添加注释https://github.com/scrooloose/nerdcommenter运行如下命令cd ~/.vim/bundlegit clone https://github.com/scrooloose/nerdcommenter.git在.vimrc中添加" NERDcommenterlet NERDSpaceDelims = 1" 注释左右两端留空格 let NERDRemoveExtraSpaces = 16、supertab 映射ctrl+x ctrl+o用https://github.com/ervandew/supertab运行如下命令cd ~/.vim/bundlegit clone https://github.com/ervandew/supertab.git在.vimrc中添加" supertablet g:SuperTabDefaultCompletionType = "<C-X><C-O>"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" " 回车即选中当前项7、taglist 显示代码结构 http://www.vim.org/scripts/script.php?script_id=273到上面网站下载taglist,在.vim/bundle文件夹下为该插件创建文件夹,然后将其解压到创建的新文件夹中即可。在.vimrc中添加" Taglistmap <silent> <F4> :TlistToggle<CR>" 映射F4打开关闭Taglist/* (delimitMate插件会造成gvim无法输入中文,我已不用,直接用xptemplate自带的花括号补全) *//* 8、delimitMate括号引号自动补全 *//* https://github.com/Raimondi/delimitMate *//* 运行如下命令 *//* cd ~/.vim/bundle *//* git clone https://github.com/Raimondi/delimitMate.git *//* 在.vimrc中添加 *//* " delimitMate 改进 *//* inoremap <C-J> <CR><Esc>O *//* 这样按ctrl+j快捷键就能自动缩排自动补全的花括号了,该插件提供的delimitMate_expand_cr 参数我没有成功,只好自己创建一个 */9、更新帮助文档插件安装完后可打开vim运行:Helptags命令即可更新各插件的帮助文档10、备份我当前的.vimrc配置" An example for a vimrc file."" Maintainer:Bram Moolenaar <Bram@vim.org>" Last change:2014 Feb 05"" To use it, copy it to"     for Unix and OS/2:  ~/.vimrc"      for Amiga:  s:.vimrc"  for MS-DOS and Win32:  $VIM\_vimrc"    for OpenVMS:  sys$login:.vimrc" When started as "evim", evim.vim will already have done these settings.if v:progname =~? "evim"finishendif" Use Vim settings, rather than Vi settings (much better!)." This must be first, because it changes other options as a side effect.set nocompatible" allow backspacing over everything in insert modeset backspace=indent,eol,startif has("vms")set nobackup" do not keep a backup file, use versions insteadelseset backup" keep a backup file (restore to previous version)set undofile" keep an undo file (undo changes after closing)endifset history=50" keep 50 lines of command line historyset ruler" show the cursor position all the timeset showcmd" display incomplete commandsset incsearch" do incremental searching" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries" let &guioptions = substitute(&guioptions, "t", "", "g")" Don't use Ex mode, use Q for formattingmap Q gq" CTRL-U in insert mode deletes a lot.  Use CTRL-G u to first break undo," so that you can undo CTRL-U after inserting a line break.inoremap <C-U> <C-G>u<C-U>" In many terminal emulators the mouse works just fine, thus enable it.if has('mouse')set mouse=aendif" Switch syntax highlighting on, when the terminal has colors" Also switch on highlighting the last used search pattern.if &t_Co > 2 || has("gui_running")syntax onset hlsearchendif" Only do this part when compiled with support for autocommands.if has("autocmd")" Enable file type detection." Use the default filetype settings, so that mail gets 'tw' set to 72," 'cindent' is on in C files, etc." Also load indent files, to automatically do language-dependent indenting.filetype plugin indent on" Put these in an autocmd group, so that we can delete them easily.augroup vimrcExau!" For all text files set 'textwidth' to 78 characters.autocmd FileType text setlocal textwidth=78" When editing a file, always jump to the last known cursor position." Don't do it when the position is invalid or when inside an event handler" (happens when dropping a file on gvim)." Also don't do it when the mark is in the first line, that is the default" position when opening a file.autocmd BufReadPost *\ if line("'\"") > 1 && line("'\"") <= line("$") |\   exe "normal! g`\"" |\ endifaugroup ENDelseset autoindent" always set autoindenting onendif " has("autocmd")" Convenient command to see the difference between the current buffer and the" file it was loaded from, thus the changes you made." Only define it when not defined already.if !exists(":DiffOrig")command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis\ | wincmd p | diffthisendif" 一些杂项set numberset tabstop=4set shiftwidth=4set softtabstop=4set autoindentset cindentset hlsearchset backspace=2set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936set termencoding=utf-8set encoding=utf-8set timeout timeoutlen=3000 ttimeoutlen=100" 可提高输入O插入行的速度" set cursorline" 光标下划线set fdm=marker" 默认标记折叠方式" pathogen execute pathogen#infect()" omni completefiletype plugin onset ofu=syntaxcomplete#Completeset completeopt=longest,menu " supertablet g:SuperTabDefaultCompletionType = "<C-X><C-O>"inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" " 回车即选中当前项" NERDTreemap <silent> <F3> :NERDTreeToggle<CR>" 映射F3打开关闭NERDTree" Taglistmap <silent> <F4> :TlistToggle<CR>" 映射F4打开关闭Taglist" xptemplatelet g:xptemplate_vars = "SParg=&BRfun= &BRloop= "<span style="white-space:pre"></span>" 代码紧贴括号,函数名单行,花括号不对齐let php_noShortTags = 1" 禁用php短标记" let g:xptemplate_brace_complete = "([{\""" 括号引号自动补全,部分代码缩进有问题" NERDcommenterlet NERDSpaceDelims = 1" 注释左右两端留空格 let NERDRemoveExtraSpaces = 1" Backupset backupdir=~/.vim/backup" vim备份的文件夹set undodir=~/.vim/undo" vim撤销记录文件夹" html indent" let g:html_indent_script1 = "inc"" 缩进<script>标签let g:html_indent_style1 = "inc"" 缩进<style>标签let g:html_indent_inctags = "body,head,tbody"" 缩进body head


                                             
0 0
原创粉丝点击