Paul, This works fantastic. Thanks
Jeri On Sun, Apr 13, 2014 at 8:45 AM, Paul Isambert <[email protected]> wrote: > Jeri Raye <[email protected]> a écrit: > > Hi, > > > > I have an srt file where every new subtitle starts with a capital letter. > > See here an example. > > > > +-----+ > > 12 > > 00:01:35,095 --> 00:01:38,598 > > The people you see > > actually lived. > > > > 13 > > 00:01:38,598 --> 00:01:41,601 > > All the words > > they speak > > > > 14 > > 00:01:41,601 --> 00:01:44,604 > > Were spoken > > or written by them. > > > > 15 > > 00:01:46,606 --> 00:01:50,110 > > +-----+ > > > > I would like to change this. > > I would like that only the new subtitle that follow after an dot (.) of > the > > previous subtitle starts with a captial letter. > > > > So in the example shown, in subtitle 14, the word 'Were' should be > changed > > in 'were'. > > > > How to do that? > > Define this function somewhere: > > function! LowerSub () > for l in range(1, line("$")) > if getline(l) =~ '-->' && getline(prevnonblank(l-2)) =~ > '[[:alpha:]].*[^.?!]$' > call setline(l+1, substitute(getline(l+1), '^.', > '\=tolower(submatch(0))', '')) > endif > endfor > endfunction > > and call it (":call LowerSub()") in your SRT file. I've added the > question/exclamation marks to the dot because it seemed to make sense, > but you can change that easily. > > If you wait a few days (or even a few hours), some wizard should come > up with something using ":global" :) > > Best, > Paul > > -- > -- > You received this message from the "vim_use" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_use" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
