查看“用户讨论:Corey”的源代码
来自Ubuntu中文
←
用户讨论:Corey
跳到导航
跳到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
喜欢使用ubuntu和vim,但是都不是很了解,都在慢慢学! 最近写的一个gvim的marks脚本。方便自己方便大家! 链接 http://www.vim.org/scripts/script.php?script_id=2194<br> [[Image:Vim marks.PNG|vim marks]] let s:remarkItem = ["REMARK","SEARCH","FLAG"]<br> " remark<br>fun! Move_sign() let s:tempItem = ["","",""]<br> let vRLn = "".line(".")<br> let vRFileName = expand("%:p") let s:tempItem[1] = vRLn<br> let s:tempItem[2] = vRFileName<br> "echo s:tempItem <br> let vRIndex = s:Check_list(s:tempItem) if (s:remarkItem[0] ==# "REMARK" ) <br> if vRIndex > 0<br> silent! exe 'sign define CS' . s:mylist[vRIndex][0] . ' text='. s:mylist[vRIndex][0] .' texthl=Search'<br> silent! exe 'sign place ' . s:mylist[vRIndex][0] . ' line=' . vRLn . ' name=CS'. s:mylist[vRIndex][0] . ' file=' . vRFileName<br> let s:remarkItem = s:mylist[vRIndex]<br> let s:myIndex = vRIndex<br> "echo s:remarkItem<br> endif<br> else<br> let pionter = s:Check_list(s:remarkItem)<br> "echo vRIndex ."|" .pionter <br> if ((vRIndex < 0) && (pionter > 0)) <br> silent! exe 'sign unplace ' .s:remarkItem[0] . ' file=' . s:remarkItem[2]<br> "silent! exe 'sign undefine' .s:remarkItem[0]<br> "echo 'sign define CS' . s:remarkItem[0] . ' text='. s:remarkItem[0] .' texthl=ErrorMsg'<br> silent! exe 'sign define CS' . s:remarkItem[0] . ' text='. s:remarkItem[0] .' texthl=ErrorMsg'<br> "echo 'sign place ' . s:remarkItem[0] . ' line=' . s:remarkItem[1] . ' name=CS' . s:remarkItem[0] . ' file=' . s:remarkItem[2]<br> silent! exe 'sign place ' . s:remarkItem[0] . ' line=' . vRLn . ' name=CS' . s:remarkItem[0] . ' file=' . vRFileName<br> let s:mylist[pionter][1] = vRLn<br> let s:mylist[pionter][2] = vRFileName<br> "echo s:mylist[pionter]<br> let s:myIndex = pionter<br> let s:remarkItem = ["REMARK","SEARCH","FLAG"]<br> endif<br> endif<br>endfun<br> " -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*<br>" all of them used for the jump.<br>fun! s:Sign_jump(aSignID, aFileName)<br> let bufferList = s:GetBufferList()<br> "echo bufferList<br> let bufferExits = s:Seach_file(a:aFileName, bufferList) if bufferExits > 0<br> silent! exe 'tabn ' . bufferExits<br> silent! exe 'sign jump '. a:aSignID[0] . ' file='. a:aFileName<br> else<br> call s:Open_file(a:aFileName) silent! exe 'sign place ' . a:aSignID[0] . ' line=' . a:aSignID[1] . ' name=CS'. a:aSignID[0] . ' file=' . a:aSignID[2] silent! exe 'sign jump '. a:aSignID[0] . ' file='. a:aFileName<br> endif endfun<br>" ---------------------------------------------------------------------<br>" get buffer list <br>fun! s:GetBufferList()<br> <br> let vResult = [["0","[ * THE <?> HEAD * ]"]]<br> let i = 0 while i < tabpagenr('$') "exe 'tabn ' . i + 1<br> if i == 0 <br> silent! exe 'tabfirst'<br> else<br> silent! exe 'tabnext'<br> endif<br> let bufname = expand("%:p")<br> let vResult = vResult + [[i + 1, bufname]]<br> let i = i + 1<br> endwhile <br> <br> return vResult<br>endfun " ---------------------------------------------------------------------<br>" open file<br>fun! s:Open_file(aFileName)<br> if filereadable(a:aFileName)<br> "call s:Flash_signs()<br> if tabpagenr('$') > 1 <br> silent! exe 'tabnew '. a:aFileName<br> silent! exe 'tabn ' . tabpagenr('$')<br> else<br> silent! exe 'e '. a:aFileName<br> endif<br> endif<br>endfun<br>" ---------------------------------------------------------------------<br>" search file<br>" find the file, return the position; else return -1<br>fun! s:Seach_file(aFileName, aBufferList) let vResult = -1 if len(a:aBufferList) > 1 <br> if s:win32Flag == 1<br> for item in a:aBufferList<br> " file name is ignoring case<br> if (item[1] ==? a:aFileName)<br> return item[0]<br> endif<br> endfor<br> else<br> for item in a:aBufferList<br> " file name is matching case<br> if (item[1] ==# a:aFileName)<br> return item[0]<br> endif<br> endfor<br> endif <br> endif<br> return vResult<br>endfun<br>" ---------------------------------------------------------------------<br><br>
返回
用户讨论:Corey
。
导航菜单
页面操作
用户页
讨论
阅读
查看源代码
历史
页面操作
用户页
讨论
更多
工具
个人工具
登录
导航
首页
最近更改
随机页面
页面分类
帮助
搜索
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
用户贡献
日志
查看用户组
特殊页面
页面信息