function! s:Init() let s:blue = "b" let s:white = "w" let s:green = "g" let s:yellow = "y" let s:red = "r" let s:orange = "o" let s:black = " " let s:front = s:white let s:back = s:yellow let s:up = s:red let s:down = s:orange let s:left = s:blue let s:right = s:green endf function! s:InitColors() hi Blue ctermfg=blue ctermbg=blue guifg=blue guibg=blue hi Yellow ctermfg=yellow ctermbg=yellow guifg=yellow guibg=yellow hi Orange ctermfg=lightred ctermbg=lightred guifg=lightred guibg=lightred hi Green ctermfg=green ctermbg=lightgreen guifg=green guibg=green hi Red ctermfg=red ctermbg=lightred guifg=red guibg=red hi White ctermfg=white ctermbg=white guifg=white guibg=white hi Black ctermfg=black ctermbg=black guifg=black guibg=black exe "syn match Blue /" . s:blue ."/" exe "syn match White /" . s:white ."/" exe "syn match Green /" . s:green ."/" exe "syn match Yellow /" . s:yellow ."/" exe "syn match Red /" . s:red ."/" exe "syn match Orange /" . s:orange ."/" exe "syn match Black /" . s:black ."/" endf function! s:InitFace (face, left, up, right, down) let s:{a:face}{a:left}{a:up} = a:face let s:{a:face}{a:up}1 = a:face let s:{a:face}{a:up}{a:right} = a:face let s:{a:face}{a:right}1 = a:face let s:{a:face}{a:right}{a:down} = a:face let s:{a:face}{a:down}1 = a:face let s:{a:face}{a:down}{a:left} = a:face let s:{a:face}{a:left}1 = a:face endf function! s:InitCube () call s:InitFace (s:white, s:blue, s:red, s:green, s:orange) call s:InitFace (s:yellow, s:green, s:red, s:blue, s:orange) call s:InitFace (s:blue, s:yellow, s:red, s:white, s:orange) call s:InitFace (s:green, s:white, s:red, s:yellow, s:orange) call s:InitFace (s:red, s:white, s:blue, s:yellow, s:green) call s:InitFace (s:orange, s:white, s:green, s:yellow, s:blue) endf function! s:InitDisplay() call s:UnsetMappings() normal ggdG50o call s:DisplayBlackBox (1,1, 130, 44) endf function! s:DisplayFrontFace (col, lig, face, left, up, right, down) let cmd = "normal " let cmd = cmd."r".s:black."l4r".s:{a:face}{a:left}{a:up} ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:up}1 ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:up}{a:right}."l" let cmd = cmd."r".s:black call cursor (a:lig+0, a:col) | exe cmd call cursor (a:lig+1, a:col) | exe cmd let cmd = "normal " let cmd = cmd."r".s:black."l4r".s:{a:face}{a:left}1 ."l" let cmd = cmd."r".s:black."l4r".a:face ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:right}1 ."l" let cmd = cmd."r".s:black call cursor (a:lig+3, a:col) | exe cmd call cursor (a:lig+4, a:col) | exe cmd let cmd = "normal " let cmd = cmd."r".s:black."l4r".s:{a:face}{a:down}{a:left} ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:down}1 ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:right}{a:down}."l" let cmd = cmd."r".s:black call cursor (a:lig+6, a:col) | exe cmd call cursor (a:lig+7, a:col) | exe cmd endf function! s:Display3dTop (col, lig, face, left, up, right, down) let cmd = "normal " let cmd = cmd."r".s:black."l4r".s:{a:face}{a:left}{a:up} ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:up}1 ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:up}{a:right}."l" let cmd = cmd."r".s:black call cursor (a:lig+1, a:col+8) | exe cmd let cmd = "normal " let cmd = cmd."r".s:black."l4r".s:{a:face}{a:left}1 ."l" let cmd = cmd."r".s:black."l4r".a:face ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:right}1 ."l" let cmd = cmd."r".s:black call cursor (a:lig+2, a:col+5) | exe cmd let cmd = "normal " let cmd = cmd."r".s:black."l4r".s:{a:face}{a:down}{a:left} ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:down}1 ."l" let cmd = cmd."r".s:black."l4r".s:{a:face}{a:right}{a:down}."l" let cmd = cmd."r".s:black call cursor (a:lig+3, a:col+2) | exe cmd endf function! s:Display3dSide (col, lig, face, left, up, right, down) let cmd = "normal " let cmd = cmd."r".s:black."l2r".s:{a:face}{a:left}{a:up} ."lk" let cmd = cmd."r".s:black."l2r".s:{a:face}{a:up}1 ."lk" let cmd = cmd."r".s:black."l2r".s:{a:face}{a:up}{a:right}."lk" let cmd = cmd."r".s:black call cursor (a:lig+4, a:col+15) | exe cmd call cursor (a:lig+5, a:col+15) | exe cmd let cmd = "normal " let cmd = cmd."r".s:black."l2r".s:{a:face}{a:left}1 ."lk" let cmd = cmd."r".s:black."l2r".a:face ."lk" let cmd = cmd."r".s:black."l2r".s:{a:face}{a:right}1 ."lk" let cmd = cmd."r".s:black call cursor (a:lig+7, a:col+15) | exe cmd call cursor (a:lig+8, a:col+15) | exe cmd let cmd = "normal " let cmd = cmd."r".s:black."l2r".s:{a:face}{a:down}{a:left} ."lk" let cmd = cmd."r".s:black."l2r".s:{a:face}{a:down}1 ."lk" let cmd = cmd."r".s:black."l2r".s:{a:face}{a:right}{a:down}."lk" let cmd = cmd."r".s:black call cursor (a:lig+10, a:col+15) | exe cmd call cursor (a:lig+11, a:col+15) | exe cmd endf function! s:DisplayBurstView (col, lig, up, left, front, right, back, down) call s:DisplayFrontFace (a:col+22, a:lig+1, a:up, a:left, a:back, a:right, a:front) call s:DisplayFrontFace (a:col+3, a:lig+11, a:left, a:back, a:up, a:front, a:down) call s:DisplayFrontFace (a:col+22, a:lig+11, a:front, a:left, a:up, a:right, a:down) call s:DisplayFrontFace (a:col+41, a:lig+11, a:right, a:front, a:up, a:back, a:down) call s:DisplayFrontFace (a:col+60, a:lig+11, a:back, a:right, a:up, a:left, a:down) call s:DisplayFrontFace (a:col+22, a:lig+21, a:down, a:left, a:front, a:right, a:back) endf function! s:DisplayBlackBox (col, lig, width, height) let i=a:lig while i ".s:white. " :call RotateWhite(1)" exe "nmap ".s:yellow." :call RotateYellow(1)" exe "nmap ".s:red. " :call RotateRed(1)" exe "nmap ".s:orange." :call RotateOrange(1)" exe "nmap ".s:blue. " :call RotateBlue(1)" exe "nmap ".s:green. " :call RotateGreen(1)" exe "nmap :call RotateWhite(3)" exe "nmap :call RotateYellow(3)" exe "nmap :call RotateRed(3)" exe "nmap :call RotateOrange(3)" exe "nmap :call RotateBlue(3)" exe "nmap :call RotateGreen(3)" exe "nmap :call RotateWhite(2)" exe "nmap :call RotateYellow(2)" exe "nmap :call RotateRed(2)" exe "nmap :call RotateOrange(2)" exe "nmap :call RotateBlue(2)" exe "nmap :call RotateGreen(2)" endf function! s:UnsetMappings () mapclear endf function! s:RotateWhite(nb) let i=0 | while i