Code Monkey home page Code Monkey logo

vim's Introduction

vim IDE
===
Linux 平台常用插件安装:

===
以下安装插件环境:vim7.3
[
	插件安装:
	1>、下载对应的 .tar.gz|.zip压缩包
	2-1>、解压到vim对应目录下,覆盖,  {ag:{vim72: /usr/share/vim/vim72 | vim73: /usr/share/vim/vim73}} [NERDTree | neocomplcache | Calendar | solarized |TagList{Ctags}]
	|
	2-2>、解压到vim对应目录下,覆盖,  ag:{vim72: /usr/share/vim/vimfiles} [snipMate | ]
]

"已经安装的插件
1、NERDTree			目录树插件安装
nmap <F10> :NERDTreeToggle<CR>		"F10快捷键
let NERDTreeDirArrows=0			"Linux下,防止目录乱码

2、neocomplcache	自动补全插件
let g:neocomplcache_enable_at_startup = 1

3、Calendar			日历插件
[
	使用:
	Calendar | CalendarH
]
let g:calendar_diary = "~/diary" " 设置日记的存储路径
let g:calendar_monday = 1 "以星期一为开始
let g:calendar_focus_today = 1 " 光标在当天的日期上
let g:calendar_mark = 'left-fit' "可以让*和数字可靠近
"在vimrc中设置let g:calendar_diary = "~/diary" ;这是设置日记的存放目录,必须自己先建立这个目录。
"打开vim,用:Calendar 或 :CalendarH

4、colors solarized [vim护眼主题{http://ethanschoonover.com/solarized}]
"colors solarized
"syntax enable
"set background=light
"set background=dark
"set t_Co=256 "如果是在模拟终端需要把颜色设置成256色
set t_Co=16		"需要添加,否则会出现 文字 有阴影的情况
if has('gui_running')
    set background=light
else
    set background=dark
endif
colorscheme solarized

5、snipMate
[
	使用:
	......
	"Linux / ubuntu
    git clone git://github.com/msanders/snipmate.vim.git
	cd snipmate.vim
	cp -R * ~/.vim
	"windows	
	let g:snippets_dir="/usr/share/vim/vimfiles/snippets"
]

6、Ctags + TagList
[
	使用:
	{
		cd 进入项目根目录;
		运行:Ctags -R * {ctags -R *} {生成 tags文件}  {适用于 Linux/windows平台}
	}

	{
	Ctrl+] 追踪
	Ctrl+t 返回追踪起始位置
	}
]

[

	Ctags编译安装:
		下载源码安装(网上提供的方法)
		1)从http://ctags.sourceforge.net/下载源代码包后,解压缩生成源代码目录,
		2)然后进入源代码根目录执行./configure,
		3)然后执行make,
		4)编译成功后执行make install。
		{
			make install后执行:
			cd 进入ctags解压后的目录
			cp ctags /usr/local/bin/ctags  &&  chmod 755 /usr/local/bin/ctags
			cp ./ctags.1 /usr/local/share/man/man1/ctags.1  &&  chmod 644 /usr/local/share/man/man1/ctags.1
		}

	CentOS:
	{
		yum install ctags

		"Ctags
		let Tlist_Ctags_Cmd="/usr/bin/ctags/bin/ctags"   "linux 下 ctags执行文件目录
		"Taglist                                                                                                  
		"map <silent> <leader>tl :TlistToogle<cr>                                                                                        
		let Tlist_Auto_Highlight_Tag = 1                                                       
		let Tlist_Auto_Open = 1                                                                
		let Tlist_Auto_Update = 1                                                                         
		let Tlist_Close_On_Select = 0                                                                       
		let Tlist_Compact_Format = 0                                                                   
		let Tlist_Display_Prototype = 0                                                                    
		let Tlist_Display_Tag_Scope = 1                                                                 
		let Tlist_Enable_Fold_Column = 0                                                                 
		let Tlist_Exit_OnlyWindow = 0                                                                
		let Tlist_File_Fold_Auto_Close = 0                                                                   
		let Tlist_GainFocus_On_ToggleOpen = 1                                                              
		let Tlist_Hightlight_Tag_On_BufEnter = 1                                                           
		let Tlist_Inc_Winwidth = 0                                                        
		let Tlist_Use_Right_Window = 1                                                                      
		map <silent> <leader>tl :TlistToogle<cr> 

	}

	Ubuntu:
	{
		apt-get install ctags

		"CTags
		"let Tlist_Ctags_Cmd="/usr/share/CTags"   "linux 下 ctags执行文件目录
		let Tlist_Ctags_Cmd="/usr/bin/ctags"   "linux 下 ctags执行文件目录
		"Taglist                                                                                                  
		""map <silent> <leader>tl :TlistToogle<cr>                                                                                        
		let Tlist_Auto_Highlight_Tag = 1                                                       
		let Tlist_Auto_Open = 1                                                                
		let Tlist_Auto_Update = 1                                                                         
		let Tlist_Close_On_Select = 0                                                                       
		let Tlist_Compact_Format = 0                                                                   
		let Tlist_Display_Prototype = 0                                                                    
		let Tlist_Display_Tag_Scope = 1                                                                 
		let Tlist_Enable_Fold_Column = 0                                                                 
		let Tlist_Exit_OnlyWindow = 0                                                                
		let Tlist_File_Fold_Auto_Close = 0                                                                   
		let Tlist_GainFocus_On_ToggleOpen = 1                                                              
		let Tlist_Hightlight_Tag_On_BufEnter = 1                                                           
		let Tlist_Inc_Winwidth = 0                                                        
		let Tlist_Use_Right_Window = 1                                                                      
		map <silent> <leader>tl :TlistToogle<cr> 

		"Taglist
		"let Tlist_Ctags_Cmd="/usr/share/CTags"   "linux 下 ctags执行文件目录
		let Tlist_Show_One_File = 1            "不同时显示多个文件的tag,只显示当前文件的
		let Tlist_Exit_OnlyWindow = 1          "如果taglist窗口是最后一个窗口,则退出vim
		let Tlist_Use_Right_Window = 1         "在右侧窗口中显示taglist窗口
		"map <silent> <F9> :TlistToggle<cr>
	}

]

