Skip to content

Commit

Permalink
Allow vimfiles to work with native macOS vim diffopt
Browse files Browse the repository at this point in the history
  • Loading branch information
David Shepherd committed Nov 2, 2021
1 parent 8b99e8e commit 5fe064f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Significant changes to vimfiles (newest changes first).
Changes marked with "BREAKING CHANGE" indicate an incompatible change that may
require adjustment of per-user settings.

2021-11-02
==========

- Fix diffopt errors when using native macOS vim, see
https://github.com/thoughtbot/dotfiles/issues/655

2021-10-19
==========

Expand Down
12 changes: 8 additions & 4 deletions vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -985,10 +985,11 @@ set updatetime=1000
" Disallow octal numbers for increment/decrement (CTRL-a/CTRL-x).
set nrformats-=octal

" Perform vertically split diffs by default.
set diffopt+=vertical

if v:version > 801 || (v:version == 801 && has('patch-8.1.0360'))
if has('mac') && $VIM == '/usr/share/vim'
" Built-in vim doesn't support diffopt internal options
" ref: https://github.com/thoughtbot/dotfiles/issues/655#issuecomment-605019271
set diffopt-=internal
elseif v:version > 801 || (v:version == 801 && has('patch-8.1.0360'))
" Use the new internal diff feature with options:
" - indent-heuristic: uses indentation to improve diffs.
" - algorithm:histogram: an improved patience algorithm as used in Git.
Expand All @@ -997,6 +998,9 @@ if v:version > 801 || (v:version == 801 && has('patch-8.1.0360'))
set diffopt+=algorithm:histogram
endif

" Perform vertically split diffs by default.
set diffopt+=vertical

" Unfortunately, do to some redirection that Vim uses underneath the hood, it
" can hide an error status of a command. This helps to preserve the error
" status so v:shell_error and the command can be tested for the success.
Expand Down

0 comments on commit 5fe064f

Please sign in to comment.