All pastes #98508 Raw Edit

Stuff

public text v1 · immutable
#98508 ·published 2006-07-24 15:41 UTC
rendered paste body
.vimrc:
=========================
fun! PySort()

    let ai_revert = 0
    let tw_revert = 0
    let ignorecase_revert = 0
    if ! &autoindent
        let ai_revert = 1
        set autoindent
    endif
    if &textwidth == 0
        let tw_revert = 1
        set textwidth=90
    endif

    normal! gv"ay
    let text = matchstr(@a, '\s*\zs.*\ze\s*')
    let list = split(text, '\_s*,\_s*')
    call sort(list)
    let @a = join(list, ', ')
    normal! gv"ap

        normal! >>
        normal! >>
        normal! gqq

    if ai_revert
        set noautoindent
    endif
    if tw_revert
        set textwidth=0
    endif

endfun

map <C-S> :call PySort()<CR>
=========================

howto use: select list and press Ctrl+s