You can use the tr() function in combination with :global
:g/./call setline(line('.'), tr(getline('.'), 'ABCD', 'PQRS'))
Easy to adapt it to the team :%Tr#ABCD#PQRS .
:command! -nargs=1 -range=1 Translate <line1>,<line2>call s:Translate(<f-args>) function! s:Translate(repl_arg) range abort let sep = a:repl_arg[0] let fields = split(a:repl_arg, sep) " build the action to execute let cmd = a:firstline . ',' . a:lastline . 'g'.sep.'.'.sep \. 'call setline(".", tr(getline("."), '.string(fields[0]).','.string(fields[1]).'))' " echom cmd " and run it exe cmd endfunction
source share