7、vim xdebug 调试之 - vim dbgp
[
	vim+xdebug+dbgp调试php程序:
	{
		使用此插件,要求你的vim编译时加上了python 和signs 功能:
		要检测是否安装
		:version
		看有没有+python 和 +signs字样。如果没有请百度		|sudo apt-get install vim-full
	}

	1. 安装xdebug
	下载xdebug源码包并解压
#cd xdebug-2.2.x
#phpize
#./configure --enable-xdebug --with-php-config=/path/to/php-config
#make
#cp modules/xdebug.so /path/to/php/extensiondir
	在php.ini尾部加上
	==============
	[xdebug]
	zend_extension="/usr/local/php/lib/php/extensions/no-debug-zts-20121212/xdebug.so"
	xdebug.auto_trace=1
	;xdebug.remote_enable = 1
	xdebug.remote_enable = on
	;xdebug.remote_host = localhost
	xdebug.remote_host = 127.0.0.1
	;xdebug.remote_port = 9001
	xdebug.remote_port = 9001
	xdebug.remote_handler=dbgp
	xdebug.collect_params=1
	xdebug.collect_return=1
	xdebug.trace_output_dir="var/log/xdebug/trace"
	xdebug.profiler_output_dir="var/log/xdebug/profiler"
	===============
	重启php-fpm,查看phpinfo即可看到xdebug的信息

	2. 安装dbgp
	执行vim
	输入:version,看看输出里是否有+python和+signs,如果没有,上网查怎么解决。
	下载dbgp源码包并解压
	将里面的debugger.py和debugger.vim拷贝到~/.vim/plugin/下
	修改 vimrc
	===============
	let g:debuggerPort = 9001
	let g:debuggerMaxDepth = 5
	===============

	执行vim
	输入:scriptnames确定vim加载了debugger.vim

	3. 使用xdebug
	通过浏览器调试
	vim打开一个php文件
	移动光标到任意一行,:Bp设置断点
	按F5启动调试,5秒内在浏览器里打开该文件(注意第一次打开需要在链接后面加上XDEBUG_SESSION_START=1参数,这样就会在cookie里记录下来,以后再打开就不用带这个参数了),再看vim窗口底部可以看到连接上了。
	此时窗口右侧有4个小窗口,分别是watch_window、help_window、stack_window、trace_window。help_window里介绍了调试快捷键,比如F2是进入,F3是下一步,F4是跳出,F5是启动调试,F6是终止调试,F11是获取变量值。
	直接按F4可以跳到断点处,按F11可以看到所有变量值情况(在watch_window里),也可以光标移到某变量,按F12看该变量值,实在方便。

	因为窗口不大,那4个小窗口只有watch_window对我有用,所以可以直接修改debugger.py,把对应窗口的代码都注视掉,只留下watch_window,这样watch_window就独占右侧了。

	参考: http://xdebug.org/docs/remote

]

