2015-09-14
1 "新建php文件的时候添加PHP标记2 autocmd BufNewFile *.php exec ":call AddNotesForPHP() 3 function AddNotesForPHP()4 call append(0,"<?php")5 call AddNotes()6 endfunction
2015-08-31
1 "以下为我的vim的部分配置 2 au FileType php call AddPHPFuncList() 3 function AddPHPFuncList() 4 set dictionary-=~/.vim/php_funclist.txt dictionary+=~/.vim/php_funclist.txt 5 set complete-=k complete+=k 6 endfunction 7 "从这开始是我所说的 8 "在当前行的上面添加函数的注释 9 map <F5> ms:call AddNotes()<cr>'s10 function AddNotes()11 call append(line(".")-1,"/**")12 call append(line(".")-1," * @description/t")13 "多个人使用的话给以给成这样,我就自己用14 "let name=$USER15 "call append(line(".")-1," * @author/t".name."/t".strftime("%Y-%m-%d %H:%M"))16 call append(line(".")-1," * @author/t/zhaoyingnan/t".strftime("%Y-%m-%d %H:%M"))17 call append(line(".")-1," * @param/tint/t/t/t$iVar")18 call append(line(".")-1," * @param/tstring/t/t$sVar")19 call append(line(".")-1," * @param/tarray/t/t$aVar")20 call append(line(".")-1," * @return/t")21 call append(line(".")-1," **/")22 normal gg=G23 endfunction24 25 "添加头文件注释26 map <F4> ms:call AddTitle()<cr>'s27 function AddTitle()28 call append(1,"/**")29 call append(2," * Description: ")30 call append(3," * Create date: ".strftime("%Y-%m-%d %H:%M"))31 "call append(4," * Modified date: ".strftime("%Y-%m-%d %H:%M"))32 call append(4," * Author: zhaoyingnan")33 call append(5," **/")34 endfunction
2015-11-11(更具有通用性)
1 "添加头文件 2 map <F4> ms:call AddTitle()<cr>'s 3 4 function AddTitle() 5 call append(1,"/**") 6 call append(2," * @package/tDescription") 7 call append(3," * @author/t".$USER."<zhaoyn@bbtree.com>") 8 "call append(3," * Create date:".strftime("%Y-%m-%d %H:%M")) 9 "call append(4," * Modified date:".strftime("%Y-%m-%d%H:%M"))10 call append(4," * @copyright/t")11 call append(5," * @version/t")12 call append(6," * @since/t")13 call append(7," **/")14 endfunction15 16 "在当前含的上面添加函数的注释17 map <F5> ms:call AddNotes()<cr>'s18 function AddNotes()19 call append(line(".")-1,"/**")20 call append(line(".")-1," * description/t")21 call append(line(".")-1," * @access/tpublic")22 call append(line(".")-1," * @author/t".$USER."/t".strftime("%Y-%m-%d %H:%M"))23 call append(line(".")-1," * @param/tint/t/t/t$iVar")24 call append(line(".")-1," * @param/tstring/t/t$sVar")25 call append(line(".")-1," * @param/tarray/t/t$arVar")26 call append(line(".")-1," * @return/t")27 call append(line(".")-1," * @note/t")28 call append(line(".")-1," **/")29 normal gg=G30 endfunction
新闻热点
疑难解答