用户讨论:Corey:修订间差异
无编辑摘要 |
小无编辑摘要 |
||
第6行: | 第6行: | ||
[[Image:Vim marks.PNG|vim marks]] | [[Image:Vim marks.PNG|vim marks]] | ||
<br> | |||
" ---------<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> | |||
let outputStr = ""<br> let tmpList = ["",""]<br> let tabList = [tmpList] | |||
set nomore<br> redir => outputStr <br> exec 'tabs'<br> redir END | |||
let i = 1<br> while match(outputStr,'^*\n$', i) > -1<br> let tmpstr = matchstr(matchstr(outputStr,'^*\n$', i),'^ [1-9]*\n$')<br> if len(tmpstr) > 1 | |||
let i = i + 1<br> <br> endwhile | |||
return 0<br> |
2008年4月3日 (四) 15:55的版本
喜欢使用ubuntu和vim,但是都不是很了解,都在慢慢学!
最近写的一个gvim的marks脚本。方便自己方便大家!
链接 http://www.vim.org/scripts/script.php?script_id=2194
" ---------
" remark
fun! Move_sign()
let s:tempItem = ["","",""]
let vRLn = "".line(".")
let vRFileName = expand("%:p")
let s:tempItem[1] = vRLn
let s:tempItem[2] = vRFileName
"echo s:tempItem
let vRIndex = s:Check_list(s:tempItem)
if (s:remarkItem[0] ==# "REMARK" )
if vRIndex > 0
silent! exe 'sign define CS' . s:mylist[vRIndex][0] . ' text='. s:mylist[vRIndex][0] .' texthl=Search'
silent! exe 'sign place ' . s:mylist[vRIndex][0] . ' line=' . vRLn . ' name=CS'. s:mylist[vRIndex][0] . ' file=' . vRFileName
let s:remarkItem = s:mylist[vRIndex]
let s:myIndex = vRIndex
"echo s:remarkItem
endif
else
let pionter = s:Check_list(s:remarkItem)
"echo vRIndex ."|" .pionter
if ((vRIndex < 0) && (pionter > 0))
silent! exe 'sign unplace ' .s:remarkItem[0] . ' file=' . s:remarkItem[2]
"silent! exe 'sign undefine' .s:remarkItem[0]
"echo 'sign define CS' . s:remarkItem[0] . ' text='. s:remarkItem[0] .' texthl=ErrorMsg'
silent! exe 'sign define CS' . s:remarkItem[0] . ' text='. s:remarkItem[0] .' texthl=ErrorMsg'
"echo 'sign place ' . s:remarkItem[0] . ' line=' . s:remarkItem[1] . ' name=CS' . s:remarkItem[0] . ' file=' . s:remarkItem[2]
silent! exe 'sign place ' . s:remarkItem[0] . ' line=' . vRLn . ' name=CS' . s:remarkItem[0] . ' file=' . vRFileName
let s:mylist[pionter][1] = vRLn
let s:mylist[pionter][2] = vRFileName
"echo s:mylist[pionter]
let s:myIndex = pionter
let s:remarkItem = ["REMARK","SEARCH","FLAG"]
endif
endif
endfun
--
let outputStr = ""
let tmpList = ["",""]
let tabList = [tmpList]
set nomore
redir => outputStr
exec 'tabs'
redir END
let i = 1
while match(outputStr,'^*\n$', i) > -1
let tmpstr = matchstr(matchstr(outputStr,'^*\n$', i),'^ [1-9]*\n$')
if len(tmpstr) > 1
let i = i + 1
endwhile
return 0