Here is the whole script.
Encode selected text as html entities.

function Encode(str)
  let out = ''
  for i in range(strlen(a:str))
    let c = a:str[i]
    let n = char2nr(c)
    let r = Urndm(0,9)
    if r > 6 && c != "@" && c != "."
      let e = c
    elseif r > 3
      let e = printf("&#x%x;",n)
    else
      let e = printf("&#%d;",n)
    endif
    let out = out . e
  endfor
  return out
endfun

function ReplaceWithEncoding()
  let save = @@
  normal! gvy
  let @/ = @@
  '<,'>s//\=Encode(@@)/
  normal! `<
  let @@ = save
endfun

vmap <F5> :call ReplaceWithEncoding()<cr>

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to