On Aug 19, 8:06 pm, Bee <[email protected]> wrote:
> Bee wrote:
> > How can the x be moved into the ReplaceWithEncoding() function?
>
> > This will replace the selected text with the encoded text and restore
> > the " register.
>
> > function ReplaceWithEncoding()
> >   let save = @0
> >   let @" = Encode(@")
> >   normal P
> >   let @" = save
> > endfun
>
> > vmap <F5> x:call ReplaceWithEncoding()<cr>
>
> > -Bill
>
> ok... this works.
>
> function ReplaceWithEncoding()
>   let save = @"
>   normal! gvx
>   let @" = Encode(@")
>   normal P
>   let @" = save
> endfun
>
> vmap <F5> :call ReplaceWithEncoding()<cr>

This also works, but does not have a problem with replacing characters
at the end of a line.

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

-Bill

-- 
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