8.vim中调试php, 安装php code_sniffer,php-md. phpqa.vim
[

	sudo apt-get install php-pear
	sudo apt-get install ImageMagick-devel

	pear install PHP_CodeSniffer
	pear channel-discover pear.phpmd.org
	pear channel-discover pear.pdepend.org
	pear install --alldeps phpmd/PHP_PMD 
	修改php.ini文件,加入extension=imagick.so

	打开vim:	|用vim打开php文件
	:!php -l % 这个是检查当前php文件语法参数
	:phpcs 这个就是code sniffer了
	:phpmd  这个是mess detector , 需要一个XML规则文件如果没有设置
	:phpcc  这个显示code coverage. 也需要一个XML规则文件如果没有设置


	安装phpqa.vim 
	https://github.com/rainysia/vimrc/commits/master
	去clone下来,放到$~.vim里面, 注意是user下面的.vim 

	在.vimrc里面加上
	let g:phpqa_codesniffer_args = "--standard=Zend"
	let g:phpqa_codesniffer_cmd  = '/usr/bin/phpcs'
	let g:phpqa_codesniffer_autorun = 1				"default =1 on save
	let g:phpqa_messdetector_ruleset = ''
	let g:phpqa_messdetector_cmd = '/usr/bin/phpmd'
	let g:phpqa_messdetector_autorun = 0
	"其中cmd 这两个是上面第一步安装后 type出来的路径

	--------
	参数里面的 --standard=Zend 意思是codesniffer采用Zend的编码风格来效验。 你可以自定义一些效验规则, 这个规则在debian里面
	/usr/share/php/PHP/CodeSniffer/Standards/ 
	里面,你可以把自定义的放进去。然后把

	let g:phpqa_codesniffer_args = "--standard=Zend"
	改为
	let g:phpqa_codesniffer_args = "--standard=自定义的"
	就可以使用自定义的代码风格效验了.

	--------
	http://pear.php.net/manual/en/package.php.php-codesniffer.config-options.php

	-------
	#type phpcs
	/usr/bin/phpcs
	autorun = 1是自动开启 ,当你保存的时候就会自动运行提示了
	把下面的内容保存为phpmd.xml ,保存在vim文件里面,然后打开任意的php文件,保存的时候会提示让你输入phpmd的文件所在,填你刚才保存的路径和phpmd.xml 然后就可以了

	<?xml version="1.0"?>
	<ruleset name="Sebastian"
			 xmlns="http://pmd.sf.net/ruleset/1.0.0"
			 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
			 xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
			 xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
		<description>Sebastian Bergmann's ruleset</description>

		<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
		<rule ref="rulesets/codesize.xml/NPathComplexity" />
		<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
		<rule ref="rulesets/codesize.xml/ExcessiveClassLength" />
		<rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
		<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />

		<rule ref="rulesets/design.xml/EvalExpression" />
		<rule ref="rulesets/design.xml/ExitExpression" />
		<rule ref="rulesets/design.xml/GotoStatement" />

		<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />

		<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
		<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />
		<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
		<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
	</ruleset>

	现在做下测试,打开vim 输入<?php ?>  然后:w保存,提示错误,说php不能关闭..看来语法要求很严格. 去掉?> 然后保存就没错误提示了

]

9.php assistant
[

]

10.PowerLine
[
	PowerLine是一个增强的Vim状态栏插件。当Vim处于NORMAL、INSERT、BLOCK等状态时,状态栏会呈现不同的颜色,同时状态栏还会显示当前编辑文件的格式(uft-8等)、文件类型(java、xml等)和光标位置等。
	从https://github.com/Lokaltog/vim-powerline下载PowerLine插件,将文件解压得到的autoload、doc、plugin和fontpatcher文件夹放到~/Vim/Vim73/bundler目录下,往_vimrc文件中增加下面配置即可:

	"powerline
	set guifont=PowerlineSymbols\ for\ Powerline
	set nocompatible
	set t_Co=256
	let g:Powerline_symbols = 'fancy'
]

