Wednesday, April 16, 2014

Re: Another SRT questions

Le mardi 15 avril 2014 18:26:41 UTC+2, Jeri Raye a écrit :
> How do I add this to the function you send in your reply on my previous SRT question?
>     :%s/[.?!]\_s\+\zs[a-z]/\=toupper(submatch(0))/g

Simply like this:

function! LowerSub ()
%s/[.?!]\_s\+\zs\l/\u&/g
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

I've used John's simpler syntax, where "&" means the whole matched pattern.

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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: