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
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
Get your own email service at ZZN.COM.
No comments:
Post a Comment