On Wed, Aug 4, 2010 at 7:27 AM, Jakson A. Aquino <[email protected]> wrote: > On Tue, Aug 3, 2010 at 9:47 PM, Jakson A. Aquino <[email protected]> > wrote: >> On Tue, Aug 3, 2010 at 5:39 PM, Bram Moolenaar <[email protected]> wrote: >>> >>> Jakson A. Aquino wrote: >>> >>>> When running diff without options, removed lines are separated of >>>> added ones by '^---$'. This pattern gets interpreted as diffRemoved >>>> when it is not. I think the pattern can be classified as diffLine. If >>>> I'm not interpreting it wrongly the attached patch fix this tiny bug. >>> >>> Yeah, diffRemoved is not right, I'll include the change. >>> >>>> Locale problem: The diff in languages other than English may generate >>>> output that doesn't match the patterns for diffOnly, diffDiffer, etc. >>>> because diff messages get translated in some languages. To fix this >>>> for my locale (pt_BR.UTF-8) I've put in my >>>> ~/.vim/after/syntax/diff.vim the following lines: >>>> >>>> syn match diffOnly "^[A-Z].*" >>>> syn match diffIdentical "^[A-Z].*" >>>> syn match diffDiffer "^[A-Z].*" >>>> syn match diffBDiffer "^[A-Z].*" >>>> syn match diffIsA "^[A-Z].*" >>>> syn match diffNoEOL "^[A-Z].*" >>>> syn match diffCommon "^[A-Z].*" >>>> >>>> I repeated the same pattern because sometimes I use the terminal >>>> emulator in English and the above patterns will still be fine. A more >>>> general solution would be to define the above syntax elements first >>>> using the pattern "^\S.*" and, then, define the other syntax elements. >>>> This approach would have at least one shortcoming: the distinction >>>> between diffOnly, diffidentical, etc. would be lost. >>> >>> But using the same pattern will mean one of them wins, you can leave out >>> all the others. >>> >>> I think the only real solution would be to include the translations. >>> I found the German one, but most others result in English for me. >>> >>> syn match diffOnly "^Only in .*" >>> syn match diffOnly "^Nur in .*" >> >> One problem of using translations is that it will be necessary to >> track them because they may change. For example, "apenas" and >> "somente" are both Portuguese translations for "only". The first one >> is used in Ubuntu 10.04 and the second in Debian unstable. Ubuntu and >> Debian currently carry different versions of the package diffutils. I >> wrote the script getStrings.sh to automatically get the strings out of >> .po files. Then I manually edited the output with Vim and added the >> result to syntax/diff.vim. For Portuguese, I manually added the other >> translation to "Only". Were you thinking in something like this? I >> retrieved the translations of the attached diff.vim from the Debian >> unstable package of diffutils (version 3.0). There are translations >> for the following locales: >> >> ca cs da de el eo es fi fr ga gl he hu id it ja lv ms nl pl pt_BR ro >> ru sr sv tr uk vi zh_CN zh_TW >> >> I attached the getStrings and vim.diff files. > > I've improved the getStrings.sh script. There is no need anymore of > manually editing the generated difftranslations.vim file. One has just > to :read it into syntax/diff.vim. > > I've downloaded the diffutils source from: > http://packages.debian.org/sid/diffutils
I think this is my last improvement to the script which now: 1) Downloads the diffutils source code 2) Unpacks the .tar.bz2 archive 3) Generates the difftranslations.vim file 4) Opens the difftranlations.vim and syntax/diff.vim in Vim (split window). The only two things to do manually is to adjust the path to syntax/diff.vim and to add the difftranslation.vim lines into the appropriate place of syntax/diff.vim. Best regards, Jakson -- You received this message from the "vim_dev" 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
getStrings.sh
Description: Bourne shell script
