vim插件的安装

为了使用pathogen插件,我把.vim文件夹和.vimrc添加的配置删除,重新整理了下!

1、pathogen 插件管理
https://github.com/tpope/vim-pathogen
运行如下命令
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
在.vimrc中添加

" pathogen 
execute pathogen#infect()

2、nerdtree 文件浏览器
https://github.com/scrooloose/nerdtree
运行如下命令
cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git
在.vimrc中添加

" NERDTree
map <silent> <F3> :NERDTreeToggle<CR>			" 映射F3打开关闭NERDTree

3、xptemplate 代码片段自动补全
https://github.com/drmingdrmer/xptemplate
运行如下命令
cd ~/.vim/bundle
git clone https://github.com/drmingdrmer/xptemplate.git
在.vimrc中添加

" xptemplate
let 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/bundle
git clone https://github.com/mattn/emmet-vim.git

5、nerdcommenter 为代码段添加注释
https://github.com/scrooloose/nerdcommenter
运行如下命令
cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdcommenter.git
在.vimrc中添加

" NERDcommenter
let NERDSpaceDelims = 1							" 注释左右两端留空格 
let NERDRemoveExtraSpaces = 1

6、supertab 映射ctrl+x ctrl+o用
https://github.com/ervandew/supertab
运行如下命令
cd ~/.vim/bundle
git clone https://github.com/ervandew/supertab.git
在.vimrc中添加

" supertab
let 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中添加

" Taglist
map <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"
	finish
endif

" 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 mode
set backspace=indent,eol,start

if has("vms")
	set nobackup		" do not keep a backup file, use versions instead
else
	set backup		" keep a backup file (restore to previous version)
	set undofile		" keep an undo file (undo changes after closing)
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set 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 formatting
map 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=a
endif

" 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 on
	set hlsearch
endif

" 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 vimrcEx
		au!

		" 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`\"" |
					\ endif

	augroup END

else

	set autoindent		" always set autoindenting on

endif " 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 | diffthis
endif

" 一些杂项
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set autoindent
set cindent
set hlsearch
set backspace=2
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set timeout timeoutlen=3000 ttimeoutlen=100			" 可提高输入O插入行的速度
" set cursorline						" 光标下划线

set fdm=marker							" 默认标记折叠方式

" pathogen 
execute pathogen#infect()

" omni complete
filetype plugin on
set ofu=syntaxcomplete#Complete
set completeopt=longest,menu 

" supertab
let g:SuperTabDefaultCompletionType = "<C-X><C-O>"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" 		" 回车即选中当前项

" NERDTree
map <silent> <F3> :NERDTreeToggle<CR>				" 映射F3打开关闭NERDTree

" Taglist
map <silent> <F4> :TlistToggle<CR>				" 映射F4打开关闭Taglist

" xptemplate
let g:xptemplate_vars = "SParg=&BRfun= &BRloop= "	<span style="white-space:pre">	</span>" 代码紧贴括号,函数名单行,花括号不对齐
let php_noShortTags = 1						" 禁用php短标记
" let g:xptemplate_brace_complete = "([{\""			" 括号引号自动补全,部分代码缩进有问题	

" NERDcommenter
let NERDSpaceDelims = 1						" 注释左右两端留空格 
let NERDRemoveExtraSpaces = 1

" Backup
set 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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值