Dup Ver Goto 📝

ExCommandsInVimFunctions

PT2/editor/vim/vimscript does not exist
To
27 lines, 106 words, 743 chars Page 'ExCommandsInVimFunctions' does not exist.

Suppose we can do

:g/     /s/C/I/g

but we want to do this within a vimscript function? Actually, this works

function ToDeg()
    g/     /s/Cm/i/g
    g/     /s/Dm/ii/g
    g/     /s/Em/iii/g
    g/     /s/Fm/iv/g
    g/     /s/Gm/v/g
    g/     /s/Am/vi/g
    g/     /s/Bm/vii/g
    g/     /s/C/I/g
    g/     /s/D/II/g
    g/     /s/E/III/g
    g/     /s/F/IV/g
    g/     /s/G/V/g
    g/     /s/A/VI/g
    g/     /s/B/VII/g
endfunction
nnoremap \ch :call ToDeg()

The idea is that lines with lyrics and chords, if they contain a consecutive run of four or more spaces, are chords not lyrics, so this changes chords, assuming a key of C, to their respective degrees. This makes it easier to then transpose into a different key.