makecols.vim: converting lists to columns made simple
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
576 B

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. " makecols.vim - Makecolumns
  2. " Author: Levi Olson <http://leviolson.com/>
  3. " Version: 1.0
  4. function! s:makecols()
  5. return s:get_visual_selection()
  6. endfunction
  7. function! s:get_visual_selection()
  8. let [lnum1, col1] = getpos("'<")[1:2]
  9. let [lnum2, col2] = getpos("'>")[1:2]
  10. let lines = getline(lnum1, lnum2)
  11. let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)]
  12. let lines[0] = lines[0][col1 - 1:]
  13. return lines
  14. " return join(lines, "\n")
  15. endfunction
  16. vnoremap mc :call <SID>makecols()<CR>
  17. " vim:set ft=vim sw=4 sts=4 et: