On 2013–02–15 Marco Patzer wrote: > In vim pressing “vis” (visualise inner sentence) marks the current > sentence, then pressing “g<Ctrl-g>” yields: > > Selected 2 of 4 lines; 14 of 50 words; 82 of 296 bytes > > That means current sentence is 82 bytes long. The rest is up to you. > Pick a language you like, vim uses its own scripting language but > also has bindings for python, perl, lua, etc. Pseudo-code: > > go to begin of file > start: > get byte length of sentence > if length > max_length > % do something > fi > move on to the next sentence > goto start
Here's a quick and naïve vim function which moves the cursor to the last sentence containing more than 250 bytes when you hit F9. function! GoToLastTooLongSentence() let maxSentenceLength = 250 while line('.') != 1 normal ( | yis let num = strlen(@") if num >= maxSentenceLength normal vis " just for demonstration, remove this break endif endwhile endfunction noremap <F9> :call GoToLastTooLongSentence()<cr> Marco
signature.asc
Description: Digital signature
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________