===

#vim插件管理器
pathogen是一款管理插件的插件,它采用bundle方式管理Vim插件。
从 https://github.com/tpope/vim-pathogen 下载pathogen插件,在~/Vim/Vim73下增加一个bundle目录,并且把pathogen.vim放到autoload目录下,往_vimrc中添加下面代码:
call pathogen#infect()
......
===

VIM 插件list
a.vim    //头文件和编程文件之间切换  
AutoComplPop		//自动补全插件
bufexplorer.vim      //文件浏览器,基本不用  
color_sample_pack.vim   //各种颜色主题  
csExplorer.vim                // 主题管理插件
DoxygenToolkit.vim         //个性文本生成工具,知道大概干什么,以后再说  
genutils.vim   
lookupfile.vim                 //查找文件插件  
mark.vim                        //标记高亮显示  
minibufexpl.vim				//多文件编辑
NERD_commenter.vim   //注释插件  
NERD_tree.vim  
project.vim                    //工程目录插件  
ShowFunc.vim               //显示函数插件,还没怎么用  
taglist.vim                     //前提是安装了ctags,此插件才好用,Exburant ctags  
winfileexplorer.vim        //winmanager里的,winmanager可以控制taglist和bufexplorer的显示。  
winmanager.vim  
wintagexplorer.vim  
xdebug					// vim xdebug插件
MiniBufExplorer			//多文件编辑
task.vim 				//任务插件


echofunc.vim
[
	插件 echofunc 依赖于另一个插件 ctags 。创建 tags 文件时使用以下命令:
	$ ctags -R --fields=+lS
	--
	当在函数名后输入 ( ,就会在命令行上现实出该函数的声明
	--
	如果该函数在工程中有多个声明,可通过 ctrl+- 或者 ctrl+= 进行前翻或后翻。要注意的是该功能只能在 gvim 上使用。至少我的 vim 没有响应这个功能
]

srcexpl.vim				//实现source insight的预览框的功能

trinity.vim				//这个插件将 srcexpl、taglist、NERD_tree这三个插件集中起来做成IDE
[
	// http://www.vim.org/scripts/script.php?script_id=2347
	这个也是上面那个大牛写的,里面有含有NERD_tree这个插件。我直接用NERD_tree原插件替换过没有出现过问题。
	NERD_tree是实现图中最右边的功能框。就是实现文件树这个功能,而这个Trinity的文件下有一个trinity.vim,是实现三个功能框快速开关的功能
	把这三个文件解压后会有taglist.vim  srcexpl.vim  NERD_tree.vim  trinity.vim这四个插件,直接复制到vim安装目录下的plugin文件夹下,我的RHEL6.3的vim是安装在/urs/share/vim文件夹下。我把这四个插件复制到了/usr/share/vim/vimfiles/plugin。然后在修改/etc文件夹下的vimrc文件。在最后一行加上
	" Open and close all the three plugins on the same time 
	nmap <F8>   :TrinityToggleAll<CR> 

	" Open and close the srcexpl.vim separately 
	nmap <F9>   :TrinityToggleSourceExplorer<CR> 

	" Open and close the taglist.vim separately 
	nmap <F10>  :TrinityToggleTagList<CR> 

	" Open and close the NERD_tree.vim separately 
	nmap <F11>  :TrinityToggleNERDTree<CR> 
	这个是Trinity中的使用介绍,也就是F8打开关闭所有的功能框,F9打开关闭SourceExplorer功能框,剩下的都是相关的键控制相关的功能框。可以自己定义功能键。F10另一个功能就是更新ctags的内容,如果更改了代码保存后按下F10更新ctags。
	当然如果再加上set mouse=a  就可以再vim下使用鼠标了。
	这时先在你的工程目录下执行ctags -R后用vim打开一个文件,按下F8(打开所有的功能框),试一试是不是和source insight一样了。
	要去到预览框中的文件直接在预览框中双击鼠标,要返回就按空格键
]


===
vim phpide
{
	php.vim
	phpcomplete
	assistant |vim php assistant	//php语法增强插件
}


vim's People

Contributors

zoushuai518 avatar insanephper avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.