bairui

Super, thanks for asking!

Jan 7th, 2012
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.36 KB | None | 0 0
  1. " Super, thanks for asking!
  2. " Barry Arthur, Jan 8 2012
  3.  
  4. function! Superscript()
  5.   let line = matchlist(strpart(getline('.'), 0, col('.')), '.*\[\(\d\+\)$')
  6.   if len(line) != 0
  7.     let num = line[1]
  8.     return "\<c-w>\<c-w>".join(map(split(num, '\zs'), '"\<c-k>".v:val."S"'), '')
  9.   else
  10.     return ']'
  11.   endif
  12. endfunction
  13.  
  14. inoremap <expr> ] Superscript()
Advertisement
Add Comment
Please, Sign In to add comment