I have a LaTeX file with a bunch of commands of the form \label{<word>} where the <word> represents a string that contains special characters, namely  . I'm looking for a quick way to change the special characters into a corresponding ASCII character(s): a e i o u y dh th ae oe. To give an example, I want to change \label{orabk} to \label{ordhabok}. If I wanted just to change, for example, all 's to th, I would visually select the word inside the \label{}, exit to normal mode and then use:s/\%V/th/geAnd I could give two such commands at the same time using |, e.g.:s/\%V/th/ge|s/\%V/dh/geI guess I could just string together all ten commands, but I was hoping for a more elegant way. In particular, I would like to not have to write the \%V and the g every time.A follow-up question: I have to do this for every \label{} command in a very long file, and I plan to make a macro or commmand that automates it. My plan was to make a macro that searches for the next occurance of \label{, visually selects the word inside the {}, and performs the substitutions I described above. Then I would just count the \label commands and run the macro that many times. If I get help with the first question, then I know how to implement this. But is there another method that would be faster for a very long file?
Multiple search-replace operations on a selection
substitute;macro
How about ... a substitution inside another one, and all thrown in a loop? E.g.function! s:replaceSpecialChars(name)    let from = ['','','','','','','','','','']    let to = ['a','e','i','o','u','y','dh','th','ae','oe']    let i = 0    while i < len(from)        exe '%s/' . a:name . '{\zs.\{-}\ze}/\=substitute(submatch(0),from[i], to[i], g)/g'        let i += 1    endwhileendfunctioncommand! -nargs=1 ReplaceSpecialChars call s:replaceSpecialChars(<f-args>)Copy the above code in a vim file, and source the file (e.g. :w and so % if it's the current file). Then you can run it when you are in your LaTeX buffer like this::ReplaceSpecialChars labelJust make sure to keep those lists (from, to) matched (equal nr. of elements).This function globally replaces, in turn, any number of occurences of one of the characters from the from[] list to their to[] correspondent, but only for text found inside the <name>{ } construct.