Skip to content

Instantly share code, notes, and snippets.

@dahu
Created November 11, 2012 10:28
Show Gist options
  • Save dahu/4054442 to your computer and use it in GitHub Desktop.
Save dahu/4054442 to your computer and use it in GitHub Desktop.
RotateBuffer
function! RotateBuffer()
let rb=[]
for x in range(max(map(getline(1, '$'), 'len(v:val)')))
call add(rb, [])
for y in range(line('$'))
call add(rb[x], ' ')
endfor
endfor
let y = 0
for line in getline(1,'$')
let x = 0
for c in split(line, '\zs')
let rb[x][y] = c
let x += 1
endfor
let y += 1
endfor
%d
for l in rb
call append(1, join(l, ''))
endfor
0d
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment