Changes between Version 3 and Version 4 of Programming/Python/MercurialDiffsWithVimOnWindows
- Timestamp:
- Jan 17, 2017, 8:21:08 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Programming/Python/MercurialDiffsWithVimOnWindows
v3 v4 3 3 4 4 [[Image(htdocs:images/mercurial/using-vim-with-mercurial-for-diffs.png, alt="vim + mercurial", align=center)]] 5 6 **[#UPDATE-2017-Jan-17 UPDATED 2017-Jan-17] for newer versions of !DirDiff.** 5 7 6 8 I had the devil of a time getting vimdiff and mercurial to play nicely with with each other on Windows for visual diffs. It worked great on posix systems using instructions from the mercurial wiki both to diff single files as well as a multiple files. But on Windows, it would only work for single files, giving me rather strange errors when trying to diff multiple files. … … 42 44 43 45 The simple solution to the problem was to remove the trailing backslash if it was present. The easiest way to do that is to use the vim built-in function substitute. This function is the same one that is invoked within the editor when you do a find-replace. So, I modified the arguments passed to vimdiff as shown below and things were hunky dory. 44 `opts.vdiff=-f "+next" "+execute "DirDiff" fnameescape(substitute(argv(0), '$', '', '')) fnameescape(substitute(argv(1), '$', '', ''))"` 46 {{{ 47 opts.vdiff=-f "+next" "+execute 'DirDiff' fnameescape(substitute(argv(0), '\\$', '', '')) fnameescape(substitute(argv(1), '\\$', '', ''))"` 48 }}} 49 50 **[#UPDATE-2017-Jan-17 UPDATE 2017-Jan-17]**: If you still run into an issue after the above fix and get an error message "There is no diff at the current line!", you are most likely using a newer version of !DirDiff which forces UNIX-style locale specification at the command line without checking if it's running on Windows. The fix is to add the following line to your _vimrc or .vimrc file: 51 {{{ 52 let g:DirDiffForceLang="" 53 }}} 54 45 55 46 56 === Mixing MSYS and ''native'' Windows vim ===