Friday, December 17, 2010

macro for an affine cipher

Greetings and Happy Holidays,

I'm a long-time user of vim but new to vim macros.

Wanting to go a few steps beyond rot13, I'd like to build a macro that implements an affine cipher. I see where vim can do modular arithmetic, so the questions are:
1. can vim do char->int and int->char transformations?
2. does vim have some flavor of a for-loop ( for looping over every
character in a file?
3. can vim directly access characters at specific locations? Like
Like Java's StringBuffer.charAt(int)
and StringBuffer.setCharAt(int)

perhaps something like creating a sub-function foomagic to handle the transformation then something like
%s/char/foomagic{char}/

Any suggestions/hints/constructive critisms and especially examples are all welcome.

Thanks,


Still-learning Stuart

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

No comments: