bairui

GetSearch

Jun 15th, 2011
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.27 KB | None | 0 0
  1. func! GetSearch(pat)
  2.   let l:ss = &selection
  3.   let &selection = "inclusive"
  4.   let l:rs = @@
  5.   let l:v = ''
  6.   if search(a:pat, 'W')
  7.     call search(a:pat, 'esW')
  8.     normal! v``y
  9.     let l:v = @@
  10.   endif
  11.   let &selection = l:ss
  12.   let @@ = l:rs
  13.   return l:v
  14. endfunc
Advertisement
Add Comment
Please, Sign In to add comment