> Hi Andrei!
>
> I am not sure, I understand your problem. Anyway, your function has one
> problem. You are deleting lines (including the end-of-line), so you
> after the exe "normal! dd" command your file has actually one line less
> then before. And the next time you run getline(linenum) you get actually
> the wrong line. (which would now be equivalent to linenum+1 and each
> time you do normal! dd you add another one)
Thanks, I have rewritten the function like this:
fu! <SID>RemoveFuzzy() range
for linenum in range(a:firstline, a:lastline)
let line = getline(linenum)
if line =~ '^#,\sfuzzy$'
let startline = linenum
let endline = linenum
elseif line =~ '^#|\s.*".*"$'
let endline = endline + 1
endif
endfor
exe startline.",".endline."d"
endf
This works because .po files have a strict format I can rely on, but I
have a feeling it could be shorter...
Regards,
Andrei
--
http://nuvreauspam.ro/2010/05/4-neticheta-pe-mail/
No comments:
Post a Comment