> > For more information, visithttp://
www.vim.org/maillist.php
>
> --
> J.B. Lethbridge
> (Gen. Ed. The Manchester Spenser)
> English Seminar
> Tuebingen University
> WIlhelmstrasse 50
> Tuebingen
> 72074 Germany
" -------1---------2---------3---------4---------5---------6----
" Found time to play with this sort.
"
" The following vim function will sort
" the selected lines of poetry and
" put the result in the "a register.
"
" It is most likely much slower than Tim's python script
" but is is completely vim script.
"
" Does it do what you want?
function! SortPoems() range
let aaa = []
let current = a:firstline
while current <= a:lastline
let aaa = aaa + [reverse(split(getline(current)))]
let current = current + 1
endwhile
let sss = sort(aaa,1) " 1=ignore case
let @a = ""
let current = 0
while current < a:lastline - a:firstline
let @a = @a . join(reverse(sss[current])) . "\n"
let current = current + 1
endwhile
let @a = @a . join(reverse(sss[current]))
endfun " usage :'<,'>call SortPoems()<cr>
finish
" -------1---------2---------3---------4---------5---------6----
Raw:
6.4.30.7 All these our ioyes and all our blisse abate
2.12.15.9 And after them did driue with all her power and might
3.9.14.4 And both full liefe his boasting to abate
6.6.27.9 And layd at him amaine with all his will and might
6.1.38.2 At once did heaue with all their powre and might
6.1.12.7 But through misfortune which did me abase
5.11.57.9 Did set vpon those troupes with all his powre and might
6.2.26.5 For deare affection and vnfayned zeale
3.2.13.6 For hardy thing it is to weene by might
4.9.6.9 He her vnwares attacht and captiue held by might
6.1.32.9 He spide come pricking on with al his powre and might
6.6.31.9 He stayd his second strooke and did his hand abase
3.8.51.6 Mote not mislike you also to abate
3.8.28.7 Ne ought your burning fury mote abate
1.7.35.1 No magicke arts hereof had any might
5.8.46.8 She at her ran with all her force and might
1.10.2.8 She cast to bring him where he chearen might
3.7.35.3 That at the last his fiercenesse gan abate
4.8.17.8 That her inburning wrath she gan abate
1.10.47.7 That hill they scale with all their powre and might
4.6.3.4 The armes he bore his speare he gan abase
5.9.39.4 To all assayes; his name was called Zele
2.9.7.4 To serue that Queene with all my powre and might
2.1.26.7 When suddenly that warriour gan abace
6.12.23.9 Where he him found despoyling all with maine and might
1.5.1.8 With greatest honour he atchieuen might
4.8.1.7 With sufferaunce soft which rigour can abate
5.5.30.1 With that she turn'd her head as halfe abashed
" -------1---------2---------3---------4---------5---------6----
Result:
2.1.26.7 When suddenly that warriour gan abace
4.6.3.4 The armes he bore his speare he gan abase
6.6.31.9 He stayd his second strooke and did his hand abase
6.1.12.7 But through misfortune which did me abase
5.5.30.1 With that she turn'd her head as halfe abashed
6.4.30.7 All these our ioyes and all our blisse abate
4.8.1.7 With sufferaunce soft which rigour can abate
3.7.35.3 That at the last his fiercenesse gan abate
4.8.17.8 That her inburning wrath she gan abate
3.8.28.7 Ne ought your burning fury mote abate
3.8.51.6 Mote not mislike you also to abate
3.9.14.4 And both full liefe his boasting to abate
5.8.46.8 She at her ran with all her force and might
6.12.23.9 Where he him found despoyling all with maine and might
2.12.15.9 And after them did driue with all her power and might
6.1.32.9 He spide come pricking on with al his powre and might
5.11.57.9 Did set vpon those troupes with all his powre and might
2.9.7.4 To serue that Queene with all my powre and might
6.1.38.2 At once did heaue with all their powre and might
1.10.47.7 That hill they scale with all their powre and might
6.6.27.9 And layd at him amaine with all his will and might
1.7.35.1 No magicke arts hereof had any might
1.5.1.8 With greatest honour he atchieuen might
4.9.6.9 He her vnwares attacht and captiue held by might
3.2.13.6 For hardy thing it is to weene by might
1.10.2.8 She cast to bring him where he chearen might
6.2.26.5 For deare affection and vnfayned zeale
5.9.39.4 To all assayes; his name was called Zele
" -------1---------2---------3---------4---------5---------6----